Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

What is sage equivalent to Pow in Sympy?

I am translating sympy function to use under sagemath

In sympy there is type Pow

>>> from import x
>>> type(x**2)
<class 'sympy.core.power.Pow'>
>>> isinstance(x**2,Pow)

In sagemath

sage: var('x')
sage: type(x^2)
<type 'sage.symbolic.expression.Expression'>
sage: isinstance(x^2,Pow)
NameError                                 Traceback (most recent call last)
<ipython-input-15-0e5e926fd38c> in <module>()
----> 1 isinstance(x**Integer(2),Pow)

NameError: name 'Pow' is not defined

How to check in sagemath if expression is type Power? i.e. something raised to power? fyi, in Maple this is given by type ^ also.