开发者

Plotting ODEs, Isoclines using Python

开发者 https://www.devze.com 2023-03-13 15:05 出处:网络
I am looking for a Python package that will allow me to plot something similar to the Java applet seen below:

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 plot开发者_高级运维ting packages for this? I can code something from scratch using Numpy, Matplotlib, but I wanted to ask around first.

Thanks,


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

Plotting ODEs, Isoclines using Python


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

Plotting ODEs, Isoclines using Python

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号