I have a very simple problem, I have problems using the factorial. I have included both these libraries:
#include <math.h>
#include “TMath.h”
and I write Factorial(n) but root gives me this error:
error: use of undeclared identifier ‘Factorial’
I have a very simple problem, I have problems using the factorial. I have included both these libraries:
#include <math.h>
#include “TMath.h”
and I write Factorial(n) but root gives me this error:
error: use of undeclared identifier ‘Factorial’
root [1] TMath::Factorial(3)
(double) 6.0000000
root [2]
Thank you. If I write that instrunction it worked. But I have to put the Factorial in a program and root gives me me this error:
invalid operands to binary expression ('double' and 'double')
ris = TMath::Factorial(a) / (TMath::Factorial(j) + TMath::Factorial(a - j))*(prob)^j*(1 - prob)^(a - j) + ris;
``
Search for “^” in: Wikipedia -> Operators in C and C++
a^b
is not valid operation, you can use TMath::Power(a,b)
instead
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.