IterativeMaps
Attractor
generator for attractor images
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
Attractor(vars, exprlist, init)
Attractor(vars, exprlistlist, init, probabilities)
Attractor(vars, exprlist, init, opts)
Attractor(vars, exprlistlist, init, probabilities, opts)
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 probabilitiesi∑i=1N⁡probabilitiesi, where N is the length of probabilities, defines the probability that the ith expression list in exprlistlist will be used for Fj 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]
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 init1−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 init1+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 init2−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 init2+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=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=null then no procedure is applied to the green value at the current point. The default value is 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=null then no procedure is applied to the blue value at the current point.The default value is null
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 X0=init in ℝN, where N is the number of variables in vars, the sequence Xn=F⁡Xn−1, 1 ≤n≤iterations, is generated.
The function F:ℝn→ℝn, is defined by the following algorithm:
Start at the point Xn=Xn,1,..,Xn,N, j=1
Apply the function Fj to the current point: y=Fj⁡Xn
Replace the jth component of Xn with y: Xn=Xn,1,..,Xn,j−1,y,..,Xn,N
Increment j by 1, j=j+1 and repeat the process with the new Xn. Stop when j=N+1, where N is the number of variables in vars.
Each Fj is defined by evaluating exprlistj 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 Xn, for each 0 ≤n≤iterations-1. The probability that the ith function defined in exprlistlist is applied to Xn is equal to probabilitiesi∑i=1N⁡probabilitiesi.
Whenever this process yields a point Xn, the values Xn,1,Xn,2 are examined to find which pixel in the image they correspond to. Then, the expressions redexpression, greenexpression, blueexpression are evaluated, substituting the values Xn,1,...,Xn,N for the variables vars1,...,varsN, and the current red, green, and blue values of that pixel for the variables redvariable, greenvariable, and bluevariable, respectively.
The red, green, and blue values of the pixel are then updated to the newly evaluated values.
If a coloring expression is 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.
with⁡IterativeMaps:with⁡ImageTools:
Hopalong,xrange,yrange≔Attractor⁡x,y,tx,height=400,width=400,y−signum⁡x⁢sqrt⁡abs⁡4⁢x−6,10−tx,x,1.3,1,1.3,iterations=2500000:
ArrayTools:-Dimensions⁡Hopalong
1..400,1..400,1..3
xrange,yrange
−510.7000000..513.3000000,−511..513
ColouringProcedures:-HueToRGB⁡Hopalong:Embed⁡Hopalong:
dt≔0.0015
xProc≔x−a⁢x⁢dt−y⁢dt
xProc≔x−a⁢0.0015⁢x−0.0015⁢y
yProc≔y+b⁢tx⁢dt−y⁢dt−z⁢tx⁢dt
yProc≔0.0015⁢b⁢tx−0.0015⁢tx⁢z+0.9985⁢y
zProc≔z−c⁢z⁢dt+tx⁢ty⁢dt
zProc≔−0.0015⁢c⁢z+0.0015⁢tx⁢ty+z
a≔10
b≔28
c≔83
Lorenz,xrange,yrange≔Attractor⁡x,y,z,tx,ty,height=400,width=400,xProc,yProc,zProc,x,y,1,1,1,1,1,iterations=5000000:
ArrayTools:-Dimensions⁡Lorenz
−31..33,−31..33
ColouringProcedures:-HueToRGB⁡Lorenz:ImageTools:-Embed⁡Lorenz:
d≔2
e≔3
f≔2
g≔3
LorenzMix,xrange,yrange≔Attractor⁡width=1600,height=1600,x,y,z,tx,ty,GC,BC,xProc,yProc,zProc,x,y,93100,45100,cos⁡x⁢d+g⁢sin⁡y⁢d,sin⁡y⁢e+f⁢cos⁡tx⁢e,z,x,y,96100,6100,1,1,1,1,1,0.5,0.5,2.96,0.04,xmin=−25,xmax=25,ymin=−25,ymax=25,iterations=10000000,fixview=true,redexpression=R+1,greenexpression=GC+G2,blueexpression=BC+B2:
ArrayTools:-Dimensions⁡LorenzMix
1..1600,1..1600,1..3
−25..25,−25..25
LorenzMix≔ColouringProcedures:-FlameToRGB⁡LorenzMix,1.9,4:ImageTools:-Embed⁡LorenzMix:
The IterativeMaps:-Attractor command was introduced in Maple 2015.
For more information on Maple 2015 changes, see Updates in Maple 2015.
See Also
Download Help Document