Product Tips & Techniques

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

So you think you really want to know what Maple does? Are you really sure? Well, here is how old-timers do it. [I do not claim that this is either the best or the modern way to do it, just that this is how people with over 10 years of Maple experience do it].

I want to use dsolve (Maple 10) to iteratively solve two systems of ODEs adjusting the boundary conditions until the solutions match at a fitting point. My problem is that the output of dsolve is a set of functions, and, each time dsolve is called, the solutions might not be reported in the same order as the last time dsolve was called. This makes it difficult to write a routine that compares the results of each iteration. I would appreciate any advice on how to extract the solutions from the dsolve output. Thanks. Glenn
A few years ago I saw somewhere in a math forum a brain-teaser type problem which I'm about to present. I wasn't able to solve it at the time. I haven't been able to find the original forum, so I don't know whether or not my answer is right. I do know that I could never have attacked the problem without MAPLE. We have a cube of edge a and a drill bit of diameter b. We drill one hole from the center of the front face to the center of the back face, and another from the center of the right face to the center of the left. What is the total volume of material removed? I get (Pi*(b^2)*a)/2 - ((2/3)*b^3) Am I right?
Playing with numerics for the hypergeometric function 2F1 i stumbled into the following exactness stuff, where lots of digits are lost and one needs to increase working precision quite a lot to get a good answer: f1 and f2 result from evaluating ugly, but usual transcendent functions, f3 comes through high precision and f0 is the limiting case.
  restart;
  
  hypergeom([1,2+epsilon],[3],z): 
  '%' = simplify(convert(%,StandardFunctions));
  theSol1:=rhs(%): 
  
  theSol1 = -2*(z*(1-z)^epsilon*epsilon-1+(1-z)^epsilon)/
    z^2/((1-z)^epsilon)/epsilon/(1+epsilon);
  is(%);
Maple, Mathematica, and many other CAS define indefinite integral up to piecewise constants. That means, in particular, that the integral of a continuous function can be discontinuous. In many cases that can be easily fixed, such as for integrals involving floor(x) and frac(x). However, it has not been done neither in Maple nor in Mathematica. Here is another example, suggested by David W. Cantrell
int(1/(2+cos(x)),x);

               2/3*3^(1/2)*arctan(1/3*tan(1/2*x)*3^(1/2))
MathWorld: the web's most extensive mathematics resource. Created, developed, & nurtured by Eric Weisstein with contributions from the world's mathematical community.
The server time seems to be (at least) 5 minutes off. Alec
p >Hello. I'm still kind of new to the practice of using a computer program to manipulate equations. I knew that one way to define an ellipse is as the locus of points P such that for 2 fixed points F1 and F2 the sum PF1 + PF2 is constant. I also know that in Cartesian coordinates, we get a formula of the form Ax2 + By2 = 1. If we set up our coordinate system such that F1 and F2 are on the x axis each a distance c from the origin and the maximum width of the ellipse is 2a, let's try to figure out A and B using MAPLE.

> Maple Equation

The following equation cannot be plotted correctly in the usual 3 dimensional plot with Cartesian coordinates. eq := (x^2+y^2+z^2-1)^3 - x^2*z*3 - y^2*z^3 = 0; Either a 3 dimensional implicit plot, or a spherical coordinates plot is needed. What surprised me was how long Maple 10.06 took to produce the latter with very roughly the same amount of detail as the former: 454 s versus 0.7 s. It seems as though one should always prefer the implicit plot to the spherical plot if the 3 dimensional Cartesian plot fails. I would be grateful for any thoughts about this and any improvements to the code below. (Apologies for not posting the worksheet – I think that File Manager might object to its 10MB size!)
Occasionally Maple does not make me happy, if I want numerical integrals with more than the 14 digits which are supplied through the NAG libraries - that may be rather slow. So I wrote my own solution using LCC-WIN32 (a (free) compiler system allowing 104 decimal points of precision), where I coded the double exponential integration method. That gives me what I want to have in reasonable time. Details are sketched in the uploaded zip-file (it contains all what is needed to run the stuff). Some draw-back: this is for Windows only and because of OpenMaple at least Maple 9 is need.
Pari is a C library mainly for Number Theory, but it has excellent numerics, both real and complex case and with arbitrary precision. As it seems not to use much symbolics for that it is quite fast. This can be useful for some special functions or integration, see the appended example worksheets (and may be Linear Algebra a bit later these days).
I did that for matrix inversion:

Here is some stuff for doing that by calling Maple from Excel. The reason
is that one could care for extreme cases, where a really good precision
is needed. I included an example how to switch to rationals, where the
inversion can even be done exactly (do not use it for dimensions to high
and then it would be better to do it solely in Maple + cut&paste).
From time to time people ask on this site or elsewhere whether modules in Maple can be used the same way as objects in object oriented languages. The answer is yes and no. Yes - because OOP behavior can be simulated with modules - certainly not with full blown functionality, but still. No - because that is usually not the best way to do things in Maple. Here is an example of creating a type and an 'object' exploring it, with few 'methods'.
Recently, working on Nested Verification, I took a look at the whattype procedure. First, I couldn't find any use of local variables t1, t2, L, k1, k2 declared in it. That seems odd. Second, the order of types in it seems to be not exactly right. In particular, symbol is located earlier than `module`. Also, some types are missing, record for example. That leads to not recognizing modules and records,
r := Record( 'a', 'b' ):
m := module() end:
whattype(r);
                                symbol
whattype(m);
                                symbol
Similarly to the compact and efficient version of Nested Verification, I wrote a "compact and efficient" version of whattype,

Nested verification can be done in Maple using the following command,

VerifyTools:-AddVerification('nested'=proc(x,y,ver::verification)
if whattype(x)=whattype(y) then 
if x::Vector then verify(x,y,'Vector'('nested'(args[3..-1])))
elif x::Matrix then verify(x,y,'Matrix'('nested'(args[3..-1])))
elif x::Array then verify(x,y,'Array'('nested'(args[3..-1])))
elif x::array then verify(x,y,'array'('nested'(args[3..-1])))
elif x::set then verify(x,y,'set'('nested'(args[3..-1])))
elif x::list then verify(x,y,'list'('nested'(args[3..-1])))
elif x::relation then verify(x,y,'relation'('nested'(args[3..-1]))) 
elif x::range then verify(x,y,'range'('nested'(args[3..-1]))) 
else verify(x,y,args[3..-1]) fi 
else verify(x,y,args[3..-1])
fi end);
First 54 55 56 57 58 59 60 Last Page 56 of 64