Plot3D calls function with non-numerical arguments

The plot of func works fine. The plot of func1 fails. The output of func1 shows that it has been called with nun-numerical values x and y, which func1 can’t handle.

The documentation of Plot3D says “Plot3D has attribute HoldAll and evaluates f only after assigning specific numerical values to x and y.”

func1 is a much-simplified version of what I am really working with, which I can’t turn into a nice expression like x^2+y^2 <=1.

simplePlot3DExample.nb (75.7 KB)

Try

Clear[func1];
func1[x_?NumericQ,y_?NumericQ]:=...

Thank you very much. That does it.

The Clear is necessary; I think: if one doesn’t do the Clear, then Mathematica has TWO func1’s defined, with different argument definitions. Then Plot3D chooses the first (wrong) one, which results in the error. Is this correct?

I still wish that the Mathematica documentation actually matched the actual behavior … but then I have always been a a dreamer …

Rather than If and Return try using Piecewise to define the function.