Thank you very much for sharing Arthur. I was almost intended to do this but...
Best regards, - Nevzat
> As I had rouble with getting |mathmore| I wrote my own simple-minded one:
>
> double leg(int m,double x) {
>
> if(m==0) return 1.0;
> else if(m==1) return x;
> else if(m==2) return (3*x*x-1)/2;
> else if(m==3) return (5*TMath::Power(x,3)-3*x)/2;
> else if(m==4) return (35*TMath::Power(x,4)-30*x*x+3)/8;
> else if(m==5) return
> (63*TMath::Power(x,5)-70*TMath::Power(x,3)+15*x)/8;
> else if(m==6) return
> (231*TMath::Power(x,6)
> -315*TMath::Power(x,4)
> +105*x*x
> -5)/16;
>
> double temp=0;
> double sign=1.0;
> int mp=m/2;
>
> for(int i=0; i<=mp; i++) {
>
> double term=TMath::Factorial(2*m-2*i);
> term/=TMath::Power(2,m);
> term/=TMath::Factorial(i);
> term/=TMath::Factorial(m-i);
> term/=TMath::Factorial(m-2*i);
> term*=TMath::Power(x,m-2*i);
>
> temp+=sign*term;
>
>
> sign=-sign;
>
> }
>
> return temp;
>
> This has numerical problems for large m, so officially available versions
> are likely better. This works ok for m=10 or so.
>
> -Arthur
>
> A.E. Snyder, Group ? \!c*p?/
> SLAC Mail Stop #95 ((. .))
> Box 4349 |
> Stanford, Ca, USA, 94309 '\|/`
> e-mail:snyder_at_slac.stanford.edu o
> phone:650-926-2701 _
> http://www.slac.stanford.edu/~snyder BaBar
> FAX:707-313-0250 Collaboration
> &
> Fermi/GLAST
>
>
>
> On Thu, 17 Mar 2011, Erkcan Ozcan wrote:
>
>> Hi Nevzat,
>>
>> I know I am writing the obvious, but have you tried the following?
>>
>> gSystem->Load("libMathMore")
>> ROOT::Math::legendre( ... )
>>
>> I think for this to work, you must have compiled ROOT with mathmore enabled.
>>
>> Cheers,
>> e.
>>
>> On 18 Mar 2011, at 00:17, <nguler_at_jlab.org>
>> <nguler_at_jlab.org> wrote:
>>
>>> Dear root users,
>>> I could not figure out how to call Legendre functions in a code, without
>>> using
>>> TF1 object. I don't want to plot it or use it in a fit, I just want to use
>>> it
>>> in a calculation such that:
>>>
>>> S(x) = A1*Legendre(1,x) + A2*Legendre(2,x) + ...
>>>
>>> I appreciate your guidance.
>>> Thank you,
>>>
>>> - Nevzat Guler
>>> (757) 553-8318
>>>
>>
>> --
>>
>> In case they are not written explicitly, please be aware that my greetings
>> and farewell are inherently implied in this email.
>>
>> V. Erkcan Özcan, PhD
>> Assistant Professor
>> Bogazici University
>> Department of Physics
>>
>>
>>
>>
This archive was generated by hypermail 2.2.0 : Sat Mar 19 2011 - 17:50:01 CET