00001 #include "legendrepoly_expansion1d.h" 00002 #include <gsl/gsl_sf_legendre.h> 00003 00004 00008 double CLegendrePolynomialExpansion1d::orthogFunctionValue(double x, int i, int jderiv) const{ 00009 if (jderiv==0) return gsl_sf_legendre_Pl(i,x); 00010 if (jderiv==1) { 00011 if (i==0) return 0.0; 00012 if ( x < 1e-10 ) x=1e-10; //avoid singularity at origin 00013 return ( (double)i/(1-x*x) )*( gsl_sf_legendre_Pl(i-1,x) - x*gsl_sf_legendre_Pl(i,x) ); 00014 } 00015 MESSAGE << "Did not implement basisFunction for jderiv != 0 or 1"<<ENDM_WARN; 00016 return 0.0; 00017 } 00018 00019 00020 // Misc. functions 00021 double CLegendrePolynomialExpansion1d::getLeftSupport(int i) const{return xmin;} 00022 double CLegendrePolynomialExpansion1d::getRightSupport(int i) const{return xmax;}