Escape - Maple Help

IterativeMaps

 Escape
 generator for escape images

 Calling Sequence Escape( vars, exprlist, init, escapecond, xmin, xmax, ymin, ymax ) Escape( vars, exprlistlist, init, escapecond, xmin, xmax, ymin, ymax, probabilities ) Escape( vars, exprlist, init, escapecond, xmin, xmax, ymin, ymax, opts ) Escape( vars, exprlistlist, init, escapecond, xmin, xmax, ymin, ymax, probabilities, optsu )

Parameters

 vars - list of names, with length greater than or equal to 1, specifying the variables of the iterative function exprlist - list of algebraic expressions defining the iterative function on vars. exprlist must be of the same length as vars. exprlistlist - list of lists of algebraic expressions defining the iterative functions on vars, with probabilities defined by probabilities. Each list of expressions must be of the same length as vars. init - list of numeric real values or expressions in the variables xvariable, yvariable, with the same length as vars, specifying the initial values of vars escapecond - boolean expression specifying the condition when the iteration sequence breaks and the coloring procedures, defined by redexpression, greenexpression, and blueexpression, are applied xmin - real value determining the minimum value of xvariable xmax - real value determining the maximum value of xvariable ymin - real value determining the minimum value of yvariable ymax - real value determining the maximum value of yvariable probabilities - (optional) list of positive real numbers, such that $\frac{{\mathrm{probabilities}}_{i}}{\sum _{i=1}^{N}{\mathrm{probabilities}}_{i}}$, where N is the length of probabilities, defines the probability that the ith expression list in exprlistlist will be used for ${F}_{j}$ on the jth iteration, as explained below. The length of probabilities must be of the same length as the number of lists in exprlistlist. The default value is [1]

Options

 • iterations : keyword option of the form iterations=val, where val is a posint specifying the number of times the function defined by exprs will be applied at each (xvariable,yvariable) value. The default value is 1000.
 • outputimage : keyword option of the form outputimage=img where img is a color image as used by the ImageTools package, with dimensions of height and width. Escape will fill img with the generated image defined below.
 • height : keyword option of the form height=val, where val is a positive integer specifying the height of the image. If outputimage is defined the default value is the height of outputimage. Otherwise, the default value is 500.
 • width : keyword option of the form width=val, where val is a positive integer specifying the width of the image. If outputimage is defined the default value is the width of outputimage. Otherwise, the default value is 500.
 • xvariable : keyword option of the form xvariable=param, where param is a name specifying the parameter in exprs and/or init that will be varied along the horizontal axis. The default value is $'x'$
 • yvariable : keyword option of the form yvariable=param, where param is a name specifying the parameter in exprs and/or init that will be varied along the vertical axis. The default value is $'y'$
 • loopvariable : keyword option of the form loopvariable=var, where var is a name specifying the variable representing the current iteration index. The default value is $'i'$
 • redvariable : keyword option of the form redvariable=var, where var is a name specifying the red color variable at the current position in the image. The default value is $R$
 • greenvariable : keyword option of the form greenvariable=var, where var is a name specifying the green color variable at the current position in the image. The default value is $G$
 • bluevariable : keyword option of the form bluevariable=var, where var is a name specifying the blue color variable at the current position in the image. The default value is $B$
 • redexpression : keyword option of the form redexpression=expr, where expr is an algebraic expression defining the coloring procedure of the red color value at the current position the image. If redexpression=$\mathrm{null}$ then no procedure is applied to the red value at the current point. The default value is loopvariable
 • greenexpression : keyword option of the form greenexpression=expr, where expr is an algebraic expression defining the coloring procedure of the green color value at the current position the image. If greenexpression=$\mathrm{null}$ then no procedure is applied to the green value at the current point. The default value is $\mathrm{null}$
 • blueexpression : keyword option of the form blueexpression=expr, where expr is an algebraic expression defining the coloring procedure of the blue color value at the current position the image. If blueexpression=$\mathrm{null}$ then no procedure is applied to the blue value at the current point.The default value is $\mathrm{null}$

