16.12.2012 Views

Computer Algebra Recipes

Computer Algebra Recipes

Computer Algebra Recipes

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

352 CHAPTER 8. NONLINEAR DIAGNOSTIC TOOLS<br />

¢:= 1<br />

40<br />

The system of ODEs is solved numerically, the solution being given as a list<br />

procedure, so that we can create a time series.<br />

> sol:=dsolve(fsys,icg,fx(t),y(t),z(t)g,numeric,maxfun=0,<br />

output=listprocedure):<br />

The following line uses the numerical solution to evaluate x(t) atanarbitrary<br />

time, which must be speci¯ed.<br />

> S:=eval(x(t),sol):<br />

Then entering S(n*Delta) will yield x(t) att = n ¢. Using this result, the x<br />

values are obtained at times t = n ¢forn =0toN.<br />

> for n from 0 to N do X[n]:=S(n*Delta); end do:<br />

The time series is created and plotted, the default being to join the points with<br />

straight lines. The resulting picture is shown in Figure 8.20.<br />

> plot([seq([n*Delta,X[n]],n=0..N)],labels=["t","x"]);<br />

x<br />

15<br />

10<br />

5<br />

0<br />

–5<br />

–10<br />

–15<br />

10 20 30 40 50<br />

t<br />

Figure 8.20: x time series for the Lorenz system.<br />

To reconstruct the 3-dimensional Lorenz butter°y attractor, it is necessary to<br />

form triplets of numbers from the time series. By trial and error, we use the<br />

triplet combination involving n, n +3,andn + 6 to create the plotting points.<br />

> points:=[seq([X[n],X[n+3],X[n+6]],n=0..(N-6))]:<br />

Using the spacecurve command with shading=z to color the trajectory, the<br />

butter°y attractor is revealed.<br />

> spacecurve(points,style=line,shading=z,axes=framed,<br />

orientation=[-30,60],tickmarks=[3,3,3],<br />

labels=["X(n)","X(n+3)","X(n+6)"]);<br />

A black-and-white version is shown in Figure 8.21. If one compares the picture,<br />

which can be rotated on the computer screen, with the butter°y picture<br />

obtained in Chapter 2, the reconstruction of the butter°y is quite good.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!