Product Tips & Techniques

Tips and Tricks on how to get the most about Maple and MapleSim
Maple 11 has included indicial notation capability to its new Physics package. This is a good start in performing tensorial calculations using Einsteinian summation convention. However, I wish that Maple further adds the following capabilities to make this package of practical use to folks involved in tensor analysis. This wish list is based upon my personal experience in using tensor analysis for continuum-mechanics and is in no way representative of the community involved in other fields like the theory of relativity. 1) Both covariant and contravariant indices are denoted in subscript. Including the convention of posting counter and covariant indices in super and subscripts, respectively, will help to improve the readability of the printed results.
Hi! I'm ScasByte welcome to my MaplePrime blog.

If you are interested in 3d Strange Attractors but you don't know how to create it here I can show you how, create Strange Attractor is actually very easy, if you are new to Maple then you might this very useful.
Here is a link to the first 3d Strange Attractor(the most simple of all) a PickOver.

Here is the code to generate a PickOver:

Earlier today, I was re-reading an old post when I was inspired. The post asked how one could use typesetting rules to make the call of a procedure typeset as a binary operation. The example used in the post was something along the lines of: myproc(a,b); becomes a <symbol> b; Inspired by a response to that post, I started looking at the help page for the define command and doing some testing in Maple. I was ready to make a reply to that post, when I stumbled upon a mind-boggling error. In the time it's taken me to track down that error (and run various errands), the original post has vanished from my view. Perhaps it still exists somewhere, but for the life of me, I cannot find it; therefore, I post to the next most appropriate place to describe and discuss this shortcoming: This blog.
Here's a tip for people new to Maple or to 2-D input: always use a space for implied multiplication. 2-D math input in Maple allows for implicit multiplication, which is writing a multiplication operation without an explicit multiplication operator. An example is x y. The space is not always required in cases where there is no ambiguity. However, it is highly recommended that you include it. An example that catches many new users (and some experienced ones as well) is s(t+u). This does not mean s times t+u, but the function s applied to t+u

"I've seen this element before..." Often we are faced with the problem of building up sets incrementally, by removing pieces one at a time from a larger whole. The bottlenecks in this case are usually: 1) adding a small set X to a large set S (copies S and X, making this ~O(|S|+|X|)) 2) removing elements of the large set S from the small set X (binary search: |X|*log(|S|)) A classic example of this is a breadth-first-search. We start at one vertex of a graph and in each iteration we add the set of new neighbors X to the set of vertices S that have already been found. We can make this more useful by making the program return the sets of new neighbors found in each iteration, that is, the sets of vertices that are distance 1, 2, 3, etc. from the initial vertex.

The error message "too many levels of recursion" is sometimes misleading. In the problem below, the error source was an undefined list variable. This hint may help to find programming errors.

One issue that often confuses users is local versus global optimization in Maple. I'm just going to give an overview here and will explore specific optimization topics more deeply in future blog entries. Please note that I'm covering only the numeric optimization methods here. I'll leave discussion of the exact methods in Maple to others more knowledgeable about those areas.

The Optimization package is built into Maple and is available to all users. This is primarily...

Question: How do I generate tickmarks in multiples of Pi? The answer has been posted before but this question comes up often enough that it is worth repeating. In Maple 10 and earlier versions, you had to build a custom list of tickmarks, and the only way you could get the Greek pi symbol was to use the Symbol font. In Maple 11, you can use the new 'spacing' structure with the 'tickmarks' option. To get tickmarks in multiples of Pi, use: > plot(sin(x), x=0..8*Pi, tickmarks=[spacing(Pi), default]); To get tickmarks spaced by 2*Pi, replace spacing(Pi) with spacing(2*Pi). To get the tickmarks occuring on the odd multiples of Pi, use spacing(2*Pi, Pi). The second argument is a fixed value from which the other tickmarks are determined.
Well, that last blog entry sure generated a lot of discussion! I'm going to move on to something a bit more fun and less controversial: how to generate a 3-D plot of a polyhedron. There are different ways to do this in Maple, depending on how complicated the polyhedron is and what else you want to do with it. I've uploaded a worksheet with a few simple examples. View 86_PolyhedraExample.mw on MapleNet or Download 86_PolyhedraExample.mw
View file details

Maple Equation

The last point I would make about the dice problem; is to mention a way to graph the probabilities ... as n increases.

Given that the following function determines the probability of all faces being shown when n dice are rolled (from previous work):

> P := n -> 1 - ((add((-1)^(k+1)*binomial(6,k)*(6-k)^n,k=1..5))/(6^n));

Could some one help me to plot this population balance equation ? see the attached file Download 4968_PBE.doc
View file details

Let's continue on with the dice example; determining the probability of all faces showing when n dice are thrown.   We estimated this by running a simulation in maple; and comparing the frequency of successes to the total number of experiments.

There is a way to determine the probability without running trials. The problem can be solved combinatorially.

One way to determine the probability of all faces shown; is to determine the the probability that all faces are NOT shown (call this probability B). Then the probability that all faces are shown = 1 - B.

I've been asked: how do I include a mathematical expression in a plot caption without having it evaluate? An example is displaying 2(x+y) in the caption without having it appear as 2x+2y. The easiest way to do this is to create an atomic identifier from the expression in the input line. In the 2-D input line, you'll have plot(..., caption=2(x+y)). Select 2(x+y) and right-click to bring up the context menu. Then go to 2-D Math -> Convert To -> Atomic Identifier. This turns the expression into a single name. Note that it is no longer equivalent to the expression 2(x+y), even though it looks exactly like it.
Let's take another look at the dice rolling example:

Simulate rolling 8 dice 10 times.

roll := rand(1..6);
for i from 1 to 10 do;
dice := ['roll()' $8]; # dice contains 8 random values, each from 1..6
end do;

Let's say you want to check the list "dice" to see if all faces are
represented.

One way to do this is to write a proc which creates an array indexed
1..6; and initialize the array to zero; and then check the dice list ...
incrementing the associated array index for each value in the dice list.
Finally ... check the built array to see if all index values are non-zero.
A note added: Although the coding below is correct, it has clearly been superseeded by the following two entries contributed by acer: Entry 1 and Entry 2. As in any fairytale (even though this blog of mine certainly is not) it takes three of something (at least according to the fairytales of my fellow-countryman H. C. Andersen). Todays entry is the third and last (at least for now) in a row of three consecutive ones dealing with manipulations of indices of Arrays. The other two entries are Tip: Index an Array and Tip: Permute the indices of an Array.
First 51 52 53 54 55 56 57 Last Page 53 of 66