Issue with Mathematica: Cosine is real for imaginary arguments, so Mathematica won’t warn when you’re going outside the real numbers! We can use Taylor series to understand why that is.

Clear[f,x,y]
f[x_,y_]:=Cos[Sqrt[1+x-y]]
xmin=-5
xmax=5
ymin=-5
ymax=5
Plot3D[f[x,y],{x,xmin,xmax},{y,ymin,ymax}]

Whoops!

Clear[f,x,y]
f[x_,y_]:=Cos[Re[Sqrt[1+x-y]]]
g[x_,y_]:=Sqrt[1+x-y]
f[-5,5]
g[-5,5]
Re[Cos[g[-5,5]]]
Im[Cos[g[-5,5]]]
xmin=-5
xmax=5
ymin=-5
ymax=5
Plot3D[f[x,y],{x,xmin,xmax},{y,ymin,ymax}]
Plot3D[g[x,y],{x,xmin,xmax},{y,ymin,ymax}]

#32

Clear[f,x,y]
f[x_,y_]:=(E^x+E^y)/(E^(x*y)-1)
xmin=-5
xmax=5
ymin=-5
ymax=5
Plot3D[f[x,y],{x,xmin,xmax},{y,ymin,ymax}]

Clear[f,x,y]
f[x_,y_]:=(x y)/(x^2+x*y+y^2)
xmin=-5
xmax=5
ymin=-5
ymax=5
Plot3D[f[x,y],{x,xmin,xmax},{y,ymin,ymax}]