/* calculate Chebyshev polynomials */ #include #include "../iolib/message.h" float Chebyshev(n,x,ifnorm) int n,ifnorm; float x; { double a,dbln; float f; if(x<-1.0 || x>1.0 || n<0) STOP(Chebyshev: wrong argument); dbln=(double)n; a=acos((double)x)*dbln; f=cos(a); if(ifnorm) { dbln=4.*dbln*dbln; if(n) f*=sqrt((dbln-1.)/(dbln-2.)); else f*=sqrt(2.); } return(f); }