Curvilinear Coordinates

--> load("linearalgebra")$

1 Polar coordinates

Define the transformation for polar -> cartesian.
--> v: [r·cos(φ),r·sin(φ)];

\[\]\[\tag{} \left[ r \cos{\left( \phi \right) }\mathop{,}r \sin{\left( \phi \right) }\right] \]

Differentiate.
--> D: diff(v);

\[\]\[\tag{} \left[ \cos{\left( \phi \right) } \mathop{del}(r)\mathop{-}r \sin{\left( \phi \right) } \mathop{del}\left( \phi \right) \mathop{,}r \cos{\left( \phi \right) } \mathop{del}\left( \phi \right) \mathop{+}\sin{\left( \phi \right) } \mathop{del}(r)\right] \]

The dot product yields the square of the scale factor(s).
--> D . D;

\[\]\[\tag{%o4} {{\left( \cos{\left( \phi \right) } \mathop{del}(r)\mathop{-}r \sin{\left( \phi \right) } \mathop{del}\left( \phi \right) \right) }^{2}}\mathop{+}{{\left( r \cos{\left( \phi \right) } \mathop{del}\left( \phi \right) \mathop{+}\sin{\left( \phi \right) } \mathop{del}(r)\right) }^{2}}\]

--> trigsimp(D . D);

\[\]\[\tag{%o5} {{r}^{2}} {{\mathop{del}\left( \phi \right) }^{2}}\mathop{+}{{\mathop{del}(r)}^{2}}\]

for the transformation (r,φ) -> (x,y) one also has the Jacobian matrix J.
--> J: jacobian(v,[r,φ]);

\[\]\[\tag{} \begin{pmatrix}\cos{\left( \phi \right) } & \mathop{-}\left( r \sin{\left( \phi \right) }\right) \\ \sin{\left( \phi \right) } & r \cos{\left( \phi \right) }\end{pmatrix}\]

for (x,y) -> (r,φ), just invert J.
--> invert(J);

\[\]\[\tag{%o7} \begin{pmatrix}\frac{r \cos{\left( \phi \right) }}{r {{\sin{\left( \phi \right) }}^{2}}\mathop{+}r {{\cos{\left( \phi \right) }}^{2}}} & \frac{r \sin{\left( \phi \right) }}{r {{\sin{\left( \phi \right) }}^{2}}\mathop{+}r {{\cos{\left( \phi \right) }}^{2}}}\\ \mathop{-}\left( \frac{\sin{\left( \phi \right) }}{r {{\sin{\left( \phi \right) }}^{2}}\mathop{+}r {{\cos{\left( \phi \right) }}^{2}}}\right) & \frac{\cos{\left( \phi \right) }}{r {{\sin{\left( \phi \right) }}^{2}}\mathop{+}r {{\cos{\left( \phi \right) }}^{2}}}\end{pmatrix}\]

--> J_inv: trigsimp(invert(J));

\[\]\[\tag{\_ in} \begin{pmatrix}\cos{\left( \phi \right) } & \sin{\left( \phi \right) }\\ \mathop{-}\left( \frac{\sin{\left( \phi \right) }}{r}\right) & \frac{\cos{\left( \phi \right) }}{r}\end{pmatrix}\]

Extract the rows of the Jacobian inverse.
--> first(J_inv);

\[\]\[\tag{%o9} \left[ \cos{\left( \phi \right) }\mathop{,}\sin{\left( \phi \right) }\right] \]

--> second(J_inv);

\[\]\[\tag{%o10} \left[ \mathop{-}\left( \frac{\sin{\left( \phi \right) }}{r}\right) \mathop{,}\frac{\cos{\left( \phi \right) }}{r}\right] \]

2 Spherical coordinates

(r,θ,φ) -> (x,y,z):
--> w: r·[cos(φ)·sin(θ),sin(φ)·sin(θ),cos(θ)];

\[\]\[\tag{} \left[ r \sin{\left( \theta \right) } \cos{\left( \phi \right) }\mathop{,}r \sin{\left( \theta \right) } \sin{\left( \phi \right) }\mathop{,}r \cos{\left( \theta \right) }\right] \]

--> JW: jacobian(w,[r,θ,φ]);

\[\]\[\tag{} \begin{pmatrix}\sin{\left( \theta \right) } \cos{\left( \phi \right) } & r \cos{\left( \theta \right) } \cos{\left( \phi \right) } & \mathop{-}\left( r \sin{\left( \theta \right) } \sin{\left( \phi \right) }\right) \\ \sin{\left( \theta \right) } \sin{\left( \phi \right) } & r \cos{\left( \theta \right) } \sin{\left( \phi \right) } & r \sin{\left( \theta \right) } \cos{\left( \phi \right) }\\ \cos{\left( \theta \right) } & \mathop{-}\left( r \sin{\left( \theta \right) }\right) & 0\end{pmatrix}\]

--> invert(JW);

