GSoC Proposal: Extend Implementation of Different Vector Coodinate Systems to a Dot-Product Calculator

145 views
Skip to first unread message

Mikayla Grace

unread,
Mar 12, 2017, 12:30:22 PM3/12/17
to sympy
I have a strong interest in working with SymPy through Google Summer of Code and was looking at your project ideas.  The project that is most appealing to me is the one on the implementation of multiple types of coordinate systems for vectors.  I was curious to know if you had considered creating a function that calculates the dot product. I looked at the linked work on vectors and didn’t see any work on that.  If there is work on dot products already, once the framework for expressing vectors in other coordinates is solid, then it might be useful to develop a dot product calculator that is also able to accept different coordinate inputs.  

Regarding my current skill set, I have taken a CS course at my school, University of Vermont, and while I am not enrolled in any programming classes this semester, I recently set up my GitHub account and am independently working on becoming more proficient in Python and Git through Code Academy. I would say that by the end of the semester and the start of the program I will be a solid beginner in both.  I am a second-year pure math major and would put my math level at “intermediate”  I also have an on-site mentor, Christelle Vincent, PhD, who would be available over the summer.

I'd love to hear your thoughts about extending the idea of different coordinates systems to a dot product calculator. Please let me know if you think my current skill set aligns with the project I'm interested in or if there's another project I might be better suited for.  Thank you for your time, and I look forward to hearing back from you!

Sincerely,
Mikayla Grace

Mikayla Grace

unread,
Mar 20, 2017, 9:21:46 PM3/20/17
to sympy
Edit:  I did find the work on dot products, and it looks like the framework is solid, which means that implementing other coordinate systems and allowing the function "dot" to accept these other vector representations would be a great extension to the current project idea that I would like to pursue.

Alan Bromborsky

unread,
Mar 21, 2017, 12:07:35 PM3/21/17
to sy...@googlegroups.com
Start with a vector manifold defined in rectangular coordinates but with components that are functions of the new coordinates.  For spherical coordinates -

\mathbf{R} = r(\cos(\phi)\mathbf{k}+\sin(\phi)(\sin(\theta)\mathbf{i})+\cos(\theta)\mathbf{j})

\mathbf{R} defines the vector manifold.  The derivatives of \mathbf{R} with respect to r, \phi, and \theta define a set of basis vectors (unnormalized) \mathbf{e}_r, \mathbf{e}_\phi, and \mathbf{e}_\theta. Likewise the derivatives of
\mathbf{e}_r, \mathbf{e}_\phi, and \mathbf{e}_\theta with respect to r, \phi, and \theta can be calculated (needed for divergence and curl calculation).  Then you need to represent the derivatives of the unnormalized
basis vectors in terms of a linear combination of the basis vectors.  One way of doing this is to calculate the metric tensor from the dot products of \mathbf{e}_r, \mathbf{e}_\phi, and \mathbf{e}_\theta and then
use the Christoffel symbols to calculate the derivatives of the basis vectors.  After all this you probably want to normalize the basis vectors and recalculate (simple scaling)
the derivatives of the normalized basis vectors in terms of the normalized basis vectors.








--
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/ee9392ca-f485-4bb1-9618-cafec27c6461%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

ankur maheshwari

unread,
Mar 21, 2017, 1:20:39 PM3/21/17
to sympy
I started some work on the above mentioned idea using https://github.com/sympy/sympy/pull/9937 as the starting point. 
The idea mentioned there was to use a curvilinear coordinate system to compute Divergence, Curl, etc.

I am attaching the python code for the case of Spherical Coordinate System using the curvilinear system idea which defines a vector as 
A = Ar r^ + At theta^ + Ap phi^ where Ar, At, Ap are components in r, theta and phi unit vector direction respectively. 
But Ar, At, and Ap all can be functions of r, theta and phi which can help in computing the curl and divergence for any vector field in Spherical Polar Coordinates.

The issue I am facing is that the sympy function "diff" is not treating Ar, At and Ap as functions. 
Could you guide me in this ?  Attached is the Python code. 
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 https://groups.google.com/group/sympy.
spherical.py

Mikayla Grace

unread,
Mar 21, 2017, 2:52:35 PM3/21/17
to sympy
@brombo, I definitely agree there should be a system in place for easy conversion. I was thinking about allowing a user to input in whatever coordinate system they wanted but when implementing functions the vectors would get converted into rectangular coordinates, pushed through the function, and then converted back to the original coordinate system and returned. The functions already handle Cartesian coordinates so this would cut down on work and internal redundancy (i.e. we would avoid defining the functions again with different coordinate systems).

@ankur, Awesome, I'll take a closer look at it. Thanks for sharing! My general plan was to closely parallel the existing class definition for Cartesian coordinates. I figured this would help keep things organized and clear.

Alan Bromborsky

unread,
Mar 21, 2017, 2:59:18 PM3/21/17
to sy...@googlegroups.com
ankur see attached -

A symbol is not a function.  For example if you want A to be a general function of symbols x, y, z your write -

A = Function('A')(*(x,y,z))

don't ask me to explain the syntax I just use it.

On Tue, Mar 21, 2017 at 2:52 PM, Mikayla Grace <mikayla...@gmail.com> wrote:
@brombo, I definitely agree there should be a system in place for easy conversion. I was thinking about allowing a user to input in whatever coordinate system they wanted but when implementing functions the vectors would get converted into rectangular coordinates, pushed through the function, and then converted back to the original coordinate system and returned. The functions already handle Cartesian coordinates so this would cut down on work and internal redundancy (i.e. we would avoid defining the functions again with different coordinate systems).

@ankur, Awesome, I'll take a closer look at it. Thanks for sharing! My general plan was to closely parallel the existing class definition for Cartesian coordinates. I figured this would help keep things organized and clear.
--
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.
spherical.py

Mikayla Z. Grace

unread,
Mar 21, 2017, 3:11:11 PM3/21/17
to sympy
@Ankur, another thing I noticed was that you define some inputs as restricted to being positive. I think we can build it so that we give the user as much freedom as possible with inputs. We can have it automatically reduce mod 2pi (or 360°) and make it the lowest positive representation of the angles. This way the user doesn't have to compute this. Still reading through, but just an initial thought!
Reply all
Reply to author
Forward
Message has been deleted
0 new messages