Symbolic Math Toolbox    

Simple Example

As an example, you can use the Maple function gcd to calculate the greatest common divisor of two integers or two polynomials. For example, to calculate the greatest common divisor of 14 and 21, enter

To calculate the greatest common divisor of x^2-y^2 and x^3-y^3 enter

To learn more about the function gcd, you can bring up its reference page by entering

As an alternative to typing the maple command every time you want to access gcd, you can write a simple M-file that does this for you. To do so, first create the M-file gcd in the subdirectory toolbox/symbolic/@sym of the directory where MATLAB is installed, and include the following commands in the M-file:

If you run this file

you get

Now, extend the function so that you can take the gcd of two matrices in a pointwise fashion:

Running this on some test data

you get the result


  Using Maple Functions Vectorized Example 

Learn more about the latest releases of MathWorks products:

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