On Sunday, November 8, 2015 at 5:45:44 PM UTC+2, Imran Ali wrote:
>
> 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.
>>>
>>
It looks like  u  was defined differently in different contexts. 

-- 
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 sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
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/78617c89-dd03-4c31-bfbe-4327aaf8a754%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to