\[\]\[\tag{%o13} \begin{pmatrix}\frac{{{r}^{2}} {{\sin{\left( \theta \right) }}^{2}} \cos{\left( \phi \right) }}{\mathop{-}\left( r \sin{\left( \theta \right) } \sin{\left( \phi \right) } \left( \mathop{-}\left( r {{\sin{\left( \theta \right) }}^{2}} \sin{\left( \phi \right) }\right) \mathop{-}r {{\cos{\left( \theta \right) }}^{2}} \sin{\left( \phi \right) }\right) \right) \mathop{+}{{r}^{2}} {{\sin{\left( \theta \right) }}^{3}} {{\cos{\left( \phi \right) }}^{2}}\mathop{+}{{r}^{2}} {{\cos{\left( \theta \right) }}^{2}} \sin{\left( \theta \right) } {{\cos{\left( \phi \right) }}^{2}}} & \frac{{{r}^{2}} {{\sin{\left( \theta \right) }}^{2}} \sin{\left( \phi \right) }}{\mathop{-}\left( r \sin{\left( \theta \right) } \sin{\left( \phi \right) } \left( \mathop{-}\left( r {{\sin{\left( \theta \right) }}^{2}} \sin{\left( \phi \right) }\right) \mathop{-}r {{\cos{\left( \theta \right) }}^{2}} \sin{\left( \phi \right) }\right) \right) \mathop{+}{{r}^{2}} {{\sin{\left( \theta \right) }}^{3}} {{\cos{\left( \phi \right) }}^{2}}\mathop{+}{{r}^{2}} {{\cos{\left( \theta \right) }}^{2}} \sin{\left( \theta \right) } {{\cos{\left( \phi \right) }}^{2}}} & \frac{{{r}^{2}} \cos{\left( \theta \right) } \sin{\left( \theta \right) } {{\sin{\left( \phi \right) }}^{2}}\mathop{+}{{r}^{2}} \cos{\left( \theta \right) } \sin{\left( \theta \right) } {{\cos{\left( \phi \right) }}^{2}}}{\mathop{-}\left( r \sin{\left( \theta \right) } \sin{\left( \phi \right) } \left( \mathop{-}\left( r {{\sin{\left( \theta \right) }}^{2}} \sin{\left( \phi \right) }\right) \mathop{-}r {{\cos{\left( \theta \right) }}^{2}} \sin{\left( \phi \right) }\right) \right) \mathop{+}{{r}^{2}} {{\sin{\left( \theta \right) }}^{3}} {{\cos{\left( \phi \right) }}^{2}}\mathop{+}{{r}^{2}} {{\cos{\left( \theta \right) }}^{2}} \sin{\left( \theta \right) } {{\cos{\left( \phi \right) }}^{2}}}\\ \frac{r \cos{\left( \theta \right) } \sin{\left( \theta \right) } \cos{\left( \phi \right) }}{\mathop{-}\left( r \sin{\left( \theta \right) } \sin{\left( \phi \right) } \left( \mathop{-}\left( r {{\sin{\left( \theta \right) }}^{2}} \sin{\left( \phi \right) }\right) \mathop{-}r {{\cos{\left( \theta \right) }}^{2}} \sin{\left( \phi \right) }\right) \right) \mathop{+}{{r}^{2}} {{\sin{\left( \theta \right) }}^{3}} {{\cos{\left( \phi \right) }}^{2}}\mathop{+}{{r}^{2}} {{\cos{\left( \theta \right) }}^{2}} \sin{\left( \theta \right) } {{\cos{\left( \phi \right) }}^{2}}} & \frac{r \cos{\left( \theta \right) } \sin{\left( \theta \right) } \sin{\left( \phi \right) }}{\mathop{-}\left( r \sin{\left( \theta \right) } \sin{\left( \phi \right) } \left( \mathop{-}\left( r {{\sin{\left( \theta \right) }}^{2}} \sin{\left( \phi \right) }\right) \mathop{-}r {{\cos{\left( \theta \right) }}^{2}} \sin{\left( \phi \right) }\right) \right) \mathop{+}{{r}^{2}} {{\sin{\left( \theta \right) }}^{3}} {{\cos{\left( \phi \right) }}^{2}}\mathop{+}{{r}^{2}} {{\cos{\left( \theta \right) }}^{2}} \sin{\left( \theta \right) } {{\cos{\left( \phi \right) }}^{2}}} & \frac{\mathop{-}\left( r {{\sin{\left( \theta \right) }}^{2}} {{\sin{\left( \phi \right) }}^{2}}\right) \mathop{-}r {{\sin{\left( \theta \right) }}^{2}} {{\cos{\left( \phi \right) }}^{2}}}{\mathop{-}\left( r \sin{\left( \theta \right) } \sin{\left( \phi \right) } \left( \mathop{-}\left( r {{\sin{\left( \theta \right) }}^{2}} \sin{\left( \phi \right) }\right) \mathop{-}r {{\cos{\left( \theta \right) }}^{2}} \sin{\left( \phi \right) }\right) \right) \mathop{+}{{r}^{2}} {{\sin{\left( \theta \right) }}^{3}} {{\cos{\left( \phi \right) }}^{2}}\mathop{+}{{r}^{2}} {{\cos{\left( \theta \right) }}^{2}} \sin{\left( \theta \right) } {{\cos{\left( \phi \right) }}^{2}}}\\ \frac{\mathop{-}\left( r {{\sin{\left( \theta \right) }}^{2}} \sin{\left( \phi \right) }\right) \mathop{-}r {{\cos{\left( \theta \right) }}^{2}} \sin{\left( \phi \right) }}{\mathop{-}\left( r \sin{\left( \theta \right) } \sin{\left( \phi \right) } \left( \mathop{-}\left( r {{\sin{\left( \theta \right) }}^{2}} \sin{\left( \phi \right) }\right) \mathop{-}r {{\cos{\left( \theta \right) }}^{2}} \sin{\left( \phi \right) }\right) \right) \mathop{+}{{r}^{2}} {{\sin{\left( \theta \right) }}^{3}} {{\cos{\left( \phi \right) }}^{2}}\mathop{+}{{r}^{2}} {{\cos{\left( \theta \right) }}^{2}} \sin{\left( \theta \right) } {{\cos{\left( \phi \right) }}^{2}}} & \frac{r {{\sin{\left( \theta \right) }}^{2}} \cos{\left( \phi \right) }\mathop{+}r {{\cos{\left( \theta \right) }}^{2}} \cos{\left( \phi \right) }}{\mathop{-}\left( r \sin{\left( \theta \right) } \sin{\left( \phi \right) } \left( \mathop{-}\left( r {{\sin{\left( \theta \right) }}^{2}} \sin{\left( \phi \right) }\right) \mathop{-}r {{\cos{\left( \theta \right) }}^{2}} \sin{\left( \phi \right) }\right) \right) \mathop{+}{{r}^{2}} {{\sin{\left( \theta \right) }}^{3}} {{\cos{\left( \phi \right) }}^{2}}\mathop{+}{{r}^{2}} {{\cos{\left( \theta \right) }}^{2}} \sin{\left( \theta \right) } {{\cos{\left( \phi \right) }}^{2}}} & 0\end{pmatrix}\]

