Created
December 1, 2010 07:48
-
-
Save rygorous/723131 to your computer and use it in GitHub Desktop.
Chebyshev v2
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
__forceinline double chebyshev_ryg(int n, double x) | |
{ | |
if (n == 0) return 1.0; | |
if (n == 1) return x; | |
double t = x, t1 = 1, t2; | |
x += x; | |
for (int i=1; i<n; i++) { | |
t2 = t1; | |
t1 = t; | |
t = x * t1 - t2; | |
} | |
return t; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment