Extended Symbolic Math Toolbox™ Software

Packages of Library Functions

Extended Symbolic Math Toolbox™ software allows you to access all nongraphics Maple® packages, Maple programming features, and Maple procedures. Extended Symbolic Math Toolbox software thus provides access to a large body of mathematical software written in the Maple language.

Maple programming features include looping (for ... do ... od, while ... do ... od) and conditionals (if ... elif ... else ... fi). See The Maple Handbook for information on how to use these and other features.

You can access specialized libraries, or "packages," with the Extended Symbolic Math Toolbox software. The available packages are listed in Maple® Packages.

You can use the Maple with command to load these packages. For example, if you want to use the orthogonal polynomials package, first get the Maple name of this package, using the statement

mhelp index[packages]

which returns

Index of descriptions for packages of library functions

Description:
- The following packages are available: 
    ...
    orthopoly   orthogonal polynomials 
    ...

You can then can access information about the package orthopoly by entering

mhelp orthopoly

To load the package, type

maple('with(orthopoly);')

This returns

ans =
[G, H, L, P, T, U]

which is a listing of function names in the orthopoly package. These functions are now loaded in the Maple workspace, and you can use them as you would any regular Maple function.

Maple® Packages

Extended Symbolic Math Toolbox software contains the following packages of Maple functions:

Procedure Example

The following example shows how you can access a Maple procedure through Extended Symbolic Math Toolbox software. The example computes either symbolic or variable-precision numeric approximations to , using a method derived by Richard Brent based from the arithmetic-geometric mean algorithm of Gauss. Here is the Maple source code:

pie := proc(n)
  # pie(n) takes n steps of an arithmetic–geometric mean
  # algorithm for computing pi. The result is a symbolic
  # expression whose length roughly doubles with each step.
  # The number of correct digits in the evaluated string also
  # roughly doubles with each step.

  # Example: pie(5) is a symbolic expression with 1167
  # characters which, when evaluated, agrees with pi to 84
  # decimal digits.

  local a,b,c,d,k,t;

  a := 1:
  b := sqrt(1/2):
  c := 1/4:
  t := 1:

  for k from 1 to n do
     d := (b-a)/2:
     b := sqrt(a*b):
     a := a+d:
     c := c-t*d^2:
     t := 2*t:
  od;

  (a+b)^2/(4*c):

end;

Copy the source code and paste it into the MATLAB® Editor. Then save the file as pie.src in your Work directory. Using Extended Symbolic Math Toolbox software, the MATLAB statement

procread('pie.src')

reads the specified file, deletes comments and newline characters, and sends the resulting string to Maple software. (The MATLAB ans variable then contains a string representation of the pie.src file.)

You can access the pie function using the maple function. The statement

p = maple('pie',5)

returns a string representing the solution that begins and ends with

p = 
1/4*(1/32+1/64*2^(1/2)+1/32*2^(3/4)+ ... 
     ... *2^(1/2))*2^(3/4))^(1/2))^(1/2))^2)

You can use the sym command to convert the string to a symbolic object.

The assignment to the variable b in the second executable line,

b := sqrt(1/2)

causes the entire computation to be done symbolically. You can change the computation from symbolic to numeric by modifying the assignment statement to include decimal points:

b := sqrt(1./2.)

With this assignment, the entire computation uses variable-precision arithmetic at the current setting of digits. The commands

digits(100) 
procread('pie.src') 
p = maple('pie',5)

produce a 100-digit result:

p =
3.14159265358979323 ... 5628703211672038

The last 16 digits differ from those of because, with five iterations, the algorithm gives only 84 digits.

Note that you can define your own MATLAB M-file that accesses a Maple procedure:

function p = pie1(n) 
p = maple('pie',n)

Additional References

For additional information, consult these references.

[1] Schwarz, David, Introduction to Maple, Apprentice Hall, 1999.

[2] Graven, Frank, The Maple Book, Chapman & Hall/CRC, 2001.

[3] Wright, Francis, Computing with Maple, Chapman & Hall/CRC, 2001.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS