Product Tips & Techniques

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

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...

Wide set of expressions can convert to compiled functions. Expressions can even include definite integrals.
Hope it helps for others who want really speedup calculations in maple as much as possible for now.

ex.mw

 

Checked under 15.01 version

The "." notation for the dot product of Vectors is very convenient and intuitive.  For example:

> <1,2,3> . <1,1,1>;

6

One sometimes annoying feature of it, however, is that by default Maple is using a dot product (suitable for Vectors with complex scalars) that is conjugate-linear in the first argument.  But let's say you will only be working with real scalars.  There's no problem if your Vectors have numeric entries, but...

Over the weekend I was attempting to estimate the tension change in a bicycle spoke due to an applied load.  After various simplifications and approximations, the problem was reduced to the following.

Given a constraint, F(x,y) = 0, and functions G(x,y) and H(x,y), find dG/dH at a particular point, here (0,0). 

The constraint, F, was sufficiently complicated that solving for either variable was not feasible, so implicit differentiation seemed the best...

 

I have data organized in a Matrix from which I want to select a sample based on a certain (simple) criterion, e.g. no cell in the first column to be negative.

I was quickly able to find a way to do it, inspired by a method Preben Alsholm used in a recent mapleprimes post.

But, I wondered, is that the most natural approach? So I quickly found another approach and compared them.

Any other suggestions welcome. Particularly methods that could...

First 29 30 31 32 33 34 35 Last Page 31 of 65