Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You want to use contour_plot. You can get help by entering contour_plot?.

Here is a sample:

var('x y')
p3= plot_vector_field( ((x+4)/sqrt((x+4)^2+y^2)+(x-6)/sqrt((x-6)^2+y^2), y/sqrt((x+4)^2+y^2)), (x, -10, 10), (y, -10, 10))
p3+=contour_plot( (x+4)/sqrt((x+4)^2+y^2)+(x-6)/sqrt((x-6)^2+y^2), (x, -10, 10), (y, -10, 10),fill=false,labels=true,linewidths=3,cmap='Blues')
p3+=contour_plot( y/sqrt((x+4)^2+y^2), (x, -10, 10), (y, -10, 10),fill=false,labels=true,linewidths=3,cmap='Reds')
show(p3)

image description

You can also control which contours you want using the contours option.

var('x y')
p3= plot_vector_field( ((x+4)/sqrt((x+4)^2+y^2)+(x-6)/sqrt((x-6)^2+y^2), y/sqrt((x+4)^2+y^2)), (x, -10, 10), (y, -10, 10))
p3+=contour_plot( (x+4)/sqrt((x+4)^2+y^2)+(x-6)/sqrt((x-6)^2+y^2), (x, -10, 10), (y, -10, 10),fill=false,labels=true,linewidths=3,cmap='Blues',contours=[-.5,0,.5])
p3+=contour_plot( y/sqrt((x+4)^2+y^2), (x, -10, 10), (y, -10, 10),fill=false,labels=true,linewidths=3,cmap='Reds',contours=[-.5,0,.5])
show(p3)

image description