TF1 with "sqrt" and "erf" will not draw (Python)

Hello all,

I’ve been familiarizing myself with the TF1 class and have been trying to create a function with a “sqrt” and “erf” that both have a set parameter. My problem is when I go to draw the function with TCanvas() nothing appears. This only occurs with “sqrt” and “erf” as I successfully drew a function with “exp” but had to denote the “sqrt” as “x**0.5”. I don’t know if this is a Python thing but any help would be appreciated.

ROOT Version: 6.24.06
Platform: Windows 11
Compiler: JupyterHub


Can you copy/paste your script or attach the file instead of giving a screen dump?

For sure. Sorry about that still a little green to this all.

TF1 Familiarization.ipynb (35.9 KB)

That’s a binary file … can you post your code as a script ? simple ascci file we can run ?

TF1 Familiarization.txt (1.2 KB)

void RNugent() {
   auto C = new TCanvas();
   C->Divide(2,2);

   C->cd(1);
   auto testFunction = new TF1("tf","[0]*x*exp([1]*x)",-10,10);
   testFunction->SetParameter(0,0.1);
   testFunction->SetParameter(1,0.7);
   testFunction->SetLineColor(4);
   testFunction->Draw();

   C->cd(2);
   auto smallPhi = new TF1("phi","(1/(2)**0.5)*exp(-([0]*x)**2/2)",-10,10);
   smallPhi->SetParameter(0,2);
   smallPhi->SetParameter(1,0.7);
   smallPhi->SetLineColor(4);
   smallPhi->Draw();

   C->cd(3);
   auto errorFunction = new TF1("errF", "(1/sqrt([0]))*x*erf([0])", -10,10);
   errorFunction->SetParameter(0,3);
   errorFunction->SetLineColor(4);
   errorFunction->Draw();
}