--> JW_inv: trigsimp(invert(JW));

\[\]\[\tag{W\_ in} \begin{pmatrix}\sin{\left( \theta \right) } \cos{\left( \phi \right) } & \sin{\left( \theta \right) } \sin{\left( \phi \right) } & \cos{\left( \theta \right) }\\ \frac{\cos{\left( \theta \right) } \cos{\left( \phi \right) }}{r} & \frac{\cos{\left( \theta \right) } \sin{\left( \phi \right) }}{r} & \mathop{-}\left( \frac{\sin{\left( \theta \right) }}{r}\right) \\ \mathop{-}\left( \frac{\sin{\left( \phi \right) }}{r \sin{\left( \theta \right) }}\right) & \frac{\cos{\left( \phi \right) }}{r \sin{\left( \theta \right) }} & 0\end{pmatrix}\]

--> determinant(JW);

\[\]\[\tag{%o15} \mathop{-}\left( r \sin{\left( \theta \right) } \sin{\left( \phi \right) } \left( \mathop{-}\left( r {{\sin{\left( \theta \right) }}^{2}} \sin{\left( \phi \right) }\right) \mathop{-}r {{\cos{\left( \theta \right) }}^{2}} \sin{\left( \phi \right) }\right) \right) \mathop{+}{{r}^{2}} {{\sin{\left( \theta \right) }}^{3}} {{\cos{\left( \phi \right) }}^{2}}\mathop{+}{{r}^{2}} {{\cos{\left( \theta \right) }}^{2}} \sin{\left( \theta \right) } {{\cos{\left( \phi \right) }}^{2}}\]

--> trigsimp(%);

\[\]\[\tag{%o16} {{r}^{2}} \sin{\left( \theta \right) }\]

--> dW: diff(w);

\[\]\[\tag{} \]

--> trigsimp(dW . dW);

\[\]\[\tag{%o18} {{r}^{2}} {{\sin{\left( \theta \right) }}^{2}} {{\mathop{del}\left( \phi \right) }^{2}}\mathop{+}{{r}^{2}} {{\mathop{del}\left( \theta \right) }^{2}}\mathop{+}{{\mathop{del}(r)}^{2}}\]

There was a question whether you could do Laplace transforms in Maxima. The answer is yes:
--> laplace(sin(t),t,s);

\[\]\[\tag{%o20} \frac{1}{{{s}^{2}}\mathop{+}1}\]

--> ilt(%o20,s,t);

\[\]\[\tag{%o22} \sin{(t)}\]


Created with wxMaxima.

The source of this Maxima session can be downloaded here.