Ask Your Question

Contour plots

I plotted the vector field like this

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))


I would like to do a contour plot where contour joind points at the same value. How do I do that?

edit retag close merge delete

Comments

1

Your vector field (seen as a function R^2 -> R^2) looks like an injective function. What do you mean by "same value" ? same norm ? same direction ?

( 2013-04-23 05:46:37 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

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)


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)


more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Stats

Asked: 2013-04-23 05:01:27 +0200

Seen: 213 times

Last updated: Apr 23 '13