Possible bug in plotting 2-D functions

The following two function are identical except with different ranges:

 f1 = new TF2("f1", "exp(-((x*cos(0.0)+y*sin(0.0))**2+0.25**2*(-x*sin(0.0)+y*cos(0.0))**2)/(2*45.0**2))*cos(6.28*(x*cos(0.0)+y*sin(0.0))/30.0 + 0)", -200, 200, -200, 200)
 f2 = new TF2("f2", "exp(-((x*cos(0.0)+y*sin(0.0))**2+0.25**2*(-x*sin(0.0)+y*cos(0.0))**2)/(2*45.0**2))*cos(6.28*(x*cos(0.0)+y*sin(0.0))/30.0 + 0)", -50, 50, -50, 50)
 f1->Draw("colz")
 f2->Draw("colz")

The maximum of this function should be at x = 0 & y = 0. function f2 correctly plotted the maximum, while the value of function f1 at x=y=0 is truncated.

_ROOT Version:_6.32.02
Platform: ubuntu24.04
Compiler: gcc13.3.0


Hi,

We saw your open issue here Possible bug in plotting 2-D functions · Issue #17550 · root-project/root · GitHub and assigned to the relevant expert.
Thanks for the report.

Best,
Danilo

f1->SetNpx(2000)

should do the trick.

Thanks @ferhue and @Danilo. It would be great for ROOT to include a dynamical Npx default value to avoid this from happening. That would save user lots of time.