Product Tips & Techniques

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

We have just released a small update to MapleSim.  MapleSim 2016.2a is an update to MapleSim 2016.2 that includes improvements in several areas, including corrections to problems related to custom components and importing Modelica libraries. As usual, we recommend that every MapleSim customer install all available updates.  The update is availble through Help>Check for Updates and as a download from our website.  See MapleSim 2016.2a for details.

eithne

Let us consider 

restart; 
MultiSeries:-limit(sin(n)/n, n = infinity, complex);
0

The answer is wrong: in view of the Casorati-Weierstrass theorem the limit does not exist. Let us try another limit command of Maple

limit(sin(n)/n, n = infinity, complex);


(lim) (sin(n))/(n)

which fails. Therefore, Maple user does not obtain the correct answer. 

We have just released an update to Maple.  It includes updates to the Maple Workbook, the video component, the Physics package, and many other small improvements throughout the product. It is available through Tools>Check for Updates in Maple, and is also available from our website on the Maple 2016.2 download page.

eithne

We have just released a major update to MapleSim and the MapleSim family of products. This update includes significant enhancements in the areas of model development and toolchain connectivity, including:

  • Live simulations let you see results as the simulation is running, so you can track progress and react to problems immediately.
  • A new 3-D overlay option lets you easily compare simulation visualizations by overlaying one visualization on top of another
  • Tools for revision control enable a structured approach to managing and tracking changes to your model, making it easier to manage projects when multiple engineers are working on the same model and reducing development risk.
  • MapleSim now supports direct import of models created in other FMI-compatible software, providing even greater cross-tool compatibility and opportunities for co-simulation.
  • The MapleSim Connector, for connectivity with Simulink®, and the MapleSim Connector for FMI, for exporting MapleSim models to other FMI-compatible tools, have been expanded to allow you to explore simulation results involving exported MapleSim models from within MapleSim, even though the simulation was done in the target tool.

 

This update is being distributed through the automatic Check for Updates system, and is also available from our website. See the MapleSim 2016.2  downloads page for details on obtaining this update.

eithne

 

Let us consider 

with(Statistics);
U := RandomVariable(DiscreteUniform(-10, 10)):
V := RandomVariable(DiscreteUniform(-10, 10)):
Probability(U^2-V^2 <= 1/9, numeric);
  0.

, whereas a positive number greater than 1/21 is expected. 

 

Let us consider the example from Maple help to ?ProbabilityFunction (also see ?Geometric)

with(Statistics):
ProbabilityFunction(Geometric(1/3), 5);
                              32 /729
                             

Let us continue the investigation

ProbabilityFunction(Geometric(1/3), 5.1);
0.4215152817e-1
ProbabilityFunction(Geometric(1/3), 5.12);
0.4181109090e-1
ProbabilityFunction(Geometric(1/3), 51/10)
(32/2187)*2^(1/10)*3^(9/10)

whereas the result 0 is expected in all the three cases up to Wiki. I am aware of the line

"t-algebraic; point (assumed to be an integer)"

in the help. However, 

ProbabilityFunction(Geometric(1/3), -.5);
                               0

The same issue with the DiscreteUniform distribution. This bug lasts from  at least Maple 16. The question arises: may we trust Maple?

Let us consider

restart; Digits := 20; evalf(Int(abs(cos(1/t)), t = 0 .. 0.1e-1), 3);
   -0.639e-2

Pay your attention to the minus sign. Simply no words. Mma produces 0.006377.

evalf@Int.mw

Ian Thompson has written a new book, Understanding Maple.

I've been browsing through the book and am quite pleased with what I've read so far. As a small format paperback of just over 200 pages it packs in a considerable amount of useful information aimed at the new Maple user. It says, "At the time of writing the current version is Maple 2016."

The general scope and approach of the book is explained in its introduction, which can currently be previewed from the book's page on amazon.com. (Click on the image of the book's cover, to "Look inside", and then select "First Pages" in the "Book sections" tab in the left-panel.)

