I was preparing a talk on solving ODE's in sage, and the culminating
example is pretty neat so I thought I would post it.

The following code will plot a little bit of the lorenz attractor

sage: def lorenz(t,y,params):
...      return [params[0]*(y[1]-y[0]),y[0]*(params[1]-y[2])-
y[1],y[0]*y[1]-params[2]*y[2]]

sage: def lorenz_jac(t,y,params):
...      return [ [-params[0],params[0],0],[(params[1]-y[2]),-1,-y[0]],
[y[1],y[0],-params[2]],[0,0,0]]
sage: T=ode_solver()
sage: T.algorithm="bsimp"
sage: T.function=lorenz
sage: T.jacobian=lorenz_jac
sage: T.ode_solve(y_0=[.
5,.5,.5],t_span=[0,155],params=[10,40.5,3],num_points=4000)
sage: l=[T.solution[i][1] for i in range(len(T.solution))]
sage: line3d(l,thickness=2)

This is somewhat computationally intensive (takes around a minute).

I thought the plot was quite neat.
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to