Consider a fractal, specifically a Julia set, that you want to create and display in Maple. For any more than a few iterations, this can take a long time on a single computer. But you can divide the construction between an arbitrary sized network of computers by using the Grid Computing Toolbox.
First define a Julia set as a procedure, which will determine the color of the plot at point . A Julia set is formally defined as
where is a constant.
>
|
|
Here it is assumed that for m over 30, the sequence z converges. Increasing this number will make the computation more accurate, but take much more time. Define the constant and an appropriate view and grid size for this fractal. If c is changed, then v and gridsize may also need to be changed for the fractal to display properly.
>
|
|
>
|
|
>
|
|
To display the fractal as a plot, use the Julia Set as the color. The procedure plotsegment displays the fractal, and is called by the nodes of the grid separately for each section of the plot.
>
|
|
Define the procedure to be run by the Launch command, which includes a procedure for splitting up the computation.
>
|
|
Restart the Grid with your computer as the server, as in the above example. Configure the server for your network to run this example over a Grid.
>
|
|
Now you are ready to perform the computation and display the results. Ensure that you pass all assigned variables to the Launch command, or they will not be available on the other nodes of the grid.
The printer is specified as printf, but could be any method of output, including writing to a text area component or a text file. The procedure provides a mechanism for you to stop the computation at any time, on all nodes. In this example, it is always false, so the computation cannot be stopped.
>
|
|
>
|
|
>
|
|