TF1::GetX with linear functions

Hi,

I have a rather complicated function to invert numerically, which is nevertheless in certain situations close to being a first-order polynomial y=ax+b.
Although this seems to me to be the easiest case to invert, I find that I need to increase Npx to >1000 in order for TF1::GetX to give me the correct linear inverse function, without “steps” appearing in it.
I have tested GetX (ROOT v5.02 - I noticed the change from v4, but the old version does the same thing) using a TF1 that really is just “ax+b” and found exactly the same behaviour.

Is this normal ?
John

John

Could you send the shortest possible RUNNING script reproducing the problem?

Rene

Hi Rene

Here are two bits of code to demonstrate it:

.L TestGetX_droite.C+
.L TestGetX.C+
TestGetX()
TestGetX(50)
TestGetX(4)
etc. etc.

With root_v5.02.00.Linux.slc3.gcc3.2.3 the first TestGetX() with the default value Npx=100 gives a discontinuity at (500,50). As Npx decreases, the discontinuities grow larger, further from the origin, until with the minimum Npx=4 there are several of them.

Cheers
John
TestGetX.C (746 Bytes)
TestGetX_droite.C (76 Bytes)

John,

I cannot reproduce the problem that you describe.
Did you send the right files?
Could you post a canvas.gif file and the corresponding canvas.root files?

REne

Hi René

Definitely the right files, I just downloaded them and followed my own instructions: here are the results… (c1.gif and c1.root)

John

PS. just to be clear, I’m not using a CVS version of ROOT, I have the precompiled binary of 5.02 for Scientific Linux with gcc 3.2.3
c1.root (24.3 KB)


John,

As I already said, I cannot reproduce this problem.
I can see in c1.root the problem, but I cannot understand how
the problem is produced in your original program.
Did you make changes to TF1, ??
Did you compile with a special optimisation option?

Rene

Hi Rene

The example is compiled with ACliC (".L TestGetX.C+" etc.), so no special optimisation as far as I know. And as you can see in the code, I use a TF1 with no modifications. It seems strange that you cannot reproduce this problem, I have tried it on several different machines with the same results.

John

Hi John,

Could you try with the code currently in CVS?

Thanks,
Philippe.

hi Phil

That works fine, even for npx=4. What happened (I hope you didn’t just put in a special “is it a linear function ?” patch :laughing:

john