Last active
October 29, 2021 00:34
-
-
Save tenomoto/4021129b493be353702a to your computer and use it in GitHub Desktop.
Scaling factor for the Fourier coefficients of Legendre polynomials
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function abs(n) | |
{ | |
return (n>0)? n : -n | |
} | |
function f1(n, i) | |
{ | |
return sqrt(1 - 1 / (4 * n * n)) | |
} | |
function f2(n, i) | |
{ | |
return sqrt((2*n-1)/(2*n) * (2*n+1)/(2*n)) | |
} | |
function f3(n, i) | |
{ | |
return sqrt(((2*n-1)*(2*n+1))/(4*n*n)) | |
} | |
BEGIN { | |
n = 32 | |
for (i = 5; i <= 20; i++) { | |
x1 = 1 | |
x2 = 1 | |
x3 = 1 | |
for (j = 1; j <=n; j++) { | |
x1 *= f1(j) | |
x2 *= f2(j) | |
x3 *= f3(j) | |
} | |
# printf("%7d %20.17e %20.17e %20.17e %20.17e %20.17e\n", n, x1, x2, x3, abs(x1-x2), abs(x2-x3)) | |
printf("%7d %20.17e %20.17e %20.17e\n", n, x1, x2, abs(x1-x2)) | |
n *= 2 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment