If I simply hard code each metric, every thing works properly. For example,
take egg carton surface,
from sympy.diffgeom import Manifold, Patch, CoordSystem, TensorProduct
from sympy import sin,cos
dim = 2
m = Manifold("M",dim)
patch = Patch("P",m)
system = CoordSystem('egg_carton', patch, ["u", "v"])
u,v = system.coord_functions()
du,dv = system.base_oneforms()
metric = (sin(v)**2*sin(u)**2 + 1)*TensorProduct(dv, dv) +\
(cos(v)**2*cos(u)**2 + 1)*TensorProduct(du, du) +\
(-cos(2*v - 2*u)/8 + cos(2*v + 2*u)/8)*TensorProduct(du, dv) +\
(-cos(2*v - 2*u)/8 + cos(2*v + 2*u)/8)*TensorProduct(dv, du)
I can use any of the metric_to_* functions without getting the ValueError.
By the way, that metric expression, is from my code. My code produces the
correct metric two form expression. But when I use it as argument for any
of the metric_to_* functions, I get the ValueError. What gives ?
I posted the question on SO :
http://stackoverflow.com/questions/33545982/valueerror-using-sympy-diffgeom-when-using-metric-to-functions
On Saturday, October 31, 2015 at 6:24:01 PM UTC+1, Imran Ali wrote:
>
> I forgot to mention in the SO post (not that I have mentioned plenty
> already there) that sometimes I get the following error :
>
> Traceback (most recent call last):
> File "tensor.py", line 274, in <module>
> RC = R.find_Christoffel_tensor()
> File "tensor.py", line 210, in find_Christoffel_tensor
> R = metric_to_Riemann_components(metric)
> File
> "/usr/local/lib/python2.7/dist-packages/sympy-0.7.7.dev0-py2.7.egg/sympy/diffgeom/diffgeom.py",
>
> line 1575, in metric_to_Riemann_components
> ch_2nd = metric_to_Christoffel_2nd(expr)
> File
> "/usr/local/lib/python2.7/dist-packages/sympy-0.7.7.dev0-py2.7.egg/sympy/diffgeom/diffgeom.py",
>
> line 1525, in metric_to_Christoffel_2nd
> ch_1st = metric_to_Christoffel_1st(expr)
> File
> "/usr/local/lib/python2.7/dist-packages/sympy-0.7.7.dev0-py2.7.egg/sympy/diffgeom/diffgeom.py",
>
> line 1492, in metric_to_Christoffel_1st
> matrix = twoform_to_matrix(expr)
> File
> "/usr/local/lib/python2.7/dist-packages/sympy-0.7.7.dev0-py2.7.egg/sympy/diffgeom/diffgeom.py",
>
> line 1463, in twoform_to_matrix
> raise ValueError('The input expression concerns more than one '
> ValueError: The input expression concerns more than one coordinate
> systems, hence there is no unambiguous way to choose a coordinate system
> for the matrix.
>
> In this case I have introduced some bug in the code, I do not understand
> why I am getting this error.
>
> Here is the input I give :
>
> g =
> Matrix([[1/(u**2 + 1), 0, 0], [0, u**2, 0], [0, 0, u**2*sin(v)**2]])
>
> The code produces the following two-form :
>
> sin(v)**2*u**2*TensorProduct(dw, dw) + u**2*TensorProduct(dv, dv) +
> TensorProduct(du, du)/(u**2 + 1)
>
> For the coordinate system :
>
> CoordSystem(nontrivial, Patch(P, Manifold(M, 3)), (u, v, w))
>
> On Saturday, October 31, 2015 at 6:04:14 PM UTC+1, Imran Ali wrote:
>>
>> I just asked the following question at stackoverflow :
>>
>>
>> http://stackoverflow.com/questions/33453941/determining-christoffel-symbols-and-curvature-tensors-for-a-flat-sphere-using-sy
>>
>> In essence, the question is two fold :
>>
>> 1) My own implementation fails for flat surfaces in 3D
>> 2) Sympy.Diffgeom seems to give wrong results
>>
>> Really appreciate any insight as to what is causing the error and why the
>> hand-coded sympy.diffgeom produces wrong result.
>>
>
--
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/ba0caf82-b1f7-4ece-afac-4cafaeec374e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.