rk and gpdraw



Whoops, forgot the attachment in the last message.

Here is is.

  ---------------------------------------------------------------------------
  | Sheldon E. Newhouse            |    e-mail: sen1 at math.msu.edu           |
  | Mathematics Department         |       				   |
  | Michigan State University      | telephone: 517-355-9684                |
  | E. Lansing, MI 48824-1027 USA  |       FAX: 517-432-1562                |
  ---------------------------------------------------------------------------

On Thu, 25 Jan 2007, sen1 at math.msu.edu wrote:

> Hello,
>
>   Since the recent "rk" thread went on a bit, I played with some of the tools
> available, and I thought I'd send a very simple example of how to plot
> the solutions of the Lorenz system of differential equations
> using "rk" and "gpdraw".
>
> Of course, this owes much thanks to Jaime and Mario.
>
> The enclosed file shows in a very meager sense the potential that
> already exists for the study of nonlinear 3-d differential equations.
>
> Just load the file "Lorenz.mac" and wait several seconds.  On my dual
> core linux system it takes around 5 seconds to produce the picture.
> Once the picture is there, drag the left mouse button around, and then
> move the middle mouse button left-right or up-down.
>    My students will like this!
>
> Now, for some "wish list" items.
>
> 1. The keyboard is available. So, how about doing the rotations, and
>     zooms with combinations:
>
>      "r" key + left mouse
>      "z" key + middle mouse
>   or some such combination.
>
>
> That leaves the left mouse key alone to allow selecting an initial
> point in 3-space as a new initial condition to do real time plots of different
> orbits.  This is like what works in the "plotdf" 2d routine.
>
>   One could also implement some sort of menu (or dialog box) like
>   Jaime's in graph2d and plotdf.  A special key could open a window
>   with commands, help, etc. I don't know what is preferable. One does
>   not want to make the program bloated.
>
> The list could go on and on.
>
> 2. What about the name "draw" instead of "gpdraw"?  Of course, with
>     aliases, this is not necessary.
>
> -sen
>
> P.S. The file "Lorenz.mac" is, of course, sort of trivial, and one
> could do similar examples for most of the things in Maxima.  So, if people
> would prefer that such things not be sent to this development list, is there a more
> appropriate place?
>
>  ---------------------------------------------------------------------------
>  | Sheldon E. Newhouse            |    e-mail: sen1 at math.msu.edu           |
>  | Mathematics Department         |       				   |
>  | Michigan State University      | telephone: 517-355-9684                |
>  | E. Lansing, MI 48824-1027 USA  |       FAX: 517-432-1562                |
>  ---------------------------------------------------------------------------
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
-------------- next part --------------
/* This is the Lorenz system */

load("dynamics");
load("rk");
load("gpdraw");


print(" Consider the Lorenz system

eq: [s*(y-x), x*(r-z) -y, x*y - b*z];

s: 10.0;
r: 28.0;
b: 2.6667;

t_range: [t,0,100,.03];

init: [1.0,0,0];

We use the rk routine to compute the solution 'sol'

The actual points in 3-space are 'sol_pts'

To plot the solution curve we use gpdraw3d( points(sol_pts))$.

Here is the first plot. Be patient! ");

eq: [s*(y-x), x*(r-z) -y, x*y - b*z];

s: 10.0;
r: 28.0;
b: 2.6667;

t_range: [t,0,100,.03];

init: [1.0,0,0];

sol: rk(eq, [x,y,z],init,t_range)$

sol_pts: makelist( rest(sol[i]),i,1,length(sol))$

gpdraw3d( point_size=0,points_joined=true, points(sol_pts))$