While not intended as a substitute for the Maple manuals (which, together, are naturally larger and more comprehensive) the book describes some of the big landscape of Maple, which I expect to help the new user. But it also explains how Maple is working at a lower level. Here are two phrases that stuck out: "This book takes a command driven, or programmatic, approach to Maple, with the focus on the language rather than the interface", followed closely by, "...the simple building blocks that make up the Maple language can be assembled to solve complex problems in an efficient way."

 

 

 

Let us consider 

Student[Precalculus]:-LimitTutor(sqrt(x), x = 2);

One expects a nice illustration of the result sqrt(2). But instead of that one reads "f(x) approaches 1.41 as x approaches 2". This is simply clueless and forms a wrong understanding of limits. It should also be noticed that all the entries (left, 2-sided, and right) produce the same animation. The same issue with other limits I tried, e.g.

Student[Precalculus]:-LimitTutor(sqrt(x), x = 1);

. I think this command should be completely rewritten or excluded from Maple. 

Let us look in RealDomain and then in the RealDomain:-solve command. One is addressed to the usual solve command. The commands of the RealDomain package are not still documented since Maple 7 when the package was introduced. There is a general description only 

  • By default, Maple performs computations under the assumption that the underlying number system is the complex field. The RealDomain package provides an environment in which computations are performed under the assumption that the basic underlying number system is the field of real numbers.
  • Results returned by procedures are postprocessed by discarding values containing any detectable non-real answers or replacing them with undefined where appropriate.

The above is not enough. Here is an example which confuses me: 

RealDomain:-solve(exp(I*x) = -1, AllSolutions);
NULL

though 

solve(exp(I*x) = -1, AllSolutions);
                         Pi (2 _Z1 + 1)

and 

RealDomain:-solve(exp(I*x) = -1);
                               Pi

I lie awake thinking about that. Maplesoft staff help me!

Let us consider 

Statistics:-Mode(Binomial(n, p));
                        floor((1 + n) p)

Up to Wiki, the output is not correct. Simply no words.


 

with(Statistics):````

X := Statistics:-RandomVariable(Normal(0, 1)):

PDF(sin(X), t)

piecewise(t <= -1, 0, t < 1, 2^(1/2)*exp(-(1/2)*arcsin(t)^2)/(Pi^(1/2)*(-t^2+1)^(1/2)), 1 <= t, 0)

(1)

int(%, t = -1 .. 1)

2*erf((1/4)*Pi*2^(1/2))

(2)

evalf(%)

1.767540069

(3)

``


There were recently submitted a dozen Maple bugs by me and others. Maplesoft have brought no responses. They keep strategic silence. True merit is not afraid of criticism.

Download Bug_in_Statistics_PDF.mw

Let us consider 

restart; J := int(cos(a*x)^2/(x^2-1), x = -infinity .. infinity, CPV);
-(1/4)*Pi*sin(2*a)*csgn(I*a)-(1/4)*Pi*sin(2*a)*csgn(I/a)

This result is not true for a=I:

eval(J, a = I);
                               0

In this case the integral under consideration diverges because of 

cos(I*x)^2;
                                
                            cosh(x) ^2

 

Let us consider 

maximize(int(exp(-x^4), x = k .. 3*k), location);

Error, (in maximize) invalid input: iscont expects its 1st argument, f, to be of type algebraic, but received x = k .. 3*k
whereas the expected output is 

[(2*((1/40)*GAMMA(1/4, (1/80)*ln(3))*5^(1/4)*ln(3)^(3/4)-(1/40)*GAMMA(1/4, (81/80)*ln(3))*5^(1/4)*ln(3)^(3/4)))*5^(3/4)*(1/ln(3))^(3/4), [k = (1/10)*10^(3/4)*ln(3)^(1/4)]]

as Mma 11 produces. The following 

RealDomain:-solve(diff(int(exp(-x^4), x = k .. 3*k), k));
  -(1/10)*5^(3/4)*ln(3)^(1/4), (1/10)*5^(3/4)*ln(3)^(1/4)

is not a workaround because of 

int(exp(-x^4), x = (1/10)*5^(3/4)*ln(3)^(1/4) .. (3/10)*5^(3/4)*ln(3)^(1/4));
  FAIL

 

First 14 15 16 17 18 19 20 Last Page 16 of 64