--
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+un...@googlegroups.com.
To post to this group, send email to sy...@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/d6a7e710-7d96-452d-8a7b-6518c0226225%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/86d19d32-44b7-4530-b24a-3742c3276099%40googlegroups.com.
El jueves, 20 de noviembre de 2014 10:45:50 UTC-3, brombo escribió:You might wish to be more general and implement vector analysis as a function of a metric tensor. See the following link -
http://en.wikipedia.org/wiki/Curvilinear_coordinates#Vector_operations
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/7105867e-e256-44d3-a2a8-8fed73f11798%40googlegroups.com.
Sachin Joglekar developed the vector package this past summer. I was his GSoC mentor on the project. You can check out this implemented of the Cartesian coordinate system:
https://github.com/sympy/sympy/blob/master/sympy/vector/coordsysrect.py
In [1]: from sympy.diffgeom import *
In [2]: r, theta, phi = symbols('r theta phi', positive=True)
In [4]: M = Manifold('M', 3)
In [5]: P = Patch('P', M)
In [7]: rect = CoordSystem('rect', P, ['x', 'y', 'z'])
In [8]: spherical = CoordSystem('spherical', P, ['r', 'theta', 'phi'])
In [9]: spherical.connect_to(rect, [r, theta, phi], [r*sin(phi)*cos(theta), r*sin(phi)*sin(theta), r*cos(phi)], inverse=False)
from_spherical = lambda r, theta, phi: (r*sin(theta)*cos(phi), r*sin(theta)*sin(phi), r*cos(theta))
grad = get_grad(from_spherical)
⎡ ∂_θ │sin(θ)│⋅∂ᵩ⎤
⎢∂ᵣ, ───, ───────────⎥
⎢ r 2 ⎥
⎣ r⋅sin (θ) ⎦
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/14ce54ae-897d-41bd-9a35-36e9a0b11822%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/14ce54ae-897d-41bd-9a35-36e9a0b11822%40googlegroups.com.
>>> refine(sqrt(abs(sin(t)**2)), Q.positive(sin(t)))
sin(t)
In [1]: from sympy import *
In [2]: from sympy.diffgeom import *
In [3]: M = Manifold('M', 2)
In [4]: P = Patch('P', M)
In [5]: rect = CoordSystem('rect', P, ['x', 'y'])
In [6]: x, y = rect.coord_functions()
In [7]: x*y
Out[7]: x*y
In [8]: simplify(x*y)
/usr/local/lib/python2.7/dist-packages/sympy/core/function.pyc in count_ops(expr, visual)
2250 while args:
2251 a = args.pop()
-> 2252 if a.is_Rational:
2253 #-1/3 = NEG + DIV
2254 if a is not S.One:
AttributeError: 'int' object has no attribute 'is_Rational'