OpenMaple Application Program Interface (API) for Python
Python Maple provides an interface between the Maple evaluation engine and a Python program. This is implemented using Python classes and Python interfaces. The classes allow Python programs to access the Maple evaluation engine. The interfaces allow the Maple evaluation engine to call Python functions.
Overview
maple.namespace Subpackage
Classes
To use the Maple API for Python, start by importing the library maple. This implicitly launches a Maple session.
import maple
To access Maple variables and predefined functions and commands, you can use the symbol or symbols function or import the maple.namespace interface:
The symbol function returns an Expression object.
The symbols function returns a tuple of Expression objects.
The namespace subpackage
The maple.namespace subpackage allows any Maple variable or function to be accessed with a simple prefix.
The following classes are automatically applied to Maple objects created in a session. All objects are instances of the parent class Expression.
Class Listing
ComplexNumeric
Expression
Indexable
List
Name
RealNumeric
RTable
Set
Table
The Expression class is the parent class of all the classes that represent Maple objects. Its member functions provide access to all the basic functions that can be performed on a Maple expression.
__abs__
__add__
__call__
__ceil__
__eq__
__floor__
__floordiv__
__ge__
__getitem__
__gt__
__hash__
__le__
__len__
__lt__
__mul__
__ne__
__neg__
__pow__
__radd__
__rfloordiv__
__rmod__
__rmul__
__round__
__rpow__
__rsub__
__rtruediv__
__sub__
__truediv__
__trunc__
eval
The RealNumeric class represents numeric object. Note that Maple integers and fractions are implicitly translated to Python integers and Fractions.fraction objects, so this class is only used for floating-point numbers.
The ComplexNumeric class represents complex numbers. Conceptually, a ComplexNumeric object contains two RealNumeric objects: its real part and its imaginary part.
conjugate
imag
real
The Name class represents a Maple name. Name publicly inherits from Expression.
__getattr__
assign
The Indexable class is the parent class of all the classes that represent Maple collections. Its member functions provide access to the basic functions that can be performed on a collection, such as querying its size and testing for membership.
__contains__
__iter__
The RTable class represents an rtable. Datatype specific rtables are represented by sub-classes of RTable. These sub-classes have datatype specific functions. The RTable member functions perform operations applicable to any rtable.
The Table class represents a table. Data can be inserted and removed from the table and a table can be searched for a particular element.
See Also
Python
Download Help Document