I am trying to plot f(x,z)
which is undefined in some areas. When I try to plot some other function, I can get it to work easily because Sage restricts the plot to the area where the function is real. E.g.:
plot3d(sqrt(1-x^2-y^2), (x,-5,5), (y,-5,5))
The border is a bit weird, but it works. I cannot get a working plot with my code, however. I also tried to wrap the function with a try ... except
statement but I don't know what to return:
var("x y z")
def wrap(exp, a, b):
try:
return exp(x=a, z=b)
except ValueError:
return None
plot3d(lambda x,y: wrap(f, x, y), (x, -t, t), (y, -t, t)).show(aspect_ratio=1)
My function is f
and it contains variables x
and z
.