Sponsored links: Algebra eBooks

Help Index



























The Maxima on-line user's manual

Algebra Calculator


Staircase Calculator


Function: staircase (<F>, <y0>, <n>, ...options...); Draws a staircase diagram for the sequence defined by the recurrence relation y(n+1) = F(y(n))


The interpretation and allowed values of the input parameters is the same as for the function evolution. A staircase diagram consists of a plot of the function <F(y)>, together with the line <G(y)> = <y>. A vertical segment is drawn from the point (<y0>, <y0>) on that line until the point where it intersects the function <F>. From that point a horizontal segment is drawn until it reaches the point (<y1>, <y1>) on the line, and the procedure is repeated <n> times until the point (<yn>, <yn>) is reached.


Each option is a list of two or more items. The first item is thename of the option, and the remainder comprises the arguments for theoption.

The options accepted by the functions evolution, evolution2d,staircase, orbits, ifs and chaosgame are the same as theoptions for plot2d. In addition to those options, orbits accepts andextra option <pixels> that sets up the maximum number of differentpoints that will be represented in the vertical direction.

The following options are accepted by the functions julia andmandelbrot:

* "size" takes either one or two arguments. If only one argument is given, the width and height of the graphic file created will be equal to that value, in pixels. If two arguments are given, they will define the width and height. The default value is 400 pixels for both the width and height. If the two values are not equal, the set will appear distorted.

* "levels" defines the maximum number of iterations, which is also equal to the number of colors used for points not belonging to the set. The default value is 12; larger values mean much longer processing times.

* "huerange" defines the range of hue angles used for the hue of points not belonging to the set. The default value is 360, which means that the colors will expand all the range of hues. Values bigger than 360, will mean repeated ranges of the hue, and negative values can be used to make the hue angle decrease as the number of iterations increases.

* "hue" sets the hue, in degrees, of the first color used for the points which do not belong to the set. Its default value is 300 degrees, which corresponds to magenta; the values for other standard colors are 0 for red, 45 for orange, 60 for yellow, 120 for green, 180 for cyan and 240 for blue. See also option <huerange>.

* "saturation" sets the value of the saturation used for points not belonging to the set. It must be between 0 and 1. The default is 0.46.

* "value" sets the value of the colors used for points not belonging to the set. It must be between 0 and 1; the higher the value, the brighter the colors. The default is 0.96

* "color" must be followed by three parameters that define the hue, saturation and value, for the color used to represent the points of the set. The default value is 0 for the three parameters, which corresponds to black. For an explanation of the range of allowed values, see options <hue>, <saturation> and <value>.

* "center" must be followed by two real parameters, which give the coordinates, on the complex plane, of the point in the center of the region shown. The default value is 0 for both coordinates (the origin).

* "radius" sets the radius of the biggest circle inside the square region that will be displayed. The default value is 2.

* "filename" gives the name of the file where the resulting graph will be saved. The extension .xpm will be added to that name. If the file already exists, it will be replaced by the file generated by the function. The default values are julia for the Julia set, and mandelbrot for the Mandelbrot set.


Graphical representation and staircase diagram for the sequence: 2,cos(2), cos(cos(2)),...

     (%i1) load("dynamics")$

     (%i2) evolution(cos(y), 2, 11);

     (%i3) staircase(cos(y), 1, 11, [y, 0, 1.2]);

If your system is slow, youll have to reduce the number ofiterations in the following examples. And if the dots appear too smallin your monitor, you might want to try a different style, such as[<style>,[<points>,0.8]].

Orbits diagram for the quadratic map, with a parameter <a>. x(n+1) = a + x(n)^2

     (%i4) orbits(x^2+a, 0, 50, 200, [a, -2, 0.25], [style, dots]);

   To enlarge the region around the lower bifurcation near x = -1.25
     (%i5) orbits(x^2+a, 0, 100, 400, [a,-1,-1.53], [x,-1.6,-0.8],
                  [nticks, 400], [style,dots]);

Evolution of a two-dimensional system that leads to a fractal:

     (%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]);

And an enlargement of a small region in that fractal:

     (%i9) evolution2d([f,g], [x,y], [-0.5,0], 300000, [x,-0.8,-0.6],
                       [y,-0.4,-0.2], [style, dots]);

A plot of Sierpinskys triangle, obtained with the chaos game:

     (%i9) chaosgame([[0, 0], [1, 0], [0.5, sqrt(3)/2]], [0.1, 0.1], 1/2,
                      30000, [style, dots]);

Barnsleys fern, obtained with an Iterated Function System:

     (%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]);

To create a file named _dynamics9.xpm_ with a graphicalrepresentation of the Mandelbrot set, with 12 colors, use:


and the Julia set for the number (-0.55 + i 0.6) can be obtainedwith: julia(-0.55, 0.6, [levels, 36], [center, 0, 0.6], [radius, 0.3], [hue, 240], [huerange, -180], [filename, "dynamics10"])$

the graph will be saved in the file _dynamics10.xpm_ and will showthe region from -0.3 to 0.3 in the x direction, and from 0.3 to 0.9 inthe y direction. 36 colors will be used, starting with blue and endingwith yellow.

To solve numerically the differential equation

dx/dt = t - x^2

With initial value x(t=0) = 1, in the interval of t from 0 to 8 andwith increments of 0.1 for t, use:

     (%i20) results: rk(t-x^2,x,1,[t,0,8,0.1])$

the results will be saved in the list results.

To solve numerically the system:

dx/dt = 4-x^2-4*y^2 dy/dt = y^2-x^2+1

for t between 0 and 4, and with values of -1.25 and 0.75 for x and yat t=0:

     (%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])$

(%o1)                                true

Staircase Example

Related Examples


? staircase;







? staircase;