Issue with TF1::GetX

ROOT Version: 6.28/10
Platform: Ubuntu22.04
Compiler: c++ 11.4.0

Dear Experts,
I use TF1::GetX to inverse a function but have an issue when trying to plot the obtained function in Logx. It is shown in the attached simple example code. Could you please explain, how to solve this
TF1GetX_issue.C (881 Bytes)
issue?

Hi,

Thanks for reporting. Did something get lost while posting perhaps?

D

Re-sending my post

ROOT Version: 6.28/10
Platform: Ubuntu22.04
Compiler: c++ 11.4.0

Dear Experts,
I use TF1::GetX to inverse a function but have an issue when trying to plot the obtained function in Logx. It is shown in the attached simple example code. Could you please explain, how to solve this issue
TF1GetX_issue.C (881 Bytes)

Yes it is weird because your funtion starts a2 . The error is in ROOT::Math::BrentRootFinder::Solve. May be @moneta has some idea about it.

A simpler reproducer:

TF1 *fy = new TF1("x", "x",0,1);
new TCanvas();
gPad->SetLogx();
fy->GetX(0.5)
Error in <ROOT::Math::BrentRootFinder::Solve>: xmin is <=0 and log scan is set - disable it
(double) 0.50000000

the logscan is enabled from gPad, independently of whether fy is drawn or not.

logx = gPad->GetLogx();

see add an option to GetX, GetMinimumX/GetMaximumX to perform a search in… · root-project/root@2568d0e · GitHub by @moneta

An easy workaround is to use instead:

double x=fy->GetX(y[0],1e-12,1);

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.