Description

 • The Escape module computes the escape values of an iterative function (xvariable against yvariable) being applied iterations times at equally spaced (xvariable,yvariable) values, and constructs an image of the results.
 • The image is an Array with dimensions height * width * 3 and with float[8] datatype, which corresponds to a color image in the context of the ImageTools package.
 • Within the domain [xmin, xmax] x [ymin, ymax], (xvariable, yvariable) values will be selected at equally spaced intervals.
 • For each (xvariable, yvariable) value, starting at the point ${X}_{0}$=init in ${ℝ}^{N}$, where N is the number of variables in vars, the sequence ${X}_{n}$=$F\left({X}_{n-1}\right)$, 0 $\le n\le$iterations, is generated.
 • The function $F:{ℝ}^{n}\to {ℝ}^{n}$, is defined by the following algorithm:
 Start at the point ${X}_{n}=\left({X}_{n,1},\mathrm{..},{X}_{n,N}\right)$, $j=1$
 Apply the function ${F}_{j}$ to the current point: $y={F}_{j}\left({X}_{n}\right)$
 Replace the jth component of ${X}_{n}$ with $y$: ${X}_{n}=\left({X}_{n,1},\mathrm{..},{X}_{n,j-1},y,\mathrm{..},{X}_{n,N}\right)$
 Increment j by 1, $j=j+1$ and repeat the process with the new ${X}_{n}$. Stop when $j=N+1$, where $N$ is the number of variables in vars.
 • Each ${F}_{j}$ is defined by evaluating ${\mathrm{exprlist}}_{j}$ at the current values of the variables in vars.
 • If given an exprlistlist, then one of the functions in exprlistlist will be randomly selected to be applied to ${X}_{n}$, for each 0 $\le n\le$iterations-1. The probability that the ith function defined in exprlistlist is applied to ${X}_{n}$ is equal to $\frac{{\mathrm{probabilities}}_{i}}{\sum _{i=1}^{N}{\mathrm{probabilities}}_{i}}$.
 • Whenever this process yields a point ${X}_{n}$, the escapecond is examined. If escapecond is true, then the expressions $\mathrm{redexpression}$, $\mathrm{greenexpression}$, $\mathrm{blueexpression}$ are evaluated, substituting the values ${X}_{n,1},\mathrm{...},{X}_{n,N}$ for the variables ${\mathrm{vars}}_{1},\mathrm{...},{\mathrm{vars}}_{N}$, and the current red, green, and blue values of the pixel, corresponding to the point (xvariable, yvariable), for the variables $\mathrm{redvariable}$, $\mathrm{greenvariable}$, and $\mathrm{bluevariable}$, respectively.
 • The red, green, and blue values of the pixel are then updated to the newly evaluated values, and the algorithm is repeated on the next (xvariable, yvariable).
 • If a coloring expression is $\mathrm{null}$ then the color, corresponding to the expression, of the pixel will be unchanged
 • Note that redexpression, greenexpression, blueexpression are applied to an image as defined by ImageTools:-Image, thus the minimum and maximum color values are 0 and 1 respectively.
 • Escape returns an image described above, as an Array. Further coloring procedures, defined in ImageTools, can be applied to the Array.
 • The defaults for options redexpression, greenexpression, and blueexpression generate an image that is suitable for use with ImageTools:-ColouringProcedures:-HueToRGB.

