Hi everyone!
I have a probelm with the first step of my project,
I want to plot a polynomial on root. So first, I created a class called Polynom with the methods: Construtors,evaluatePoly,firstDerivative,secondDerivative…
then I created an object: Polynom *p1=Polynom(3,2,5,-1);
then in the next instruction I put as a test code to see if the object is created:
string poly=p1->printPoly();
cout<<poly;
and it works good( it prints the polynomial expression on the screen.)
But the problem now is when I try to plot the polynomial,
I tried to use :
TF1 *fa1 = new TF1(“fa1”,XXXXXX,-3,3);
fa1->Draw();
but I don’t know what to write on the XXX field! ( I’ve already seen the documentation for this class, but it doesn’t help me)
Your polynomial class needs to have at least one method which has the following signature:
x is an array of doubles which contain all of the regular arguments to the function. If you have a 1-dimensional function, x will be an array with only one element.
Pars is an array that contains the variable parameters of the function (like coefficients of your polynomial, for example), but if they are static and you don’t use that argument, you still need it in the signature. If the unused parameter warnings annoy you, leave that argument unnamed.
Then, you can create a TF1 with the following call (here I assume it is 1 dimensional).