Hi Ondrej. I implemented this case with sympy.diffgeom, but the results I get back are not what I expected them to be.
I posted the implementation here : http://pastebin.com/k7UZ4PYy The Christoffel Riemann tensor the code calculates is as following : [[ [ [0, 0], [0, 0]], [ [0, sin(theta)**2], [-sin(theta)**2, 0] ] ], [[ [0, -1], [1, 0]], [ [0, 0], [0, 0]] ] ] But this result does not correspond to the hand calculations of Thomas Moore : http://www.physicspages.com/2014/04/08/riemann-tensor-for-surface-of-a-sphere/ With kind regards, Imran On Wednesday, October 14, 2015 at 11:29:03 PM UTC+2, Ondřej Čertík wrote: > > On Wed, Oct 14, 2015 at 3:25 PM, Ondřej Čertík <[email protected] > <javascript:>> wrote: > > Hi Imran, > > > > On Wed, Oct 14, 2015 at 10:14 AM, Imran Ali <[email protected] > <javascript:>> wrote: > >> I have implemented a SymPy program that can calculate the Riemann > curvature > >> tensor for a given curve element. However, I am encountering problems > >> solving for the case when the curve element is the surface of a sphere > >> > >> \begin{align} > >> ds^2 = r^2d\theta^2 + r^2 \sin^2\theta d\phi^2 > >> \end{align} > >> > >> This is obviously a 2D curve element, so the non-zero elements of the > metric > >> become > >> \begin{align} > >> g_{11} = r^2, \qquad g_{22} = r^2 \sin^2\theta. > >> \end{align} > >> The entries of metric are clearly a function of two variables $r$ and > >> $\theta$. But the way I have created the program it treats them > according to > >> their differentials $d\theta$ and $d\phi$. Since $dr$ is 'zero', my > metric > >> is computed as > >> \begin{align} > >> \begin{bmatrix} > >> 0 &0 &0\\ > >> 0 &r^2 &0\\ > >> 0 &0 &r^2 \sin^2\theta > >> \end{bmatrix}. > >> \end{align} > >> The way I have coded my implementation is by asking the user for the > metric > >> defined as a matrix. If the matrix is 2D, then I use $u$,$v$ to > represent > >> the coordinates. Which in the 2D case assign $r$ as $u$ and $\theta$ as > $v$. > >> For 3D (with metric above), the additional value $\phi$ is assigned > $w$. > > > > If your space/surface is only 2D, then the metric tensor is a 2x2 > > matrix, I think it's just: > > > > [r^2, 0] > > [0, r^2 sin^2(theta)] > > > > And that's what you need to feed into your program. Then things should > > work. If you have a zero entry in the 3x3 metrix tensor, then the > > coordinates are degenerate, and I guess your code can't handle it. > > Ok, looks like somebody there already gave you an essentially identical > answer: > > http://physics.stackexchange.com/a/212571/6396 > > Ondrej > > > > >> > >> Does anyone see my dilemma here? For 3D, I am basically trying to > calculate > >> the Riemann tensor for a metric with the determinant equal to zero. And > for > >> 2D, the $\phi$ component does not even exist. > >> > >> This element is important for me to test my code as this generates a > >> non-zero Riemann curvature tensor. I would really appreciate any > suggestions > >> how I can handle this case and thereby improve my code....which fails > >> completely for this case. > >> > >> (I posted the exact post at physics on stackexchange : > >> > http://physics.stackexchange.com/questions/212541/finding-the-riemann-tensor-for-the-surface-of-a-sphere-with-sympy-diffgeom#212541 > > >> , and they gently directed my here. I have posted the code on pastebin > : > >> http://pastebin.com/DPxW38L0 - the problem lies in the way I have > defined > >> the constructor for Riemann class) > > > > If you want to look at a working code in 4D, look here: > > > > > https://github.com/sympy/sympy/blob/master/examples/advanced/relativity.py > > > > Then you can adapt it for a 2D case. > > > > Ondrej > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/fab00dc6-c89e-4aab-a751-b0ad52d4aa17%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
