Products & Services Solutions Academia Support User Community Company

Learn more about Symbolic Math Toolbox   

Using Maple and MuPAD Engines

Choosing a Maple or MuPAD Engine

You can use a Maple engine with Symbolic Math Toolbox software instead of the default MuPAD engine. You must have a compatible version of Maple software, available from Maplesoft®, installed on your computer. Contact http://www.maplesoft.com/ to find which versions of Maple software work with Symbolic Math Toolbox software.

To choose a Maple engine:

  1. Enter

    symengine

    at the MATLAB command line to display the following GUI.

  2. • To use a Maple engine, click the Maple button, then the Maple Location button, and navigate to your computer's Maple installation directory.

    To determine this directory:

    1. Launch or switch to Maple.

    2. Enter the command

      kernelopts(mapledir);

      at the Maple prompt.

    • To use a MuPAD engine, click the MuPAD button.

  3. Clear all symbolic variables if you change engines while using Symbolic Math Toolbox software. Do this by entering the clear command, or syms variable–list.

Differences in Maple and MuPAD Syntax

Prior to Version 5 of Symbolic Math Toolbox, Extended Symbolic Math Toolbox™ software supported calling the Maple engine from the MATLAB workspace with the maple and procread functions. Symbolic Math Toolbox software now uses the MuPAD engine by default, and uses the evalin(symengine,...) and feval(symengine,...) functions to access the MuPAD engine from the MATLAB workspace.

The maple Function and MuPAD Calls

The maple function is equivalent to one of three MuPAD calls, depending on its syntax:

Maple Engine SyntaxMuPAD Engine Syntax
maple(command)evalin(symengine,'command')
maple('function',arg1,arg2,...)feval(symengine, 'function', arg1, arg2,...)
maple restartreset(symengine)

The procread Function and evalin Calls

The procread function, used with a Maple engine, is equivalent to an appropriate evalin(symengine,...) method for a MuPAD engine. The evalin call should contain a command to read the code, as shown in the table below.

The following table contains an example in both Maple and MuPAD syntax.

Example of procread and evalin Calls
procread for Maple Engineevalin for MuPAD Engine
procread('check.src')

The check.src file contains the following code in Maple syntax:

check := proc(A)
     # check(A) computes A*inverse(A)
     local X;
     X := inverse(A):
     evalm(A &* X);
end;
evalin(symengine,'read("check.mu")')

Note that the " in the evalin call are double-quote characters, not two single-quote characters.

The check.mu file contains the following code in MuPAD syntax:

check := proc(A)
     // check(A) computes A*inverse(A)
     local X;
begin
     X := 1/A;
     A * X;
end_proc:

mhelp Calls and the doc(symengine) method

The Maple engine mhelp function displays help about Maple functions to the command line. The equivalent MuPAD function is the doc method of the object returned by symengine. The doc method opens MuPAD Help to the specified function. This table shows the differences in syntax.

Maple SyntaxMuPAD Syntax
mhelp intdoc(symengine,'int')
mhelp convertdoc(symengine,'rewrite')

The table uses the equivalence of the Maple function convert and the MuPAD function rewrite. To find the differing syntax between the two engines, see Maple and MuPAD Syntax and Maple and MuPAD Library Calls.

Maple and MuPAD Syntax

The following table lists common tasks (meaning functions or procedures) that have differences between Maple and MuPAD syntax. Blank entries in the table mean the task is not explicitly supported. Optional arguments are enclosed in angle brackets < >.

TaskMaple SyntaxMuPAD Syntax
Comment#comment// one-line comment
/* multi-line
comment */
Previous results%, %%, %%%%, %1, %2
Timings:=time(); cmd1;...;cmdN; time()-stime(), time(cmd1,...,cmdN)
Matrices<1,2;3,4>matrix([[1,2],[3,4]])
Appending[op(x), a, b, ...]append(x, a, b, ...)
Concatenating lists[op(x),op(y)]x.y, [op(x),op(y)]
Sequencesi^2$i=1..5 or seq(i^2,i=1..5)i^2$i=1..5
seq(f, i = m..n, e)f(i) $ i = m..n step e
Typeswhattype(expr)type(expr), domtype(expr)
Testing typestype(expr,type)testtype(expr,type)
Operand queriesop(n,expr), n >= 0op(expr,n), n >= 0
Clearing variablesx := 'x'delete x
Namespacesx[y], :-x::y
Employing packagewithuse
String/name concatenationx || 10x . 10
For loopsfor i from 6 by 2 to 100 do body end do;for i from 6 to 100 step 2 do body end_for
for x in obj do body; end dofor x in obj do body; end_for
While loopswhile i < 100 do i := i+10; end dowhile i < 100 do i := i+10; end_while
Repeat repeat body until cond end_repeat
If/then/elseif b then x end ifif b then x end_if
Trapping errorstraperror(stmt)traperror(stmt, <T>, <MaxSteps>)
Try/catchtry stmt; catch string:stmt; finally stmt end 
Procedure definitionf:=proc(x) local n; body; end;f:=proc(x) local n; begin body; end_proc;
Non-commuting multiplication&* (& is neutral-op) or A . Bdomain overload of *

