Discussion:
[ROOT] Factorial(10) gives bad-numerical-expression-error
Bernd Reinhold
2004-07-13 10:38:15 UTC
Permalink
Hi!

binomial1 = new TF1("binomial1", "[1]*(Factorial(10))/(Factorial(x))/(Factorial(10-x))*power([0],x)*
power(1-[0],10-x)"

I get the following error message, when typing the function above in CINT

*ERROR 30 :
Bad numerical expression : "Factorial(10)"
Error in <TF1::TF1>: function: binomial1/[1]*(Factorial(10))/(Factorial(x))/(Factorial(10-x))*
power([0],x)*power(1-[0],10-x) has 0 parameters instead of 1

And can I put some constraints on x by defining it as 'Int_t x;' before I define the function? Does TF1 recognize the x in its formula as the x defined before as Int_t?

Thank you, Bernd.
Sebastien Greder
2004-07-13 12:12:44 UTC
Permalink
Hello Bernd,

replace Factorial by TMath::Factorial and power by Tmath::Power
and it should work.

cheers,

sebastien
Post by Bernd Reinhold
Hi!
binomial1 = new TF1("binomial1", "[1]*(Factorial(10))/(Factorial(x))/(Factorial(10-x))*power([0],x)*
power(1-[0],10-x)"
I get the following error message, when typing the function above in CINT
Bad numerical expression : "Factorial(10)"
Error in <TF1::TF1>: function: binomial1/[1]*(Factorial(10))/(Factorial(x))/(Factorial(10-x))*
power([0],x)*power(1-[0],10-x) has 0 parameters instead of 1
And can I put some constraints on x by defining it as 'Int_t x;' before I define the function? Does TF1 recognize the x in its formula as the x defined before as Int_t?
Thank you, Bernd.
---------------------------------------------------------------------
| Sebastien GREDER tel : +33 (0)3 88 10 63 54 |
| D0 Strasbourg, |
| Institut de Recherches Subatomiques fax : +33 (0)3 88 10 62 34 |
| 23, rue du loess - BP 28 secr : +33 (0)3 88 10 66 40 |
| F-67037- STRASBOURG cedex 2 e-mail : ***@in2p3.fr, |
| ***@fnal.gov |
---------------------------------------------------------------------
Bernd Reinhold
2004-07-13 13:04:35 UTC
Permalink
Thanks! It worked.

-----Original Message-----
From: Sebastien Greder [mailto:***@in2p3.fr]
Sent: Tue 7/13/2004 2:12 PM
To: Bernd Reinhold
Cc: ***@pcroot.cern.ch
Subject: Re: [ROOT] Factorial(10) gives bad-numerical-expression-error

Hello Bernd,

replace Factorial by TMath::Factorial and power by Tmath::Power
and it should work.

cheers,

sebastien
Post by Bernd Reinhold
Hi!
binomial1 = new TF1("binomial1", "[1]*(Factorial(10))/(Factorial(x))/(Factorial(10-x))*power([0],x)*
power(1-[0],10-x)"
I get the following error message, when typing the function above in CINT
Bad numerical expression : "Factorial(10)"
Error in <TF1::TF1>: function: binomial1/[1]*(Factorial(10))/(Factorial(x))/(Factorial(10-x))*
power([0],x)*power(1-[0],10-x) has 0 parameters instead of 1
And can I put some constraints on x by defining it as 'Int_t x;' before I define the function? Does TF1 recognize the x in its formula as the x defined before as Int_t?
Thank you, Bernd.
---------------------------------------------------------------------
| Sebastien GREDER tel : +33 (0)3 88 10 63 54 |
| D0 Strasbourg, |
| Institut de Recherches Subatomiques fax : +33 (0)3 88 10 62 34 |
| 23, rue du loess - BP 28 secr : +33 (0)3 88 10 66 40 |
| F-67037- STRASBOURG cedex 2 e-mail : ***@in2p3.fr, |
| ***@fnal.gov |
---------------------------------------------------------------------
Loading...