I was a bit quick there. srepr(u) gives the following output :
BaseScalarField(CoordSystem(Symbol('egg_carton'), Patch(Symbol('P'),
Manifold(Symbol('M'), Integer(2))), Tuple(Symbol('u'), Symbol('v'))),
Integer(0))
On Sunday, November 8, 2015 at 4:40:45 PM UTC+1, Imran Ali wrote:
>
> Hi Kalevi!
>
> I got the following output from srepr :
>
> Symbol('u')
> Differential(BaseScalarField(CoordSystem(Symbol('egg_carton'),
> Patch(Symbol('P'), Manifold(Symbol('M'), Integer(2))), Tuple(Symbol('u'),
> Symbol('v'))), Integer(0)))
>
> I see now what the error is! My code used u as a sympy expression, instead
> of it being one of the coord_functions().
>
> Thanks!
>
> On Friday, November 6, 2015 at 5:51:40 PM UTC+1, Kalevi Suominen wrote:
>>
>>
>>
>> On Thursday, November 5, 2015 at 3:56:09 PM UTC+2, Imran Ali wrote:
>>>
>>> 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
>>>
>>>
>>
>> It is not clear how u, v, du, dv are constructed in your SO question. If
>> you could post srepr(u) and srepr(du), it might be possible to say more.
>>
>
--
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/aed8d7b1-34ac-4340-b8c6-acd405c5a99a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.