Question

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,

Was it helpful?

Solution 2

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

OTHER TIPS

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

These answers do not have the option to change the parameters using the drag tool. If you want this option then these two example dynamical systems show you how. They are written in Python Sage. Just think of it as Python with lots of pre-made functions for mathematics.


Sage Example 1--phase plot.
Sage Example 2--trajectory plot.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top