File: maxima_49.html

package info (click to toggle)
maxima 5.10.0-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 44,268 kB
  • ctags: 17,987
  • sloc: lisp: 152,894; fortran: 14,667; perl: 14,204; tcl: 10,103; sh: 3,376; makefile: 2,202; ansic: 471; awk: 7
file content (504 lines) | stat: -rw-r--r-- 22,793 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- Created on September, 20 2006 by texi2html 1.76 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
            Karl Berry  <karl@freefriends.org>
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
            and many others.
Maintained by: Many creative people <dev@texi2html.cvshome.org>
Send bugs and suggestions to <users@texi2html.cvshome.org>

-->
<head>
<title>Maxima Manual: 49. dynamics</title>

<meta name="description" content="Maxima Manual: 49. dynamics">
<meta name="keywords" content="Maxima Manual: 49. dynamics">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.76">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.sansserif {font-family:sans-serif; font-weight:normal;}
ul.toc {list-style: none}
body
{
    color: black;
    background: white; 
    margin-left: 8%;
    margin-right: 13%;
}

h1
{
    margin-left: +8%;
    font-size: 150%;
    font-family: sans-serif
}

h2
{
    font-size: 125%;
    font-family: sans-serif
}

h3
{
    font-size: 100%;
    font-family: sans-serif
}

h2,h3,h4,h5,h6 { margin-left: +4%; }

div.textbox
{
    border: solid;
    border-width: thin;
    /* width: 100%; */
    padding-top: 1em;
    padding-bottom: 1em;
    padding-left: 2em;
    padding-right: 2em
}

div.titlebox
{
    border: none;
    padding-top: 1em;
    padding-bottom: 1em;
    padding-left: 2em;
    padding-right: 2em;
    background: rgb(200,255,255);
    font-family: sans-serif
}

div.synopsisbox
{
    border: none;
    padding-top: 1em;
    padding-bottom: 1em;
    padding-left: 2em;
    padding-right: 2em;
     background: rgb(255,220,255);
    /*background: rgb(200,255,255); */
    /* font-family: fixed */
}

pre.example
{
    border: none;
    padding-top: 1em;
    padding-bottom: 1em;
    padding-left: 1em;
    padding-right: 1em;
    background: rgb(247,242,180); /* kind of sandy */
    /* background: rgb(200,255,255); */ /* sky blue */
    font-family: "Lucida Console", monospace
}

div.spacerbox
{
    border: none;
    padding-top: 2em;
    padding-bottom: 2em
}

div.image
{
    margin: 0;
    padding: 1em;
    text-align: center;
}
-->
</style>

<link rel="icon" href="http://maxima.sourceforge.net/favicon.ico"/>
</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">

<a name="dynamics"></a>
<a name="SEC187"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="maxima_48.html#SEC186" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC188" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="maxima_48.html#SEC183" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_50.html#SEC190" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_72.html#SEC264" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h1 class="chapter"> 49. dynamics </h1>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#SEC188">49.1 Introduction to dynamics</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC189">49.2 Definitions for dynamics</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr size="6">
<a name="Introduction-to-dynamics"></a>
<a name="SEC188"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC187" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC189" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#SEC187" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC187" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_50.html#SEC190" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_72.html#SEC264" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section"> 49.1 Introduction to dynamics </h2>

<p>The additional package <code>dynamics</code> includes several
functions to create various graphical representations of discrete
dynamical systems and fractals, and an implementation of the Runge-Kutta
4th-order numerical method for solving systems of differential equations.
</p>
<p>To use the functions in this package you must first load it with
<code>load(&quot;dynamics&quot;)</code>.
</p>
<hr size="6">
<a name="Definitions-for-dynamics"></a>
<a name="SEC189"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC188" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="maxima_50.html#SEC190" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#SEC187" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC187" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_50.html#SEC190" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_72.html#SEC264" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section"> 49.2 Definitions for dynamics </h2>

