Dear experts,
I am trying to set contour on TF3 and then plot the contour. I do not manage to plot the contour so I am not sure if I have a problem with plotting or contour setting. Can you please point me to the problem in my code? My TF3 is 3D quadratic function, and I want to plot contour of particular value (10.7479). My root is 5.22.00d.
Thank you in advance.

Senka

...
Double_t QuadFcn3(Double_t *in, Double_t *p) { // 3D quadratic function
Double_t x = in[0];
Double_t y = in[1];
Double_t z = in[2];
Double_t results =
p[0] +
p[1]*x + p[2]*y + p[3]*z +
p[4]*x*y + p[5]*x*z + p[6]*y*z + p[7]*x*x + p[8]*y*y + p[9]*z*z;
return results;
}
...
test =new TCanvas("test","contours",600,600);
TF3 *newFcn = new TF3("newFcn",QuadFcn3,-0.15,0.15,-4.5,4.5,-0.15,0.15,10);
for (int i=0;i<10;++i)
newFcn->SetParameter(i,par[i]);
/*
my parameters:
Par 0 p0 = 6.8379
Par 1 p1 = -11.7863
Par 2 p2 = 0.296544
Par 3 p3 = 2.215
Par 4 p4 = -10.1455
Par 5 p5 = 69.4026
Par 6 p6 = -6.51502
Par 7 p7 = 290.709
Par 8 p8 = 0.50965
Par 9 p9 = 428.856
*/
Double_t acpar[1];
acpar[0]=10.7479;
TPad *box2Pad = new TPad("box2", "box2", 0.02, 0.02, 0.98, 0.82);
box2Pad->Draw();
box2Pad->cd();
newFcn->SetContour(1,acpar);
newFcn->Draw("glsame");

You are using an old ROOT version. I am not sure the gl option was available at that time.
Any way can you send a running example ? the code sample you sent cannot not be run “as it is” .
It would help to have something I can run immediately.
Thanks.

i think you have a problem with your function.
I have simplified your macro and still I get an empty plot.
May be the limits you specified are not correct ?
I added a working example to this post. I hope it will help. forRootTalk.C (1.37 KB) fun3func.C (524 Bytes)

Hi,
thank you for looking into my macro and sending me the example of TF3 that works.
I think I understand what is the problem with my function. Root is plotting the surface where the value of the function is equal to the value of the function in the origin point, (0,0,0). In my case the function has minimum in the origin and the value is rising as I move away from it. So I guess I have to use some other draw option to visualize my function. Any ideas?
Also I tried to plot the contour (surface where the function value is = 1000) adding the lines bellow to your fun3func.C before fun3->Draw("");. But this does not work. As the result I get the same plot as if I do not set the contour. Any suggestions? Is there some other way to plot 3D contour from 3D function?

[quote=“couet”][quote]
Root is plotting the surface where the value of the function is equal to the value of the function in the origin point, (0,0,0)
[/quote]
It it works that way.[/quote]

I don’t think so. I tried several TF3, and I found it plotted the surface with f(x,y,z)=0, not f(0,0,0).