/usr/share/doc/maxima-doc/html/maxima_50.html is in maxima-doc 5.32.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- Created on January, 10 2014 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 5.32.1 Manual: 50. dynamics</title>
<meta name="description" content="Maxima 5.32.1 Manual: 50. dynamics">
<meta name="keywords" content="Maxima 5.32.1 Manual: 50. 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: 1px solid gray;
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 */
background-color: #F1F5F9; /* light blue-gray */
/* font-family: "Lucida Console", monospace */
}
div.spacerbox
{
border: none;
padding-top: 2em;
padding-bottom: 2em
}
div.image
{
margin: 0;
padding: 1em;
text-align: center;
}
div.categorybox
{
border: 1px solid gray;
padding-top: 0px;
padding-bottom: 0px;
padding-left: 1em;
padding-right: 1em;
background: rgb(247,242,220);
}
-->
</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="SEC254"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="maxima_49.html#SEC253" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC255" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima_49.html#SEC250" title="Beginning of this chapter or previous chapter"> << </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_51.html#SEC257" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </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_82.html#SEC380" 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"> 50. dynamics </h1>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#SEC255">50.1 Introduction to dynamics</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC256">50.2 Functions and Variables for dynamics</a></td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<p><a name="Item_003a-Introduction-to-dynamics"></a>
</p><hr size="6">
<a name="Introduction-to-dynamics"></a>
<a name="SEC255"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC254" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC256" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC254" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC254" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_51.html#SEC257" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </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_82.html#SEC380" 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"> 50.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("dynamics")</code>.
</p>
<p>The commands that produce graphics accept the same options accepted by <code>plot2d</code> and some additional ones.
</p>
<div class=categorybox>
·
<p>@ref{Category: Dynamical systems} ·
@ref{Category: Share packages} ·
@ref{Category: Package dynamics}
</div>
</p>
<p><a name="Item_003a-Functions-and-Variables-for-dynamics"></a>
</p><hr size="6">
<a name="Functions-and-Variables-for-dynamics"></a>
<a name="SEC256"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC255" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="maxima_51.html#SEC257" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC254" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC254" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_51.html#SEC257" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </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_82.html#SEC380" 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"> 50.2 Functions and Variables for dynamics </h2>
<p><a name="Item_003a-chaosgame"></a>
</p><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="IDX2187"></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 on the
segment from the previous point plotted to the point chosen randomly, at a
distance from the random point which will be <var>b</var> times that segment's
length. The procedure is repeated <var>n</var> times.
</p>
<div class=categorybox>
·
<p>@ref{Category: Package dynamics} ·
@ref{Category: Plotting}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-evolution"></a>
</p><dl>
<dt><u>Function:</u> <b>evolution</b><i> (<var>F</var>, <var>y0</var>, <var>n</var>, ..., options, ...);</i>
<a name="IDX2188"></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><pre class="example"> y(n+1) = F(y(n))
</pre>
<p>With initial value <var>y(0)</var> equal to <var>y0</var>. <var>F</var> must be an
expression that depends only on one variable (in the example, it
depend on <var>y</var>, but any other variable can be used),
<var>y0</var> must be a real number and <var>n</var> must be a positive integer.
</p>
<div class=categorybox>
·
<p>@ref{Category: Package dynamics} ·
@ref{Category: Plotting}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-evolution2d"></a>
</p><dl>
<dt><u>Function:</u> <b>evolution2d</b><i> (<code>[</code><var>F</var>, <var>G</var><code>]</code>, <code>[</code><var>u</var>, <var>v</var><code>]</code>, <code>[</code><var>u0</var>, <var>y0</var><code>]</code>, <var>n</var>, ..., options, ...);</i>
<a name="IDX2189"></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><pre class="example"> u(n+1) = F(u(n), v(n)) v(n+1) = G(u(n), v(n))
</pre>
<p>With initial values <var>u0</var> and <var>v0</var>. <var>F</var> and <var>G</var> must be
two expressions that depend only on two variables, <var>u</var> and
<var>v</var>, which must be named explicitely in a list.
</p>
<div class=categorybox>
·
<p>@ref{Category: Package dynamics} ·
@ref{Category: Plotting}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-ifs"></a>
</p><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="IDX2190"></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>
<div class=categorybox>
·
<p>@ref{Category: Package dynamics} ·
@ref{Category: Plotting}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-orbits"></a>
</p><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="IDX2191"></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>
<div class=categorybox>
·
<p>@ref{Category: Package dynamics} ·
@ref{Category: Plotting}
</div>
</p>
</dd></dl>
<p><a name="Item_003a-staircase"></a>
</p><dl>
<dt><u>Function:</u> <b>staircase</b><i> (<var>F</var>, <var>y0</var>, <var>n</var>, ...options...);</i>
<a name="IDX2192"></a>
</dt>
<dd><p>Draws a staircase diagram for the sequence defined by the recurrence
relation
</p><pre class="example"> y(n+1) = F(y(n))
</pre>
<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>
<div class=categorybox>
·
<p>@ref{Category: Package dynamics} ·
@ref{Category: Plotting}
</div>
</p>
</dd></dl>
<p><b>Options</b>
</p>
<p>Each option is a list of two or more items. The first item is the name
of the option, and the remainder comprises the arguments for the option.
</p>
<p>The options accepted by the functions <code>evolution</code>, <code>evolution2d</code>,
<code>staircase</code>, <code>orbits</code>, <code>ifs</code> and <code>chaosgame</code> are the same as the options for
<code>plot2d</code>. In addition to those options, <code>orbits</code> accepts and
extra option <var>pixels</var> that sets up the maximum number of different
points that will be represented in the vertical direction.
</p>
<p><b>Examples</b>
</p>
<p>Graphical representation and staircase diagram for the sequence:
2, cos(2), cos(cos(2)),...
</p>
<pre class="example">(%i1) load("dynamics")$
(%i2) evolution(cos(y), 2, 11);
(%i3) staircase(cos(y), 1, 11, [y, 0, 1.2]);
</pre>
<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 if the dots appear too small in your
monitor, you might want to try a different style, such as
<code>[</code><var>style</var>,<code>[</code><var>points</var>,0.8<code>]]</code>.
</p>
<p>Orbits diagram for the quadratic map, with a parameter <var>a</var>.
</p><pre class="example"> x(n+1) = a + x(n)^2
</pre>
<pre class="example">(%i4) orbits(x^2+a, 0, 50, 200, [a, -2, 0.25], [style, dots]);
</pre>
<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><pre class="example">(%i5) orbits(x^2+a, 0, 100, 400, [a,-1,-1.53], [x,-1.6,-0.8],
[nticks, 400], [style,dots]);
</pre>
<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>
<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], [x,y], [-0.5,0], 50000, [style,dots]);
</pre>
<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>
<pre class="example">(%i9) evolution2d([f,g], [x,y], [-0.5,0], 300000, [x,-0.8,-0.6],
[y,-0.4,-0.2], [style, dots]);
</pre>
<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>
<pre class="example">(%i9) chaosgame([[0, 0], [1, 0], [0.5, sqrt(3)/2]], [0.1, 0.1], 1/2,
30000, [style, dots]);
</pre>
<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>
<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, [style,dots]);
</pre>
<p><div class="image"><img src="./figures/dynamics8.gif" alt="figures/dynamics8"></div>
</p>
<p>See also the documentation for packages <code><a href="maxima_12.html#mandelbrot">mandelbrot</a></code>. and <code><a href="maxima_12.html#julia">julia</a></code>. in the Plotting section.
</p>
<p><a name="Item_003a-ezunits"></a>
</p><hr size="6">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC254" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="maxima_51.html#SEC257" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </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_82.html#SEC380" 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>root</em> on <em>January, 10 2014</em> using <a href="http://texi2html.cvshome.org/"><em>texi2html 1.76</em></a>.
</font>
<br>
</p>
</body>
</html>
|