 Attractor - Maple Help

IterativeMaps

 Attractor
 generator for attractor images Calling Sequence Attractor(vars, exprlist, init) Attractor(vars, exprlistlist, init, probabilities) Attractor(vars, exprlist, init, opts) Attractor(vars, exprlistlist, init, probabilities, opts) Parameters

 vars - list of names, with length greater than or equal to 2, specifying the variables of the iterative function. The first variable is used on the horizontal axis and the second variable is used on the vertical axis. exprlist - list of algebraic expressions defining the iterative function on vars. The exprlist parameter 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, with the same length as vars, specifying the initial values of vars probabilities - (optional) list of positive real numbers, such as $\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 Options

 • iterations : keyword option of the form iterations=val, where val is a positive integer specifying the number of times the function defined by exprs will be applied. The default value is 100000.
 • 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. Attractor 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.
 • fixview : keyword option of the form fixview=truefalse. If fixview=false, the image will resize itself in order to fit all the points generated by the attractor. Otherwise, the image will only contain points within the boundaries formed by xmin, xmax, ymin, ymax. The default value is false.
 • xmin : keyword option of the form xmin=val, where val is a real number specifying the minimum value displayed on the horizontal axis. The default value is ${\mathrm{init}}_{1}-1$
 • xmax : keyword option of the form xmax=val, where val is a real number specifying the maximum value displayed on the horizontal axis. The default value is ${\mathrm{init}}_{1}+1$
 • ymin : keyword option of the form ymin=val, where val is a real number specifying the minimum value displayed on the vertical axis. The default value is ${\mathrm{init}}_{2}-1$
 • ymax : keyword option of the form ymax=val, where val is a real number specifying the maximum value displayed on the vertical axis. The default value is ${\mathrm{init}}_{2}+1$
 • 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 on 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 on 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 on 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 on the image. If redexpression=$\mathrm{null}$ then no procedure is applied to the red value at the current point. The default value is $R+1$
 • 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 on 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 on 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 Attractor command generates an image of points of an iterative function (the first variable in vars against the second variable in vars) being applied iterations times.
 • 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)$, 1 $\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 values ${X}_{n,1},{X}_{n,2}$ are examined to find which pixel in the image they correspond to. 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 that pixel 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.
 • 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.
 • Attractor returns an image as described above, the range of the horizontal axis, and the range of the vertical axis. Further coloring procedures, defined in ImageTools, can be applied to the image.
 • The defaults for options redexpression, greenexpression, and blueexpression generate an image that is designed to be used with ImageTools:-ColouringProcedures:-HueToRGB. Examples

 > $\mathrm{with}\left(\mathrm{IterativeMaps}\right):$$\mathrm{with}\left(\mathrm{ImageTools}\right):$
 > $\mathrm{Hopalong},\mathrm{xrange},\mathrm{yrange}≔\mathrm{Attractor}\left(\left[x,y,\mathrm{tx}\right],\mathrm{height}=400,\mathrm{width}=400,\left[y-\mathrm{signum}\left(x\right)\mathrm{sqrt}\left(\mathrm{abs}\left(4x-6\right)\right),10-\mathrm{tx},x\right],\left[1.3,1,1.3\right],\mathrm{iterations}=2500000\right):$
 > $\mathrm{ArrayTools}:-\mathrm{Dimensions}\left(\mathrm{Hopalong}\right)$
 $\left[{1}{..}{400}{,}{1}{..}{400}{,}{1}{..}{3}\right]$ (5.1)
 > $\mathrm{xrange},\mathrm{yrange}$
 ${-510.7000000}{..}{513.3000000}{,}{-511}{..}{513}$ (5.2)
 > $\mathrm{ColouringProcedures}:-\mathrm{HueToRGB}\left(\mathrm{Hopalong}\right):$$\mathrm{Embed}\left(\mathrm{Hopalong}\right):$ > $\mathrm{dt}≔0.0015$
 ${\mathrm{dt}}{≔}{0.0015}$ (5.3)
 > $\mathrm{xProc}≔x-a\left(x\mathrm{dt}-y\mathrm{dt}\right)$
 ${\mathrm{xProc}}{≔}{x}{-}{a}{}\left({0.0015}{}{x}{-}{0.0015}{}{y}\right)$ (5.4)
 > $\mathrm{yProc}≔y+b\mathrm{tx}\mathrm{dt}-y\mathrm{dt}-z\mathrm{tx}\mathrm{dt}$
 ${\mathrm{yProc}}{≔}{0.0015}{}{b}{}{\mathrm{tx}}{-}{0.0015}{}{\mathrm{tx}}{}{z}{+}{0.9985}{}{y}$ (5.5)
 > $\mathrm{zProc}≔z-cz\mathrm{dt}+\mathrm{tx}\mathrm{ty}\mathrm{dt}$
 ${\mathrm{zProc}}{≔}{-}{0.0015}{}{c}{}{z}{+}{0.0015}{}{\mathrm{tx}}{}{\mathrm{ty}}{+}{z}$ (5.6)
 > $a≔10$
 ${a}{≔}{10}$ (5.7)
 > $b≔28$
 ${b}{≔}{28}$ (5.8)
 > $c≔\frac{8}{3}$
 ${c}{≔}\frac{{8}}{{3}}$ (5.9)
 > $\mathrm{Lorenz},\mathrm{xrange},\mathrm{yrange}≔\mathrm{Attractor}\left(\left[x,y,z,\mathrm{tx},\mathrm{ty}\right],\mathrm{height}=400,\mathrm{width}=400,\left[\mathrm{xProc},\mathrm{yProc},\mathrm{zProc},x,y\right],\left[1,1,1,1,1\right],\mathrm{iterations}=5000000\right):$
 > $\mathrm{ArrayTools}:-\mathrm{Dimensions}\left(\mathrm{Lorenz}\right)$
 $\left[{1}{..}{400}{,}{1}{..}{400}{,}{1}{..}{3}\right]$ (5.10)
 > $\mathrm{xrange},\mathrm{yrange}$
 ${-31}{..}{33}{,}{-31}{..}{33}$ (5.11)
 > $\mathrm{ColouringProcedures}:-\mathrm{HueToRGB}\left(\mathrm{Lorenz}\right):$$\mathrm{ImageTools}:-\mathrm{Embed}\left(\mathrm{Lorenz}\right):$ > $d≔2$
 ${d}{≔}{2}$ (5.12)
 > $e≔3$
 ${e}{≔}{3}$ (5.13)
 > $f≔2$
 ${f}{≔}{2}$ (5.14)
 > $g≔3$
 ${g}{≔}{3}$ (5.15)
 > $\mathrm{LorenzMix},\mathrm{xrange},\mathrm{yrange}≔\mathrm{Attractor}\left(\mathrm{width}=1600,\mathrm{height}=1600,\left[x,y,z,\mathrm{tx},\mathrm{ty},\mathrm{GC},\mathrm{BC}\right],\left[\left[\mathrm{xProc},\mathrm{yProc},\mathrm{zProc},x,y,\frac{93}{100},\frac{45}{100}\right],\left[\mathrm{cos}\left(xd\right)+g\mathrm{sin}\left(yd\right),\mathrm{sin}\left(ye\right)+f\mathrm{cos}\left(\mathrm{tx}e\right),z,x,y,\frac{96}{100},\frac{6}{100}\right]\right],\left[1,1,1,1,1,0.5,0.5\right],\left[2.96,0.04\right],\mathrm{xmin}=-25,\mathrm{xmax}=25,\mathrm{ymin}=-25,\mathrm{ymax}=25,\mathrm{iterations}=10000000,\mathrm{fixview}=\mathrm{true},\mathrm{redexpression}=R+1,\mathrm{greenexpression}=\frac{\mathrm{GC}+G}{2},\mathrm{blueexpression}=\frac{\mathrm{BC}+B}{2}\right):$
 > $\mathrm{ArrayTools}:-\mathrm{Dimensions}\left(\mathrm{LorenzMix}\right)$
 $\left[{1}{..}{1600}{,}{1}{..}{1600}{,}{1}{..}{3}\right]$ (5.16)
 > $\mathrm{xrange},\mathrm{yrange}$
 ${-25}{..}{25}{,}{-25}{..}{25}$ (5.17)
 > $\mathrm{LorenzMix}≔\mathrm{ColouringProcedures}:-\mathrm{FlameToRGB}\left(\mathrm{LorenzMix},1.9,4\right):$$\mathrm{ImageTools}:-\mathrm{Embed}\left(\mathrm{LorenzMix}\right):$  Compatibility

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