1 | initial version |
You can also use the Euclidean space.
E.<x,y> = EuclideanSpace()
cartesian = E.default_chart()
polar.<r,ph> = E.polar_coordinates()
Coframes
$$\left[\left(\mathbb{E}^{2}, \left(\mathrm{d} x,\mathrm{d} y\right)\right), \left(\mathbb{E}^{2}, \left(\mathrm{d} r,\mathrm{d} {\phi}\right)\right), \left(\mathbb{E}^{2}, \left(e^{ r },e^{ {\phi} }\right)\right)\right].$$
Thus
dph = E.coframes()[1][2]
dph.display(polar)
$$\mathrm{d} {\phi} = \mathrm{d} {\phi},$$
and
dph.display(cartesian)
$$\mathrm{d} {\phi} = \left( -\frac{y}{x^{2} + y^{2}} \right) \mathrm{d} x + \left( \frac{x}{x^{2} + y^{2}} \right) \mathrm{d} y.$$
Or
dph.apply_map(lambda h:h.subs({x^2+y^2:r^2}))
dph.display(cartesian)
$$\mathrm{d} {\phi} = -\frac{y}{r^{2}} \mathrm{d} x + \frac{x}{r^{2}} \mathrm{d} y.$$