EvalFunction - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Connectivity : Python : EvalFunction

Python

  

EvalFunction

  

evaluate a Python function

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

EvalFunction(f,arg1,arg2,...)

EvalFunction(f,arg1,arg2,...,opts)

Parameters

f

-

string or Python object

argN

-

(optional); arguments to the function call

opts

-

(optional) zero or more options as specified below

Options

• 

output = one of maple,python, or none

  

Specifies the output the evaluation should produce.

• 

By default the value returned is converted into a Maple data structure. If no conversion is available, the return value will be an expression of type python, a Python object reference that can be used in subsequent calls to Python.

  

To avoid Maple conversions of the return value and always get a Python object, use the option, output=python.

  

To avoid all conversions, and omit the return value, use the option, output=none.

• 

If you have a callable python object, f, you can use ordinary Maple function syntax to call it f(a,b,c).

Description

• 

The EvalFunction command executes a function, f(arg1,arg2,...) using the Python interpreter.

• 

For information about controlling the output and automatic conversions to Maple data structures, see the documentation for the output option.

• 

This function is part of the Python package, so it can be used in the short form EvalFunction(..) only after executing the command with(Python). However, it can always be accessed through the long form of the command by using Python[EvalFunction](..).

Examples

withPython:

ImportModulemath

EvalFunctionmath.sin,1.0

0.841470984807897

(1)

mathsinEvalStringmath.sin

mathsin<Python object: <built-in function sin>>

(2)

mathsin1.0

0.841470984807897

(3)

rEvalFunctionmath.sin&comma;1.0&comma;output=python

r<Python object: 0.8414709848078965>

(4)

EvalFunctionabs&comma;r

0.841470984807897

(5)

Compatibility

• 

The Python[EvalFunction] command was introduced in Maple 2018.

• 

For more information on Maple 2018 changes, see Updates in Maple 2018.

See Also

Python

Python:-EvalString

type/python