ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 06 Jul 2020 14:58:29 +0200Metric of EuclideanSpace(3) in spherical framehttps://ask.sagemath.org/question/52348/metric-of-euclideanspace3-in-spherical-frame/ I may have some conceptual misunderstandings, but here is the code
E=EuclideanSpace(3)
c_spher.<r,th,ph>=E.spherical_coordinates()
f_spher=E.spherical_frame()
E.set_default_chart(c_spher)
E.set_default_frame(f_spher)
g=E.metric()
show(g[:])
I was expecting the diagonal elements of the metric to be `[1,r^2,r^4*sin(th)^2]`, but I get `[1,1,1]`
What I am doing wrong?Sun, 05 Jul 2020 22:47:56 +0200https://ask.sagemath.org/question/52348/metric-of-euclideanspace3-in-spherical-frame/Answer by eric_g for <p>I may have some conceptual misunderstandings, but here is the code</p>
<pre><code>E=EuclideanSpace(3)
c_spher.<r,th,ph>=E.spherical_coordinates()
f_spher=E.spherical_frame()
E.set_default_chart(c_spher)
E.set_default_frame(f_spher)
g=E.metric()
show(g[:])
</code></pre>
<p>I was expecting the diagonal elements of the metric to be <code>[1,r^2,r^4*sin(th)^2]</code>, but I get <code>[1,1,1]</code></p>
<p>What I am doing wrong?</p>
https://ask.sagemath.org/question/52348/metric-of-euclideanspace3-in-spherical-frame/?answer=52355#post-id-52355If you type
E.spherical_frame?
you get *Return the orthonormal vector frame associated with spherical coordinates.*
So `f_spher = E.spherical_frame()` is an *orthonormal* frame; it is therefore correct to get $\mathrm{diag}(1,1,1)$ for the metric components in that frame. What you want is the *coordinate* frame $(\partial/\partial r, \partial/\partial\theta,\partial/\partial\phi)$. You get the latter via `c_spher.frame()`. Hence the metric components you are expecting are returned by
g[c_spher.frame(),:]
The link between the two vector frames is displayed by
for v in f_spher:
show(v.display(c_spher.frame()))
$$e_{ r } = \frac{\partial}{\partial r }$$
$$e_{ {\theta} } = \frac{1}{r} \frac{\partial}{\partial {\theta} }$$
$$e_{ {\phi} } = \frac{1}{r \sin\left({\theta}\right)} \frac{\partial}{\partial {\phi} }$$
PS: you might take a look at this [tutorial notebook](https://nbviewer.jupyter.org/github/sagemanifolds/SageManifolds/blob/master/Notebooks/VectorCalculus/vector_calc_curvilinear.ipynb), and more generaly to the
[tutorial about vector calculus in Euclidean spaces](https://doc.sagemath.org/html/en/thematic_tutorials/vector_calculus.html).Mon, 06 Jul 2020 14:58:29 +0200https://ask.sagemath.org/question/52348/metric-of-euclideanspace3-in-spherical-frame/?answer=52355#post-id-52355