GSoC17: Implementing multiple types of CordSys

85 views
Skip to first unread message

Sassi Aissa

unread,
Mar 21, 2017, 4:22:21 PM3/21/17
to sympy
As I read the description of the Idea, I think I have to implement an abstract class called: Coordinate System, then create several classes that represent different types
of Coordinate system and inherent from the so called 'Coordinate System' class. Is it like this?

Alan Bromborsky

unread,
Mar 21, 2017, 6:56:32 PM3/21/17
to sy...@googlegroups.com
What you need to define a coordinate system and vector calculus (div, curl, etc.) is a set of coordinate variables, a corresponding set of basis vectors, the dot products of all the basis vectors in terms of the coordinates (the metric tensor), and the derivatives of the basis vectors as a linear combination of the basis vectors with coefficients that depend only upon the coordinates (derivable from the Christoffel symbols which are derived from the metric tensor).  Note that the metric tensor can be derived from the vector manifold function which you can write in rectangular coordinates with coefficients that are functions of the coordinates of the coordinate system you wish to define.  Instead of hard coding a particular coordinate system just instantiate a member of the coordinate system class as needed with a given vector manifold function or a given metric tensor.  For example if the class is called CoordinateSystem then for a spherical coordinate system you would have -

ShericalCooridinates = CoordinateSystem((r*cos(theta),r*sin(theta)*cos(phi),r*sin(theta)*sin(phi)),(r,theta,phi))

where (r*cos(theta),r*sin(theta)*cos(phi),r*sin(theta)*sin(phi)) is the vector manifold for spherical coordinates and (r,theta,phi) are the coordinate symbols. The if V is a vector function in terms of the spherical coordinates you could have

ShericalCooridinates.div(V) returns the divergence and

ShericalCooridinates.curl(V) returns the curl, and if A and B are two vectors in spherical coordinates then

ShericalCooridinates.dot(A,B) returns the dot product and

ShericalCooridinates.cross(A,B) returns the cross product.

On Tue, Mar 21, 2017 at 4:21 PM, Sassi Aissa <sassi.aissa...@gmail.com> wrote:
As I read the description of the Idea, I think I have to implement an abstract class called: Coordinate System, then create several classes that represent different types
of Coordinate system and inherent from the so called 'Coordinate System' class. Is it like this?

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/747ffaa1-3d64-4728-8e8e-8b76b59e4a31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

szymon.m...@gmail.com

unread,
Mar 23, 2017, 3:50:54 PM3/23/17
to sympy
Do you think, that we should restrict our class to only orthogonal curvilinear coordinates (Cartesian, Spherical, Cylindrical) or create class as general as possible?


W dniu wtorek, 21 marca 2017 23:56:32 UTC+1 użytkownik brombo napisał:
What you need to define a coordinate system and vector calculus (div, curl, etc.) is a set of coordinate variables, a corresponding set of basis vectors, the dot products of all the basis vectors in terms of the coordinates (the metric tensor), and the derivatives of the basis vectors as a linear combination of the basis vectors with coefficients that depend only upon the coordinates (derivable from the Christoffel symbols which are derived from the metric tensor).  Note that the metric tensor can be derived from the vector manifold function which you can write in rectangular coordinates with coefficients that are functions of the coordinates of the coordinate system you wish to define.  Instead of hard coding a particular coordinate system just instantiate a member of the coordinate system class as needed with a given vector manifold function or a given metric tensor.  For example if the class is called CoordinateSystem then for a spherical coordinate system you would have -

ShericalCooridinates = CoordinateSystem((r*cos(theta),r*sin(theta)*cos(phi),r*sin(theta)*sin(phi)),(r,theta,phi))

where (r*cos(theta),r*sin(theta)*cos(phi),r*sin(theta)*sin(phi)) is the vector manifold for spherical coordinates and (r,theta,phi) are the coordinate symbols. The if V is a vector function in terms of the spherical coordinates you could have

ShericalCooridinates.div(V) returns the divergence and

ShericalCooridinates.curl(V) returns the curl, and if A and B are two vectors in spherical coordinates then

ShericalCooridinates.dot(A,B) returns the dot product and

ShericalCooridinates.cross(A,B) returns the cross product.
On Tue, Mar 21, 2017 at 4:21 PM, Sassi Aissa <sassi.aissa...@gmail.com> wrote:
As I read the description of the Idea, I think I have to implement an abstract class called: Coordinate System, then create several classes that represent different types
of Coordinate system and inherent from the so called 'Coordinate System' class. Is it like this?

--
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.

Alan Bromborsky

unread,
Mar 23, 2017, 5:38:47 PM3/23/17
to sy...@googlegroups.com
If the basis vectors are not orthogonal you need to calculate the reciprocal basis vectors (equivalent to the inverse of the metric tensor).  If \mathbf{e}_i are your basis vectors then \mathbf{e}^iare the reciprocal basis and
\mathbf{e}_i \cdot \mathbf{e}^j = \delta_{ij}.  Or \mathbf{e}^i = g^{ij}\mathbf{e}_j  where g^{ij} is the inverse of g_{ij} and the gradient operator is \frac{\partial}{\partial x^{i}}\mathbf{e}^{i} where the x^i are the coordinates.  You need to do the same for orthogonal coordinates but since the metric tensor
for orthogonal coordinates is diagonal computing the inverse is trivial.  For now I would stick to orthogonal coordinates.

To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscribe@googlegroups.com.

To post to this group, send email to sy...@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.

Alan Bromborsky

unread,
Mar 23, 2017, 5:56:28 PM3/23/17
to sy...@googlegroups.com
Here is a link to all orthogonal coordinate systems in three dimensions and how to calculate vector calculus operations in each -

szymon.m...@gmail.com

unread,
Mar 24, 2017, 11:41:49 AM3/24/17
to sympy
Thank you for answer. I would like to work on this topic during GSoC and your answer, that at the moment we should stick only to orthogonal coordinates is useful.
Now I am preparing proposal.
Reply all
Reply to author
Forward
0 new messages