Put this in a notebook cell (be careful about newlines):

Integer = int

RealNumber = float

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]]

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]]

T=ode_solver()

T.algorithm="bsimp"

T.function=lorenz

T.jacobian=lorenz_jac

T.ode_solve(y_0=[.5,.5,.5],t_span=[0,155],params=[10,40.5,3],num_points=10000)

l=[T.solution[i][1] for i in range(len(T.solution))]

line3d(l,thickness=0.3, viewer='tachyon', figsize=8)

and this is what you get (click to zoom):

I don't know whether it's just my browser, but the right edge of the recipes is cut off, so that I couldn't reproduce your code.

ReplyDeleteThe right hand side is cut off for me as well. (using FF 3.5) Works with Safari 4.0

ReplyDelete