21 for (
int n=2;n<=N; n++)
24 Pnp1 = ((2.0*ns+1)/(ns+1.0))*x*Pn - (ns/(ns+1.0))*Pnm1;
43 double retval = (N*x/(x*x-1))*
Legendre(N,x);
44 retval-= (N/(x*x-1))*
Legendre(N-1,x);
56 double epsilon = 1.0e-8;
57 if (N==0) {
return 0.0;}
59 if (N==1) {
return 0.0;}
61 double xpos = std::min(x+epsilon, 1.0-1.0e-10);
62 double xneg = std::max(x-epsilon,-1.0+1.0e-10);
63 double dx = xpos - xneg;
68 return (dPdx_pos - dPdx_neg)/dx;
double d2Legendredx2(int N, double x)
double dLegendredx(int N, double x)
double Legendre(int N, double x)