#include #include #include "machdefs.h" #include #include #include #include "harmspher.h" using namespace std; /* ---------------------------------------------------------------- ----- Calcul des fonctions de Legendre Plm(cos(Theta)) ------ ---------------------------------------------------------------- (partie theta des harmoniques spheriques) HarmSph_array(int lmax,int m,double cost,double *Plm) HarmSph_array_teta(int lmax,int m,double teta,double *Plm) - Input: lmax, m and teta or cos(teta) (lmax>=m) array Plm with size at least "lmax-m+1" (calling with HarmSph_array_teta for small teta is more accurate) - Action: compute Psph for fixed "m" and all "l" from "m" to "lmax" - Return array: Psph(l,m) index Psph(l,m) = Plm[l-m] - Return value: Psph(lmax,m) = Plm[lmax-m] - Rappel: x = cos(teta) Polynomes de Legendre associes: P(l,m) Polynomes de Legendre pour les harmoniques spheriques: Psph(l,m) (souvent appelles lambda_lm) Psph(l,m) = sqrt((2l+1)/4Pi) * sqrt((l-m)!/(l+m)!) * P(l,m) ---------------------------------------------------------------- */ double HarmSph_array_teta(int lmax,int m,double teta,double *xlm) { // Debug level const int lp=0; // Si une valeur finale est <10^EXPO_MINI on retourne zero const double EXPO_MINI = DBL_MIN_10_EXP +5; // Si une valeur dans la reccurence est lmax) { cout<<"HarmSph_array_Error: bad arguments lmax="< "<factmaxi) { // On renormalise par factmaxi si on a encore de la reserve d'exposant double fact,efact; if(expos1) cout<<"!! expos==0 !!"<1) cout<EXPO_MINI) xlm[i] *= pow(10.,expos); else xlm[i] = pow(10.,expos+e); } if(lp>1) cout<<" ---> "<