On Jan 30, 2008 3:29 AM, Joshua Kantor <[EMAIL PROTECTED]> wrote:
>
> If you do
> sage: RealNumber=float
> sage: Integer=int
>
> before defining the functions, the ode solver runs dramatically
> faster.
> This is because the function calls get much cheaper as nothing is
> accidentally
> in RR or ZZ.

Quick comment: this is _precisely_ the sort of issue that Robert
Bradshaw's very nice new code
    http://trac.sagemath.org/sage_trac/ticket/1938
nicely solves -- and the speed is often even better than pure Python
(lambda) functions.  It's amusing, because then you make a seemingly
sloat symbolic expression, and it will (often?) beat what you do above...

>
> On Jan 29, 11:55 pm, "Fabio Tonti" <[EMAIL PROTECTED]> wrote:
> > Would be nice if someone posted the Lorenz attractor code on
> > planet.sagemath.org!
> >
> > For those who don't subscribe to this list...
> >
> > Fabio
> >
>
> > On Jan 29, 2008 8:32 PM, mhampton <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > We really need to get xpp and/or AUTO into sage at some point.  I have
> > > made some half-hearted stabs at it but have lacked the time to get
> > > serious.  Like R support, its a chicken-and-egg problem: without real
> > > users within the sage community, it doesn't get put in, and until its
> > > in right there aren't any real users.  I am very happy that R has been
> > > included, the interface can now be polished.   We need to kick start
> > > the dynamical systems components.
> >
> > > cheers,
> > > Marshall
> >
> > > On Jan 29, 6:17 am, "David Joyner" <[EMAIL PROTECTED]> wrote:
> > > > That's cool. Good luck on your talk.
> >
> > > > BTW, have you tried this?http://www.math.pitt.edu/~bard/xpp/xpp.html
> > > > I could not get it to compile from source but fortunately
> > > > is a debian package (apt-get install xppaut). The docs say it
> >
> > > > "is a tool for solving
> >
> > > >     * differential equations,
> > > >     * difference equations,
> > > >     * delay equations,
> > > >     * functional equations,
> > > >     * boundary value problems, and
> > > >     * stochastic equations."
> >
> > > > So I thought you might be interested. The screenshot
> > > > section even has an animated
> > > gifhttp://www.math.pitt.edu/~bard/xpp/ss/screen.html
> > > > Lorentz plot.
> >
> > > > On Jan 29, 2008 4:38 AM, Joshua Kantor <[EMAIL PROTECTED]> wrote:
> >
> > > > > 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.
> >
>



-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

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