Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I'm not quite sure what you're looking for. If you want to plot the level sets, you have several options,which I've blatantly stolen from the level set examples worksheet by evanmb:

import matplotlib

var("x, y")
f = x+y+2

# manually using implicit plot for particular h values:
p = Graphics()
for h in [-5..5]:
    p += implicit_plot(f==h,(x,-4,4),(y,-4,4))

p.show()

# using a full contour plot
contour_plot(f,(x,-4,4),(y,-4,4), fill=false, labels=true, contours=10, colorbar=true,cmap=matplotlib.cm.gist_rainbow).show(aspect_ratio=1) 

# maybe filled
contour_plot(f,(x,-4,4),(y,-4,4), fill=True, labels=true, contours=10, label_colours='black',colorbar=true,cmap=matplotlib.cm.gist_rainbow).show(aspect_ratio=1) 

# or 3d
plot3d(f,(x,-4,4),(y,-4,4)) 

Or is there something more analytic that you're trying to do first?

I'm not quite sure what you're looking for. If you want to plot the level sets, you have several options,which I've blatantly stolen from the level set examples worksheet by evanmb:

import matplotlib

var("x, y")
f = x+y+2

# manually using implicit plot for particular h values:
p = Graphics()
for h in [-5..5]:
    p += implicit_plot(f==h,(x,-4,4),(y,-4,4))

p.show()

# using a full contour plot
contour_plot(f,(x,-4,4),(y,-4,4), fill=false, labels=true, contours=10, colorbar=true,cmap=matplotlib.cm.gist_rainbow).show(aspect_ratio=1) 

# maybe filled
contour_plot(f,(x,-4,4),(y,-4,4), fill=True, labels=true, contours=10, label_colours='black',colorbar=true,cmap=matplotlib.cm.gist_rainbow).show(aspect_ratio=1) 

# or 3d
plot3d(f,(x,-4,4),(y,-4,4)) 

Or is there something more analytic that you're trying to do first?first? Depending on how complex your real functions will be, finding a parametric solution might be a challenge.

I'm not quite sure what you're looking for. If you want to plot the level sets, you have several options,which I've blatantly stolen from the level set examples worksheet by evanmb:

import matplotlib

var("x, y")
f = x+y+2

# manually using implicit plot for particular h values:
p = Graphics()
for h in [-5..5]:
    p += implicit_plot(f==h,(x,-4,4),(y,-4,4))

p.show()

# using a full contour plot
contour_plot(f,(x,-4,4),(y,-4,4), fill=false, labels=true, contours=10, colorbar=true,cmap=matplotlib.cm.gist_rainbow).show(aspect_ratio=1) 

# maybe filled
contour_plot(f,(x,-4,4),(y,-4,4), fill=True, labels=true, contours=10, label_colours='black',colorbar=true,cmap=matplotlib.cm.gist_rainbow).show(aspect_ratio=1) 

# or 3d
plot3d(f,(x,-4,4),(y,-4,4)) 

Or is there something more analytic that you're trying to do first? Depending on how complex complicated your real functions will be, finding a parametric solution might be a challenge.

I'm not quite sure what you're looking for. If you want to plot the level sets, you have several options,which I've blatantly stolen from the level set examples worksheet by evanmb:

import matplotlib

var("x, y")
f = x+y+2

# manually using implicit plot for particular h values:
p = Graphics()
for h in [-5..5]:
    p += implicit_plot(f==h,(x,-4,4),(y,-4,4))

p.show()

# using a full contour plot
contour_plot(f,(x,-4,4),(y,-4,4), fill=false, labels=true, contours=10, colorbar=true,cmap=matplotlib.cm.gist_rainbow).show(aspect_ratio=1) 

# maybe filled
contour_plot(f,(x,-4,4),(y,-4,4), fill=True, labels=true, contours=10, label_colours='black',colorbar=true,cmap=matplotlib.cm.gist_rainbow).show(aspect_ratio=1) label_colors='black',colorbar=true,cmap=matplotlib.cm.gist_rainbow).show(aspect_ratio=1) 

# or 3d
plot3d(f,(x,-4,4),(y,-4,4)) 

Or is there something more analytic that you're trying to do first? Depending on how complicated your real functions will be, finding a parametric solution might be a challenge.