From af3bad5b0ffbe0f19b0f85519c85a385326dec03 Mon Sep 17 00:00:00 2001 From: Samo Penic <samo@amalthea> Date: Sat, 19 Mar 2011 21:10:19 +0000 Subject: [PATCH] Spherical harmonics should be ok. Note, that there are some difference from proposed theoretical scheme. Is Miha's theory wrong? --- src/sh.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sh.c b/src/sh.c index b494b25..f0b19fa 100644 --- a/src/sh.c +++ b/src/sh.c @@ -64,11 +64,11 @@ fatal("Error using shY function!",1); fac1=1.0; - for(i=1; i<=l-m;i++){ + for(i=1; i<=l-abs(m);i++){ fac1 *= i; } fac2=1.0; - for(i=1; i<=l+m;i++){ + for(i=1; i<=l+abs(m);i++){ fac2 *= i; } @@ -81,9 +81,9 @@ else { //K=pow(-1.0,abs(m))*sqrt(1.0/(2.0*M_PI))*cos(m*fi); if(abs(m)%2==0) - K=sqrt(1.0/(M_PI))*sin(m*fi); + K=sqrt(1.0/(M_PI))*cos(m*fi); else - K=-sqrt(1.0/(M_PI))*sin(m*fi); + K=-sqrt(1.0/(M_PI))*cos(m*fi); } return K*sqrt((2.0*l+1.0)/2.0*fac1/fac2)*plgndr(l,abs(m),cos(theta)); -- Gitblit v1.9.3