Ask Your Question
1

Contour plots

asked 2013-04-23 05:01:27 +0100

nerak99 gravatar image

updated 2013-04-23 05:11:11 +0100

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 flag offensive 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 ?

vdelecroix gravatar imagevdelecroix ( 2013-04-23 05:46:37 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-04-23 12:36:06 +0100

calc314 gravatar image

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

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

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

Seen: 410 times

Last updated: Apr 23 '13