How to set TF3's step?

I defined a function and wanted to draw a picture:

TF3 *f = new TF3(“test”,“sqrt(x2+y2)-z”,-1,1,-1,1,0,1)
f->Draw()

and then I found the picture is too rough, it seems that the step is 0.1 and there are many peaks, the curve is not smooth at all. what should I do?

{ TF3 *f = new TF3("test","sqrt(x**2+y**2)-z",-1,1,-1,1,0,1); f->SetNpx(50); f->SetNpy(50); f->SetNpz(50); f->Draw(); }

Rene

Thanks so much! But I got another question:
I don’t know how to link a picture here, so I have to add an attachment, it’s a picture, and I tried to draw a picture like this. here is my code:

test()
{
TF3 * f1 = new TF3(“test1”,“x2+y2+sqrt(([0]2+[1]2)*(x2+y2)+4*[0][1]xy)-z",-5,5,-5,5,-2,10);
TF3 * f2 = new TF3(“test2”,"x2+y2-sqrt(([0]**2+[1]**2)
(x2+y2)+4*[0]*[1]xy)-z”,-5,5,-5,5,-2,10);
f1->SetNpx(50);
f1->SetNpy(50);
f1->SetNpz(50);
f2->SetNpx(50);
f2->SetNpy(50);
f2->SetNpz(50);

f1->SetParameter(0, 2);
f1->SetParameter(1, 0);
f2->SetParameter(0, 2);
f2->SetParameter(1, 0);
f1->Draw("");
f2->Draw(“same”);
}

I’ve tried to Draw with options: lego, lego1, surf, etc… but none of them make the effort. Can you give me some suggestion?

please, can anybody help me?

Olivier will answer your mail as soon as he will be back in a few days

Rene

Thank you!

I think the following macro gives a result close to what you want.

Double_t fcn(Double_t *xi, Double_t *par)
{
   Double_t x = xi[0];
   Double_t y = xi[1];
   Double_t z = xi[2];
   Double_t f1 = x**2+y**2+sqrt((par[0]**2+par[1]**2)*(x**2+y**2)+4*par[0]*par[1]*x*y)-z;
   Double_t f2 = x**2+y**2-sqrt((par[2]**2+par[3]**2)*(x**2+y**2)+4*par[2]*par[3]*x*y)-z;
   return f1*f2;
}
                                                                                                          
void fun3func()
{
   TF3 *fun3 = new TF3("fun3", fcn,-6,6,-6,6,-6,6,4);
   fun3->SetParameter(0, 2);
   fun3->SetParameter(1, 0);
   fun3->SetParameter(2, 2);
   fun3->SetParameter(3, 0);
                                                                                                          
   fun3->Draw();
}