__add__compute sum including Expression__mul__compute product including Expression__pow__compute power including Expression__sub__compute difference including Expression__floordiv__compute floor division including Expression__truediv__compute true division including Expression__mod__compute modulus of Expression__radd__compute sum including Expression from the right__rmul__compute product including Expression from the right__rsub__compute difference including Expression from the right__rpow__compute power including Expression from the right__rfloordiv__compute floor division including Expression from the right__rtruediv__compute true division including Expression from the right__rmod__compute modulus of Expression from the right
Calling SequenceParametersDescriptionExamples
<Text-field style="Heading 2" layout="Heading 2" bookmark="usage">Calling Sequence</Text-field>
x.__add__(y)
x + y
x.__mul__(y)
x y
x.__pow__(y)
x y
x.__sub__(y)
x - y
x.__floordiv__(y)
floordiv(x, y)
x.__truediv__(y)
truediv(x, y)
x.__mod__(y)
x mod y
x.__radd__(y)
y + x
x.__rmul__(y)
y x
x.__rpow__(y)
y x
x.__rsub__(y)
y - x
x.__rfloordiv__(y)
rfloordiv(x, y)
x.__rtruediv__(y)
rtruediv(x, y)
x.__rmod__(y)
<Text-field style="Heading 2" layout="Heading 2" bookmark="bkmrk0">Parameters</Text-field>x-Expression objecty-numeric or Expression object
<Text-field style="Heading 2" layout="Heading 2" bookmark="info">Description</Text-field>
__add__ returns the sum of x and y.
This function can also be called by simply entering x + y.
__mul__ returns the product of x and y.
This function can also be called by simply entering x * y.
__pow__ returns x to the power of y.
This function can also be called by simply entering x ** y.
__sub__ returns the difference of x and y.
This function can also be called by simply entering x - y.
__floordiv__ returns the remainder of x divided by y.
This function can also be called by simply entering x // y.
__truediv__ returns the remainder of x divided by y.
This function can also be called by simply entering x / y.
__mod__ returns x modulo y.
This function can also be called by simply entering x mod y.
__radd__ returns the sum of y and x.
This function can also be called by simply entering y + x.
__rmul__ returns the product of y and x.
This function can also be called by simply entering y * x.
__rpow__ returns y to the power of y
This function can also be called by simply entering y ** x.
__rsub__ returns the difference of y and x.
This function can also be called by simply entering y - x.
__rfloordiv__ returns the remainder of y divided by x.
This function can also be called by simply entering y // x.
__rtruediv__ returns the remainder of x divided by y.
This function can also be called by simply entering y / x.
__rmod__ returns y modulo x.
This function can also be called by simply entering y mod x.
<Text-field style="Heading 2" layout="Heading 2" bookmark="examples">Examples</Text-field>
The following interactive session illustrates the use of these operators:
>>> import maple>>> import maple.namespace>>> x = maple.namespace.x>>> # It is most natural to use these as infix operators>>> x + 2x+2>>> x 22x>>> 2 x2x>>> x - 2x-2>>> 2 - x2-x>>> x 2x^2>>> 2 xx^2>>> # They may, however, also be used with the expr.methodName syntax>>> x.__add__(2)x+2>>> x.__mul__(2)2x>>> x.__rmul__(2)2x>>> x.__sub__(2)x-2>>> x.__rsub__(2)2-x>>> x.__pow__(2)x^2>>> x.__rpow__(2)x^2
See AlsoOpenMapleOpenMaple/Python/APIOpenMaple/Python/Expression