Access Maple kernel.
Syntax
r = maple('statement')
r = maple('function',arg1,arg2,...)
[r, status] = maple(...)
maple('traceon') or maple trace on
maple('traceoff') or maple trace off
Description
maple('statement')
sends statement
to the Maple kernel and returns the result. A semicolon for the Maple syntax is appended to statement
if necessary.
maple('function',arg1,arg2,...)
accepts the quoted name of any Maple function and associated input arguments. The arguments are converted to symbolic expressions if necessary, and function
is then called with the given arguments. If the input arguments are sym
s, then maple
returns a sym
. Otherwise, it returns a result of class char
.
[r,status] = maple(...)
is an option that returns the warning/error status. When the statement execution is successful, r
is the result and status
is 0
. If the execution fails, r
is the corresponding warning/error message, and status
is a positive integer.
maple('traceon')
(or maple trace on
) causes all subsequent Maple statements and results to be printed. maple('traceoff')
(or maple trace off
) turns this feature off.
Examples
Each of the following statements evaluate to 100 digits:
maple('evalf(Pi,100)')
maple evalf Pi 100
maple('evalf','Pi',100)
The statement
[result,status] = maple('BesselK',4.3)
returns the following output because Maple's BesselK
function needs two input arguments:
result =
Error, (in BesselK) invalid arguments
status =
2
The traceon
command shows how Symbolic Math Toolbox commands interact with Maple. For example, the statements
syms x
v = [x^2-1;x^2-4]
maple traceon % or maple trace on
w = factor(v)
return
v =
[x^2-1]
[x^2-4]
statement =
map(ifactor,array([[x^2-1],[x^2-4]]));
result =
Error, (in ifactor) invalid arguments
statement =
map(factor,array([[x^2-1],[x^2-4]]));
result =
MATRIX([[(x-1)*(x+1)], [(x-2)*(x+2)]])
w =
[(x-1)*(x+1)]
[(x-2)*(x+2)]
This example reveals that the factor
statement first invokes Maple's integer factor (ifactor
) statement to determine whether the argument is a factorable integer. If Maple's integer factor statement returns an error, the Symbolic Math Toolbox factor
statement then invokes Maple's expression factoring statement.
See Also
mhelp
, procread
[ Previous | Help Desk | Next ]