Ask Your Question

Revision history [back]

First, you can define your function as follows:

sage: f = lambda x,y : 0.2*x + 0.8*y if x < y else 0.6*x + 0.4

Then, your question is not clear to me. If you want a 3D plot of the function, you can do:

sage: plot3d(f, [-10,10], [-10,10])

But if you want the isolines, then it is a 2D object not a 3D one, which you can get by:

sage: contour_plot(f, [-10,10], [-10,10])

You can get some fancy style output options by typing

sage: contour_plot?

First, you can define your function as follows:

sage: f = lambda x,y : 0.2*x + 0.8*y if x < y else 0.6*x + 0.4

Then, your question is not clear to me. If you want a 3D plot of the function, you can do:

sage: plot3d(f, [-10,10], [-10,10])

But if you want the isolines, then it is a 2D object not a 3D one, which you can get by:

sage: contour_plot(f, [-10,10], [-10,10])

You can get some fancy style output options by typing

sage: contour_plot?

If you want to immerse the contour plot in 3D along the graph of the function (as suggested in your comment), you can try something like:

sage: sum([implicit_plot3d(lambda x,y,z : f(x,y), [-10,10], [-10,10], [c,c+0.01], contour=c) for c in range(-10,10)])