<dl>
<dt><u>Function:</u> <b>chaosgame</b><i> (<code>[[</code><var>x1</var>, <var>y1</var><code>]</code>...<code>[</code><var>xm</var>, <var>ym</var><code>]]</code>, <code>[</code><var>x0</var>, <var>y0</var><code>]</code>, <var>b</var>, <var>n</var>, ...options...);</i>
<a name="IDX1703"></a>
</dt>
<dd><p>Implements the so-called chaos game: the initial point (<var>x0</var>,
<var>y0</var>) is plotted and then one of the <var>m</var> points
<code>[</code><var>x1</var>, <var>y1</var><code>]</code>...<code>[</code><var>xm</var>, <var>ym</var><code>]</code>
will be selected at random. The next point plotted will be in the
segment from the previous point to the point chosen randomly, at a
fraction <var>b</var> of the distance from the random point. The procedure is
repeated <var>n</var> times.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>evolution</b><i> (<var>F</var>, <var>y0</var>, <var>n</var>,...options...);</i>
<a name="IDX1704"></a>
</dt>
<dd><p>Draws <var>n+1</var> points in a two-dimensional graph, where the horizontal
coordinates of the points are the integers 0, 1, 2, ..., <var>n</var>, and
the vertical coordinates are the corresponding values <var>y(n)</var> of the
sequence defined by the recurrence relation
</p><table><tr><td>&nbsp;</td><td><pre class="example">        y(n+1) = F(y(n))
</pre></td></tr></table>
<p>With initial value <var>y(0)</var> equal to <var>y0</var>. <var>F</var> must be an
expression that depends only on the variable <var>y</var> (and not on <var>n</var>),
<var>y0</var> must be a real number and <var>n</var> must be a positive integer.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>evolution2d</b><i> (<code>[</code><var>F</var>, <var>G</var><code>]</code>, <code>[</code><var>x0</var>, <var>y0</var><code>]</code>, <var>n</var>, ...options...);</i>
<a name="IDX1705"></a>
</dt>
<dd><p>Shows, in a two-dimensional plot, the first <var>n+1</var> points in the
sequence of points defined by the two-dimensional discrete dynamical
system with recurrence relations
</p><table><tr><td>&nbsp;</td><td><pre class="example">        x(n+1) = F(x(n), y(n))    y(n+1) = G(x(n), y(n))
</pre></td></tr></table>
<p>With initial values <var>x0</var> and <var>y0</var>. <var>F</var> and <var>G</var> must be
two expressions that depend just on <var>x</var> and <var>y</var>. 
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>ifs</b><i> (<code>[</code><var>r1</var>,...,<var>rm</var><code>]</code>,<code>[</code><var>A1</var>,...,<var>Am</var><code>]</code>, <code>[[</code><var>x1</var>,<var>y1</var><code>]</code>...<code>[</code><var>xm</var>, <var>ym</var><code>]]</code>, <code>[</code><var>x0</var>,<var>y0</var><code>]</code>, <var>n</var>, ...options...);</i>
<a name="IDX1706"></a>
</dt>
<dd><p>Implements the Iterated Function System method. This method is similar
to the method described in the function <code>chaosgame</code>, but instead of
shrinking the segment from the current point to the randomly chosen
point, the 2 components of that segment will be multiplied by the 2 by 2
matrix <var>Ai</var> that corresponds to the point chosen randomly.
</p>
<p>The random choice of one of the <var>m</var> attractive points can be made with
a non-uniform probability distribution defined by the weights
<var>r1</var>,...,<var>rm</var>. Those weights are given in cumulative form; for instance if there are 3 points with probabilities 0.2, 0.5 and
0.3, the weights <var>r1</var>, <var>r2</var> and <var>r3</var> could be 2, 7 and 10.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>orbits</b><i> (<var>F</var>, <var>y0</var>, <var>n1</var>, <var>n2</var>, [<var>x</var>, <var>x0</var>, <var>xf</var>, <var>xstep</var>], ...options...);</i>
<a name="IDX1707"></a>
</dt>
<dd><p>Draws the orbits diagram for a family of one-dimensional
discrete dynamical systems, with one parameter <var>x</var>; that kind of
diagram is used to study the bifurcations of a one-dimensional discrete
system.
</p>
<p>The function <var>F(y)</var> defines a sequence with a starting value of
<var>y0</var>, as in the case of the function <code>evolution</code>, but in this
case that function will also depend on a parameter <var>x</var> that will
take values in the interval from <var>x0</var> to <var>xf</var> with increments of
<var>xstep</var>. Each value used for the parameter <var>x</var> is shown on the
horizontal axis. The vertical axis will show the <var>n2</var> values
of the sequence <var>y(n1+1)</var>,..., <var>y(n1+n2+1)</var> obtained after letting
the sequence evolve <var>n1</var> iterations.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>rk</b><i> (ODE, var, initial, domain)</i>
<a name="IDX1708"></a>
</dt>
<dt><u>Function:</u> <b>rk</b><i> ([ODE1,...,ODEm], [v1,...,vm], [init1,...,initm], domain)</i>
<a name="IDX1709"></a>
</dt>
<dd><p>The first form solves numerically one first-order ordinary differential
equation, and the second form solves a system of m of those equations,
using the 4th order Runge-Kutta method. var represents the dependent
variable. ODE must be an expression that depends only on the independent
and dependent variables and represents the derivative of the dependent
variable with respect to the independent variable.
</p>
<p>The independent variable is specified with <code>domain</code>, which must be a
list of four elements such as:
</p><table><tr><td>&nbsp;</td><td><pre class="example">[t, 0, 10, 0.1]
</pre></td></tr></table><p>the first element of the list identifies the independent variable, the
second and third elements are the initial and final values for that
variable, and the last element sets the increments that should be used
within that interval.
</p>
<p>If <var>m</var> equations are going to be solved, there should be <var>m</var>
dependent variables <var>v1</var>, <var>v2</var>, ..., <var>vm</var>. The initial values
for those variables will be <var>init1</var>, <var>init2</var>, ..., <var>initm</var>.
There will still be just one independent variable defined by <code>domain</code>,
as in the previous case. <var>ODE1</var>, ..., <var>ODEm</var>
are the expressions for the derivatives of each dependent variable in
terms of the independent variable. The only variables that may appear in
those expressions are the independent variable and any of the dependent
variables.
</p>
<p>The result will be a list of lists with <var>m</var>+1 elements. Those <var>m</var>+1
elements will be the value of the independent variable, followed by the
values of the dependent variables corresponding to that point in the interval
of integration. If at some point one of the variables becomes too large,
the list will stop there. Otherwise, the list will extend until the last
value of the independent variable specified by <code>domain</code>.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>staircase</b><i> (<var>F</var>, <var>y0</var>, <var>n</var>, ...options...);</i>
<a name="IDX1710"></a>
</dt>
<dd><p>Draws a staircase diagram for the sequence defined by the recurrence
relation
</p><table><tr><td>&nbsp;</td><td><pre class="example">        y(n+1) = F(y(n))
</pre></td></tr></table>
<p>The interpretation and allowed values of the input parameters is the
same as for the function <code>evolution</code>. A staircase diagram consists
of a plot of the function <var>F(y)</var>, together with the line
<var>G(y)</var> <code>=</code> <var>y</var>. A vertical segment is drawn from the
point (<var>y0</var>, <var>y0</var>) on that line until the point where it
intersects the function <var>F</var>. From that point a horizontal segment is
drawn until it reaches the point (<var>y1</var>, <var>y1</var>) on the line, and
the procedure is repeated <var>n</var> times until the point (<var>yn</var>, <var>yn</var>)
is reached.
</p>
</dd></dl>

