spherical coordinates

Peter Maas peter.maas at mplusr.de
Wed Apr 14 06:04:47 EDT 2004


Bram Stolk wrote:
> Which module could I use if I want to do spherical coordinates in Python?

math. Formulas:

--- 2D

r = sqrt(x**2 + y**2)
phi = atan(y/x)

x = r*cos(phi)
y = r*sin(phi)

--- 3D

r = sqrt(x**2 + y**2 + z**2)
phi = atan(y/x)
theta = atan(z/sqrt(x**2+y**2)

x = r*cos(phi)*cos(theta)
y = r*sin(phi)*cos(theta)
z = r*sin(theta)

Mit freundlichen Gruessen,

Peter Maas

-- 
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Hubert-Wienen-Str. 24
Tel +49-241-93878-0 Fax +49-241-93878-20 eMail peter.maas at mplusr.de
-------------------------------------------------------------------



More information about the Python-list mailing list