Product Tips & Techniques

Tips and Tricks on how to get the most about Maple and MapleSim

Using techniques previously used for generating color images of logistic maps and complex argument, attached is a first draft of a new Mandelbrot set fractal image applet.

A key motive behind this is the need for a faster fractal generator than is currently available on the Application Center as the older Fractal Fun! and Mandelbrot Mania with Maple entries. Those older apps warn against being run with too high a resolution for the final image, as it would take too long. In fact, even at a modest size such as 800x800 the plain black and white images can take up to 40 seconds to generate on a fast Intel i7 machine when running those older applications.

The attached worksheet can produce the basic 800x800 black and white image in approximately 0.5 seconds on the same machine. I used 64bit Maple 15.01 on Windows 7 for the timings. The attached implementration uses the Maple Compiler to attain that speed, but should fall back to Maple's quick evalhf mode in the case that the Compiler is not properly configured or enabled.

The other main difference is that this new version is more interactive: using sliders and other Components. It also inlines the image directly (using a Label), instead of as a (slow and resource intensive) density plot.

Run the Code Edit region, to begin. Make sure your GUI window is shown large enough for you to see the sides of the GUI Table conveniently.

The update image appearing in the worksheet is stored in a file, the name of which is currently set to whatever the following evaluates to in your Maple,

cat(kernelopts('homedir'),"/mandelbrot.jpg"):

You can copy the current image file aside in your OS while experimenting with the applet, if you want to save it at any step. See the start of the Code Edit region, to change this filename setting.

Here's the attachment. Comments are welcome, as I'd like to make corrections before submitting to the Application Center. Some examples of images (reduced in size for inclusion here) created with the applet are below.

Starting from Maple 15, the useful ?plottools/getdata command is added. It tansforms a Maple plot to a Matrix. Unfortunately, the getdata command deals only with Maple plots. The question arises: "How to get a data from bmp, jpg, tiff, pcx, gif, png and wmf formats?" This is used in medicine and engineering. Such question was asked here

2012.zip

Ukraine. External independent evaluation (ZNO) in 2012. Trial in Maple 16

html 3-interactive in Ukrainian: zno.zip

1dim_roots.mw

All critics and new ideas would be appreciated.

N.B. The MaplePrimes site elided everything past the bullet list, which included more description and links for obtaining the package.  It appears as though bullet lists break MaplePrimes, so this is going to be a bit out-of-order.

This new debugger uses a client/server architecture.  Communication with Maple is via TCP. This permits remote debugging as well as concurrent debugging of multiple Maple processes.  That is useful for comparing different...

Sometimes it is appealing to have a package export a procedure which does not show up when calling with().

For example, the procedure might be used elsewhere, but be otherwise so very technically obscure that nobody else would be interested. (The counter-argument is that what is good for the goose is good for the gander! If something else in Maple can make good use of it and need it, then you might too.)

Now, Maple's modules don't have the concept of "friends",...

I was trying to put together a series of plots that each included multiple dataseries.  I wanted to color them to help distinguish the various curves.  When I went into Maple's help page for the "colornames" that Maple recognizes, I was surprised to find that there were no color swatches to help you pick what color you wanted to use.  So I copied the color names from the help into a worksheet and told it to plot some color swatches for me. Here is the result:

MapleColors.mw 

 

Note that the fixed width web page is cutting off two columns of colors.  Click the image to see the whole set of colors.

 

 

 

 

Check this:

111.mw

Don't forget set Plot0 component manipulator to "Click and Drag" to test "on click" event. Localizing of problem takes for me ~4 days. It's terrible!

 

---------for stupid tags

global

The directional derivative of a scalar function f(x), computed in the direction u in Cartesian coordinates, is defined by

Suppose that you wish to animate the whole view of a plot. By whole view, I mean that it includes the axes and is not just a rotation of a plotted object such as a surface.

One simple way to do this is to call plots:-animate (or plots:-display on a list of plots supplied in a list, with its `insequence=true` option). The option `orientation` would contain the parameter that governs the animation (or generates the sequence).

But that entails recreating the same plot each time. The plot data might not even change. The key thing that changes is the ORIENTATION() descriptor within each 3d plot object in the reulting data structure. So this is inefficient in two key ways, in the worst case scenario.

1) It may even compute the plot's numeric results, as many times as there are frames in the resulting animation.

2) It stores as many instances of the grid of computed numeric data as there are frames.

We'd like to do better, if possible, reducing down to a single computation of the data, and a single instance of storage of a grid of data.

To keep this understandable, I'll consider the simple case of plotting a single 3d surface. More complicated cases can be handled with revisions to the techniques.