<p><b>Options</b>
</p>
<p>The options accepted by the functions that plot graphs are:
</p>
<ul>
<li>
Option: <code>domain</code> sets the minimum and maximum values for the plot of the
function  <var>F</var> shown by <code>staircase</code>.
<table><tr><td>&nbsp;</td><td><pre class="example">[domain, -2, 3.5]
</pre></td></tr></table>
</li><li>
Option: <code>pointsize</code> defines the radius of each point plotted, in units of
points. 
<table><tr><td>&nbsp;</td><td><pre class="example">[pointsize, 1.5]
</pre></td></tr></table><p>The default value is 1.
</p>
</li><li>
Option: <code>xaxislabel</code> is a label to put on the horizontal axis.
<table><tr><td>&nbsp;</td><td><pre class="example">[xaxislabel, &quot;time&quot;]
</pre></td></tr></table>
</li><li>
Option: <code>xcenter</code> is the x coordinate of the point at the center of
the plot. This option is not used by the function <code>orbits</code>.
<table><tr><td>&nbsp;</td><td><pre class="example">[xcenter,3.45]
</pre></td></tr></table>
</li><li>
Option: <code>xradius</code> is half of the length of the range of values that
will be shown in the x direction. This option is not used by the
function <code>orbits</code>.
<table><tr><td>&nbsp;</td><td><pre class="example">[xradius,12.5]
</pre></td></tr></table>
</li><li>
Option: <code>yaxislabel</code> is a label to put on the vertical axis.
<table><tr><td>&nbsp;</td><td><pre class="example">[yaxislabel, &quot;temperature&quot;]
</pre></td></tr></table>
</li><li>
Option: <code>ycenter</code> is the y coordinate of the point at the center of
the plot.
<table><tr><td>&nbsp;</td><td><pre class="example">[ycenter,4.5]
</pre></td></tr></table>
</li><li>
Option: <code>yradius</code> is half of the length of the range of values that
will be shown in the y direction.
<table><tr><td>&nbsp;</td><td><pre class="example">[yradius,15]
</pre></td></tr></table>
</li></ul>