Examples

 > $\mathrm{with}\left(\mathrm{IterativeMaps}\right):$$\mathrm{with}\left(\mathrm{ImageTools}\right):$
 > $z≔{\left(\mathrm{zr}+\mathrm{zi}I\right)}^{4}$
 ${z}{≔}{\left({\mathrm{zr}}{+}{I}{}{\mathrm{zi}}\right)}^{{4}}$ (5.1)
 > $\mathrm{fzi}≔\mathrm{evalc}\left(\mathrm{\Im }\left(z\right)\right)$
 ${\mathrm{fzi}}{≔}{-}{4}{}{{\mathrm{zi}}}^{{3}}{}{\mathrm{zr}}{+}{4}{}{\mathrm{zi}}{}{{\mathrm{zr}}}^{{3}}$ (5.2)
 > $\mathrm{fzr}≔\mathrm{evalc}\left(\mathrm{\Re }\left(\mathrm{subs}\left(\mathrm{zi}=\mathrm{zit},z\right)\right)\right)$
 ${\mathrm{fzr}}{≔}{{\mathrm{zit}}}^{{4}}{-}{6}{}{{\mathrm{zit}}}^{{2}}{}{{\mathrm{zr}}}^{{2}}{+}{{\mathrm{zr}}}^{{4}}$ (5.3)
 > $\mathrm{mandelbroid}≔\mathrm{Escape}\left(\left[\mathrm{zi},\mathrm{zr},\mathrm{zit},\mathrm{zrsqr},\mathrm{zisqr}\right],\left[\mathrm{fzi}+y,\mathrm{fzr}+x,\mathrm{zi},{\mathrm{zr}}^{2},{\mathrm{zi}}^{2}\right],\left[y,x,y,{x}^{2},{y}^{2}\right],25<\mathrm{zrsqr}+\mathrm{zisqr},-1.4,1.0,-1.2,1.2,\mathrm{iterations}=3000,\mathrm{redexpression}=i\right):$
 > $\mathrm{ArrayTools}:-\mathrm{Dimensions}\left(\mathrm{mandelbroid}\right)$
 $\left[{1}{..}{500}{,}{1}{..}{500}{,}{1}{..}{3}\right]$ (5.4)
 > $\mathrm{ColouringProcedures}:-\mathrm{HueToRGB}\left(\mathrm{mandelbroid}\right):$$\mathrm{Embed}\left(\mathrm{mandelbroid}\right)$

 > $\mathrm{Hopalong}≔\mathrm{Escape}\left(\left[\mathrm{x1},\mathrm{x2},\mathrm{tx1}\right],\left[\mathrm{x2}-\mathrm{signum}\left(\mathrm{x1}\right)\mathrm{sqrt}\left(\mathrm{abs}\left(1.1\mathrm{x1}-3\right)\right),3.7-\mathrm{tx1},\mathrm{x1}\right],\left[x,y,x\right],150<{\mathrm{x1}}^{2}+{\mathrm{x2}}^{2},-20,20,-20,20,\mathrm{iterations}=5000,\mathrm{redexpression}=i,\mathrm{greenexpression}=\mathrm{sqrt}\left({\mathrm{x1}}^{2}+{\mathrm{x2}}^{2}\right)\right):$
 > $\mathrm{ArrayTools}:-\mathrm{Dimensions}\left(\mathrm{Hopalong}\right)$
 $\left[{1}{..}{500}{,}{1}{..}{500}{,}{1}{..}{3}\right]$ (5.5)
 > $\mathrm{Hopalong}≔\mathrm{Create}\left(\mathrm{Fractals}:-\mathrm{EscapeTime}:-\mathrm{Colorize}\left(500,\mathrm{Hopalong},\mathrm{Array}\left(\left[2,3,7\right],\mathrm{datatype}=\mathrm{integer}\left[4\right]\right),\mathrm{Array}\left(\left[0.25,0.75,0.25\right],\mathrm{datatype}=\mathrm{float}\left[8\right]\right),\mathrm{rgb}=0,\mathrm{mode}=4,\mathrm{layer}=2\right),\mathrm{fit}=\mathrm{true}\right):$$\mathrm{Embed}\left(\mathrm{Hopalong}\right)$

Compatibility

 • The IterativeMaps:-Escape command was introduced in Maple 2015.