Ask Your Question
0

2 sets of coordinates in EuclideanSpace?

asked 2021-01-29 21:28:08 +0200

curios_mind gravatar image

Hello,

I would like to work with 2 vectors in EuclideanSpace each having x1,y1,z1 and x2,y2,z2 coordinates. I will be needing to switch back and forth between cartesian and spherical coordinates as well.

As an example, say, (r1,0,0) -> (x1,y1,z1) while (r2,0,0)->(x2,y2,z2) in the same EuclideanSpace.

How would one work with multiple vectors (with independent coordinates) in EuclideanSpace?

Should one define 2 chart for spherical coordinates and 2 for cartesian coordinates?

Or should one create 2 different EuclideanSpace and combine them (if possible)?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-01-30 12:27:46 +0200

eric_g gravatar image

updated 2021-01-30 12:30:49 +0200

In EuclideanSpace, there are three predefined coordinate charts, which are returned by the methods cartesian_coordinates(), spherical_coordinates() and cylindrical_coordinates():

sage: E.<x,y,z> = EuclideanSpace()                                                                  
sage: E.cartesian_coordinates()                                                                     
Chart (E^3, (x, y, z))
sage: E.spherical_coordinates()                                                                     
Chart (E^3, (r, th, ph))
sage: E.cylindrical_coordinates()                                                                   
Chart (E^3, (rh, ph, z))

But you can define as many charts as you want by means of the method chart(). For instance:

sage: Cartes1.<x1, y1, z1> = E.chart()                                                              
sage: Cartes1                                                                                       
Chart (E^3, (x1, y1, z1))

To complete the construction, you have to specify the transition map from previously defined coordinates:

sage: Cartes_to_Cartes1 = E.cartesian_coordinates().transition_map(Cartes1, [x-2, y+3, z])          
sage: Cartes_to_Cartes1.display()                                                                   
x1 = x - 2
y1 = y + 3
z1 = z

as well as its inverse, either by asking Sage to compute it (method inverse()) or by specifying it by hand (method set_inverse()):

sage: Cartes_to_Cartes1.inverse().display()                                                         
x = x1 + 2
y = y1 - 3
z = z1

Then Sage can compute vector field components in the new coordinate frame:

sage: v = E.vector_field(x+z, y*z, x*y)                                                             
sage: v.display()                                                                                   
(x + z) e_x + y*z e_y + x*y e_z
sage: v.display(Cartes1)                                                                            
(x1 + z1 + 2) d/dx1 + (y1 - 3)*z1 d/dy1 + ((x1 + 2)*y1 - 3*x1 - 6) d/dz1

For more details, see the coordinate chart documentation.

edit flag offensive delete link more

Comments

Thank you so much! this is really awesome. I love the way sagemath handle these things.

curios_mind gravatar imagecurios_mind ( 2021-01-30 23:43:42 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-01-29 21:28:08 +0200

Seen: 53 times

Last updated: Jan 30