# How can I define or use a new coordinate system?

I want to use the dipole coordinate system as defined in this paper: http://arxiv.org/abs/physics/0606044

I see that Mathematica can do all kinds of vector analysis using different kinds of coordinate systems, but the dipole coordinate system does not seem to be included. That's understandable: it's an exotic coordinate system after all.

Is there a way to define a new coordinate system to use and then perform vector analysis on it? I have the scale factors, the Jacobian, and so on from the above article.

This is a general question, but here is my application: I am solving a matrix equation where the key matrix is diagonal in the dipole coordinate system. I could rotate/transform that matrix to spherical coordinates (which would be convenient for other vectors in the equation), but doing so requires a different rotation/transformation at every single point, and it isn't clear to me how to do that, or that it would be any better.

• Is the dipole coordinate system orthogonal? – bbgodfrey Feb 24 '15 at 19:34
• Yes. The unit vectors are also normalized (I believe!), and it's a right-handed system. – jvriesem Feb 24 '15 at 19:36
• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – user9660 Feb 24 '15 at 19:58
• It looks like all the details of coordinate systems are in SymbolicTensorsCoordinateChartDataDumpmappingInfo so perhaps one could add another system by adding more rules there, but it doesn't look like much fun, and there's no guarantee it would work. – Simon Woods Feb 24 '15 at 20:51
• I think the coordinate systems included in Mathematica are the ones in which the Laplace equation is separable. The "dipolar coordinates" in the paper don't belong to that class. Of course one can define infinitely many other orthogonal coordinate systems (e.g. from the real and imaginary parts of an analytic function), but those aren't "special" enough to be included. It makes sense to me - but it's not too hard to do all the calculations in that linked paper in Mathematica ab initio. – Jens Feb 25 '15 at 5:14

I would strongly recommend against trying to modify SymbolicTensorsCoordinateChartDataDumpmappingInfo. It is a very low level function and any changes you make are unlikely to work.

There are two sets of operations commonly needed with alternate coordinate systems. One is calculus in the coordinate system - Grad, Div, Curl and all that -- and the other is transforming between two sets of coordinate systems.

There is an experimental (i.e, undocumented and unsupported) function to deal with the first set. So for example, to define your own spherical coordinates, you could do

patch =  SymbolicTensorsScaleFactorGeometryPatch[{1, r,  r Sin[θ]}, {r, θ, φ}];


And then you could use patch in the third argument of most vector calculus functions:

Grad[ f[r, θ, φ], {r, θ, φ}, patch]

 {Derivative[1, 0, 0][f][r, θ, φ],
Derivative[0, 1, 0][f][r, θ, φ]/Sqrt[r^2],
Derivative[0, 0, 1][f][r, θ, φ]/
Sqrt[r^2*Sin[θ]^2]}


Having taken a look at the paper you mentioned, there is an issue in that all of the expressions are in "mixed form", using both the intrisinc coordinate and spherical coordinates in them. In order to use ScaleFactorGeometryPatch, you would need to solve for the scale factors entirely in terms of the dipolar coordinates. But having down that, ScaleFactorGeometryPatch should compute everything else for you.

I hope this helps!

• Thanks! I agree, that it is unfortunate that the paper uses mixed coordinates. What does the \enter code here[theta]` bit do in your example? – jvriesem Mar 3 '15 at 17:57
• @jvriesem That bit of text was unintentional, I believe. So I just removed it to avoid confusion... – Jens Mar 3 '15 at 17:59