Avoiding problem 1) can be done in more than one way. Instead of plotting an expression, a procedure could be plotted, where that procedure has `option remember` so that it automatically stores computed results an immediately returns precomputed stored result when the arguments (x and y values) have been used already.

Another way to avoid problem 1) is to generate the unrotated plot once, and then to use plottools:-rotate to generate the other grids without necessitating recomputation of the surface. But this rotates only objects in the plot, and does alter the view of the axes.

But both 1) and 2) can be solved together by simply re-using the grid of computed data from an initial plot3d call, and then constructing each frame's plot data structure component "manually". The only thing that has to change, in each, is the ORIENTATION(...) subobject.

At 300 frames, the difference in the following example (Intel i7, Windows 7 Pro 64bit, Maple 15.01) is a 10-fold speedup and a seven-fold reduction is memory allocation, for the creation of the animation structure. I'm not inlining all the plots into this post, as they all look the same.

restart:
P:=1+x+1*x^2-1*y+1*y^2+1*x*y:

st,ba:=time(),kernelopts(bytesalloc):

plots:-animate(plot3d,[P,x=-5..5,y=-5..5,orientation=[A,45,45],
                       axes=normal,labels=[x,y,z]],
               A=0..360,frames=300);

time()-st,kernelopts(bytesalloc)-ba;

                                1.217, 25685408
restart:
P:=1+x+1*x^2-1*y+1*y^2+1*x*y:

st,ba:=time(),kernelopts(bytesalloc):

g:=plot3d(P,x=-5..5,y=-5..5,orientation=[-47,666,-47],
          axes=normal,labels=[x,y,z]):

plots:-display([seq(PLOT3D(GRID(op([1,1..2],g),op([1,3],g)),
                           remove(type,[op(g)],
                                  specfunc(anything,{GRID,ORIENTATION}))[],
                           ORIENTATION(A,45,45)),
                    A=0..360,360.0/300)],
               insequence=true);

time()-st,kernelopts(bytesalloc)-ba;

                                0.125, 3538296

By creating the entire animation data structure manually, we can get a further factor of 3 improvement in speed and a further factor of 3 reduction in memory allocation.

restart:
P:=1+x+1*x^2-1*y+1*y^2+1*x*y:

st,ba:=time(),kernelopts(bytesalloc):

g:=plot3d(P,x=-5..5,y=-5..5,orientation=[-47,666,-47],
          axes=normal,labels=[x,y,z]):

PLOT3D(ANIMATE(seq([GRID(op([1,1..2],g),op([1,3],g)),
                           remove(type,[op(g)],
                                  specfunc(anything,{GRID,ORIENTATION}))[],
                           ORIENTATION(A,45,45)],
                    A=0..360,360.0/300)));

time()-st,kernelopts(bytesalloc)-ba;

                                0.046, 1179432                            

Unfortunately, control over the orientation is missing from Plot Components, otherwise such an "animation" could be programmed into a Button. That might be a nice functionality improvement, although it wouldn't be very nice unless accompanied by a way to export all a Plot Component's views to GIF (or mpeg!).

The above example produces animations each of 300 frames. Here's a 60-frame version:

In case if you like notepad++  under windows, and still didn't do smth like that then this is for you .userDefineLang.zip

Unpack to notepad++ folder. In case if you already had had other
own language then just copy "Maple language" section.

A recent Tips and Techniques article in the Maple Reporter contained the following five "gems" from my Red Book of Maple Magic. These 'gems' are tricks and techniques for Maple that I've discovered in my years here at Maplesoft. The previous 15 gems have appeared in three other issues of the Reporter, as...

New versions of Maple T.A. and the Maple T.A. MAA Placement Test Suite are now available. Highlights include:

- Adaptive questions provide students another chance when they give an incorrect response. Knowing the student is having trouble, the question can be adapted to walk the student through the problem one step at a time, allow students to try a simpler version of the same question before retrying the original, or whatever the instructor feels is appropriate. 

It is possible to thicken the axes of 2D plots by adjusting the underlying data structure, since the appropriately placed THICKNESS() call within the PLOT() data structure is recognized by the Standard GUI. This does not seem to be recognized for PLOT3D structures, however.

The issue of obtaining thicker axes for 2D plots can then be resolved by first creating a plot, and then subsequently modifying the PLOT structure.

The same techniques could be used to thin...

On November 22, Joe Riel posted an implicit differentiation problem that caught my attention. It took the manipulations typically learned in an Advanced Calculus course one step further, but the devices learned in such a course could readily be applied. Joe's solution was expressed in terms of exterior...

First 27 28 29 30 31 32 33 Last Page 29 of 64