# How to use TF1 with variables?

Hello

I’m having trouble learning how to use the TF1 function properly, due to my unfamiliarity with coding. I want to add some modifiers to a Poisson function.
So a standard function would be

``````void fplot()
{
TF1 *Poisson0 = new TF1("Poisson0","TMath::Poisson(0,x)",0,10);
Poisson0 -> Draw();
}
``````

But I need to modify the Poisson curve by giving it a amplitude multiplier which would be Var0 in this case. And to explode the x-axis by another variable “Var1”
So I tried doing this

``````void fplot()
{
double Var0 = 5000;
double Var1 = 1e12;
TF1 *Poisson0 = new TF1("Poisson0","Var0*TMath::Poisson(0,x/Var1)",0,Var1*10);
Poisson0 -> Draw();
}
``````

But an error where Var0 and Var1 is considered unknown is spat out. If anyone can educate me on how to solve this, your help would be greatly appreciated.

Thanks
Soren

___ROOT Version: 6.24
_Platform: Windows
Compiler: Not Provided

One possibility:

``````{
TF1 *Poisson0 = new TF1("Poisson0", "[Var0]*TMath::Poisson(0.,x/[Var1])", 0., 10.);
// Poisson0->Print();
double Var0 = 5000., Var1 = 1.e12;
Poisson0->SetParameters(Var0, Var1); Poisson0->SetRange(0., Var1 * 10.);
Poisson0->Draw();
}
``````

Whoa that worked, thanks!!
Just wondering what does the period after the parameters mean?
like 0., 10., etc etc.

It means these numbers are floating point numbers. Without a period it would mean they are integers.