1 | initial version |
In complement to @tmonteil 's answer, note that SymPy can be used as the symbolic backend for computations on manifolds:
sage: M = Manifold(2, 'M')
sage: X.<x,y> = M.chart()
sage: M.set_calculus_method('sympy')
sage: f = M.scalar_field(y*x^3)
sage: df = diff(f)
sage: df.display()
3*x**2*y dx + x**3 dy
sage: df[0].expr()
3*x**2*y
sage: type(df[0].expr())
<class 'sympy.core.mul.Mul'>
Back to Sage's default symbolic backend (SR
):
sage: M.set_calculus_method('SR')
sage: w = df*df
sage: w.display()
9*x^4*y^2 dx⊗dx + 3*x^5*y dx⊗dy + 3*x^5*y dy⊗dx + x^6 dy⊗dy
sage: w[0,0].expr()
9*x^4*y^2
sage: type(w[0,0].expr())
<class 'sage.symbolic.expression.Expression'>