4

I am looking for a Python package that will allow me to plot something similar to the Java applet seen below:

http://math.mit.edu/mathlets/mathlets/isoclines/

Does anyone know any ODE plotting packages for this? I can code something from scratch using Numpy, Matplotlib, but I wanted to ask around first.

Thanks,

2

2 Answers 2

3

I wrote something like this, it seems to work for y'=y^2-x

from pylab import *
xmax = 4.0
xmin = -xmax
D = 20
ymax = 4.0
ymin = -ymax
x = linspace(xmin, xmax, D)
y = linspace(ymin, ymax, D)
X, Y = meshgrid(x, y)
deg = arctan(Y**2 - X)
QP = quiver(X,Y,cos(deg),sin(deg))
show()

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

1

Sage will do this:

x,y = var("x y")
eq = y^3-3*y-x
p = implicit_plot(eq==0,(x,-4,4),(y,-4,4))
p += plot_slope_field(eq, (x,-4,4),(y,-4,4), headlength=1e-8)
p.show(aspect_ratio=1)

although it's simply wrapping matplotlib functionality for the graphics. (To be perfectly honest, the matplotlib wrapping isn't as good as it could be yet, which often causes me headaches.)

example

4 Comments

i looked at sage, the source code is huge, does it support python out of the box? is the code above python code?
Yeah, it's pretty big: it's a collection of math tools and libraries wrapped in Python. But if everything you're doing is numerical, and you don't need symbolics, then it's probably easiest just to use matplotlib directly (as, after all, that's what Sage is doing behind the scenes.)
You can use sage on the web, without installing it, if you prefer: sagenb.org
thx for the info, but I got into this so I would have local code instead of "mathlets" that are applets.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.