<p><b>Examples</b>
</p>
<p>Graphical representation and staircase diagram for the sequence:
2, cos(2), cos(cos(2)),...
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) load(&quot;dynamics&quot;)$
(%i2) evolution(cos(y), 2, 11, [yaxislabel, &quot;y&quot;], [xaxislabel,&quot;n&quot;]);
(%i3) staircase(cos(y), 1, 11, [domain, 0, 1.2]);
</pre></td></tr></table>
<p><div class="image"><img src="./figures/dynamics1.gif" alt="figures/dynamics1"></div>
<div class="image"><img src="./figures/dynamics2.gif" alt="figures/dynamics2"></div>
</p>
<p>If your system is slow, you'll have to reduce the number of iterations in
the following examples. And the pointsize that gives the best results
depends on the monitor and the resolution being used.
</p>
<p>Orbits diagram for the quadratic map
</p><table><tr><td>&nbsp;</td><td><pre class="example">        y(n+1) = x + y(n)^2
</pre></td></tr></table>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i4) orbits(y^2+x, 0, 50, 200, [x, -2, 0.25, 0.01], [pointsize, 0.9]);
</pre></td></tr></table>
<p><div class="image"><img src="./figures/dynamics3.gif" alt="figures/dynamics3"></div>
</p>
<p>To enlarge the region around the lower bifurcation near x <code>=</code> -1.25 use:
</p><table><tr><td>&nbsp;</td><td><pre class="example">(%i5) orbits(x+y^2, 0, 100, 400, [x,-1,-1.53,-0.001], [pointsize,0.9],
             [ycenter,-1.2], [yradius,0.4]);
</pre></td></tr></table>
<p><div class="image"><img src="./figures/dynamics4.gif" alt="figures/dynamics4"></div>
</p>
<p>Evolution of a two-dimensional system that leads to a fractal:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i6) f: 0.6*x*(1+2*x)+0.8*y*(x-1)-y^2-0.9$
(%i7) g: 0.1*x*(1-6*x+4*y)+0.1*y*(1+9*y)-0.4$
(%i8) evolution2d([f,g],[-0.5,0],50000,[pointsize,0.7]);
</pre></td></tr></table>
<p><div class="image"><img src="./figures/dynamics5.gif" alt="figures/dynamics5"></div>
</p>
<p>And an enlargement of a small region in that fractal:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i9) evolution2d([f,g],[-0.5,0],300000,[pointsize,0.7], [xcenter,-0.7],
                  [ycenter,-0.3],[xradius,0.1],[yradius,0.1]);
</pre></td></tr></table>
<p><div class="image"><img src="./figures/dynamics6.gif" alt="figures/dynamics6"></div>
</p>
<p>A plot of Sierpinsky's triangle, obtained with the chaos game:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i9) chaosgame([[0, 0], [1, 0], [0.5, sqrt(3)/2]], [0.1, 0.1], 1/2,
                 30000, [pointsize,0.7]);
</pre></td></tr></table>
<p><div class="image"><img src="./figures/dynamics7.gif" alt="figures/dynamics7"></div>
</p>
<p>Barnsley's fern, obtained with an Iterated Function System:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i10) a1: matrix([0.85,0.04],[-0.04,0.85])$
(%i11) a2: matrix([0.2,-0.26],[0.23,0.22])$
(%i12) a3: matrix([-0.15,0.28],[0.26,0.24])$
(%i13) a4: matrix([0,0],[0,0.16])$
(%i14) p1: [0,1.6]$
(%i15) p2: [0,1.6]$
(%i16) p3: [0,0.44]$
(%i17) p4: [0,0]$
(%i18) w: [85,92,99,100]$
(%i19) ifs(w,[a1,a2,a3,a4],[p1,p2,p3,p4],[5,0],50000,[pointsize,0.9]);
</pre></td></tr></table>
<p><div class="image"><img src="./figures/dynamics8.gif" alt="figures/dynamics8"></div>
</p>
<p>To solve numerically the differential equation
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">          dx/dt = t - x^2
</pre></td></tr></table>
<p>With initial value x(t=0) = 1, in the interval of t from 0 to 8 and with
increments of 0.1 for t, use:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i20) results: rk(t-x^2,x,1,[t,0,8,0.1])$
</pre></td></tr></table>
<p>the results will be saved in the list results.
</p>
<p>To solve numerically the system:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">        dx/dt = 4-x^2-4*y^2     dy/dt = y^2-x^2+1
</pre></td></tr></table>
<p>for t between 0 and 4, and with values of -1.25 and 0.75 for x and y at t=0
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i21) sol: rk([4-x^2-4*y^2,y^2-x^2+1],[x,y],[-1.25,0.75],[t,0,4,0.02])$
</pre></td></tr></table>
<hr size="6">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC187" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="maxima_50.html#SEC190" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_72.html#SEC264" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<p>
 <font size="-1">
  This document was generated by <em>Robert Dodier</em> on <em>September, 20 2006</em> using <a href="http://texi2html.cvshome.org/"><em>texi2html 1.76</em></a>.
 </font>
 <br>

</p>
</body>
</html>