if(n==0){ return 0; } if(n==1){ return 1; } var p = .3; var s = p/4; n = n - 1; return -1 * Math.pow(2,10*n) * Math.sin((n-s)*(2*Math.PI)/p);