Maple and MuPAD Library Calls

The following table lists tasks that require different library function calls in Maple syntax and MuPAD syntax. Blank entries in the table mean the call is not explicitly supported. Optional arguments are enclosed in angle brackets < >.

TaskMaple SyntaxMuPAD Syntax
Reading dataread(filename)read(filename, <Quiet>, <Plain>)
Opening filesopen(name,mode)fopen(filename | TempFile,<Read | Write | Append>, <Bin | Text | Raw>)
Displaying resultsprint(e1, e2, ... )print(<Unquoted>, <NoNL>, <KeepOrder>, <Typeset>, object1, object2, ...)
Substitutingsubs(x=a,f)subs(f, x=a, <unsimplified>)
Limitslimit(f, x=a, <left | right | real | complex>)limit(f, x=a, <Left | Right | Real>, <Intervals>)
Mappingmap(f, expr, arg1, arg2, ...)map(expr, f, <arg1, arg2, ...>, <Unsimplified>)
Logarithmslog(x)ln(x)
Some special functionsAiryAi(n,z)airyAi(z,n)
argument(z)arg(z)
dirac(n,x), dirac([n1..nk],[x1..xk])dirac(x,n)
EllipticK(z)
different norm
EllipticK(z)
EllipticPi(z,nu,k)
different norm
EllipticPi(m,phi,n)
 
FresnelC(x)
different norm
fresnelC(x) 
GAMMA(x)gamma(x) 
GAMMA(a,x)igamma(a,x) 
lnGAMMA(x)lngamma(x) 
Heaviside(t)heaviside(x) 
JacobiAM(z,k)
different norm
jacobiAM(u,m) 
Tensor[KroneckerDelta](m,n)kroneckerDelta(m,n) 
Psi(n,x)psi(x,n) 
Wrightomega(x)wrightOmega(x) 
Factorialsn! or factorial(n)n! or fact(n) 
Integralsint(f, x = a..b)int(f, x = a..b, <PrincipalValue>) 
Taylor seriestaylor(f, x=a, n)taylor(f, x = x0, <order>, <mode>, <NoWarning>) 
Coefficientscoeffs(p, x, 't'), coeff(p, x, n)coeffs(f, <vars>, <x>, n) 
Simplifying basicsimplify(f)Simplify(f, <Steps>), simplify(f) 
Simplifying to a targetsimplify(f, <symbolic>, <assume=prop>, n1, n2, ...)simplify(f,target), target = cos, sin, exp, ln, sqrt, unit, logic, condition, or relation 
Simplifying specialsimplify[radical]radsimp 
Combiningcombine(f, n, opt1, opt2, ...)combine(f, <[target1, target2, ...]>) 
Rewritingconvert(expr, form)rewrite(expr, func) 
Collectingcollect(f, x, <form>, <func>)collect(f, x, <f>) 
Factoringfactor(a, K)factor(f, <Adjoin = adjoin>, <MaxDegree = n>) 
Finding free variables (indeterminates)indets(expr, <typename>)freeIndets(expr) 
Solving equationssolve(equations, variables)solve(system, vars, <options>) 
Solving ODEsdsolve({ODE, ICs}, y(x), options)solve(ODE) 
Solving recurrencesrsolve(eqns,fcns)solve(REC) 
Finding discontinuitiesdiscont(f,x)discont(f, x = a .. b, <Undefined>) 
Making assumptionsassume(x,real)assume(x,R_) 
Listing propertiesabout(x)getprop(x) 
Evaluating numericallyevalf(expr)float(expr) 
Evaluating Boolean evalb(expr)bool(expr) 
Evaluating matrixevalm(a+b), evalm(x.b)a+b, a*b matrices a,b 
Parsing stringparse(string,options)text2expr(string) 
Showing codeprint(f)expose(f) 
Leading termslcoefflcoeff(p), lterm(p) 
Partial fractionsconvert(expr, parfrac)partfrac(f) 
Plotting 2-Dplot(f,x=x0..x1)plot(f1,f2,..., x=x0..x1), plotfunc2d(f1,f2,..., x=x0..x1) 
Plotting 3-Dplot3d(f, x=a..b, y=c..d)plotfunc3d(f1,f2,..., x=x0..x1, y=y0..y1) 
Pseudo divisionPrem(p,q)pdivide(p,q) 
Splitting objectsselectremovesplit(obj,f) 

Maple and MuPAD Constants

The following table lists the constants and global symbols that differ between Maple syntax and MuPAD syntax.

SymbolMaple SyntaxMuPAD Syntax
Catalan numberCatalanCATALAN
Digits of precision for floatsDigitsDIGITS
Euler's gamma constantgammaEULER
Library locationslibnameLIBPATH, READPATH, PACKAGEPATH
Empty sequenceNULLnull()
Default number of termsOrderORDER
π = 3.14159...PiPI
Three-state Boolean logic valuesTrue/False/FAILTRUE/FALSE/UNKNOWN

Differences in Functionality When Using MuPAD and Maple Engines

The following Symbolic Math Toolbox functions introduced in the toolbox version 4.9 require that you run a MuPAD engine:

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

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