---------- Forwarded message ---------

From:

**J.A. (Hans) Piest** <[hidden email]>Date: Wed, Feb 12, 2020 at 6:46 AM

Subject: sph2cart octave definition matches neither mathematical nor phsics definitions

To: <

[hidden email]>, <

[hidden email]>

Hi guys,

Finally I found out that the spherical coordinates in octave function sph2cart are defined as follows:

x = cos(phi) * cos(theta)

y = cos(phi) * sin(theta)

z = sin(phi)

In physics the coordinates are defined as follows:

x = sin(theta) * cos(phi)

y = sin(theta) * sin(phi)

z = cos(theta)

Mathematics is the same as in physics but with theta and phi interchanged:

x = sin(phi) * cos(theta)

y = sin(phi) * sin(theta)

z = cos(phi)

You can see from e.g. wikipedia => spherical coordinates that

both in mathematics and in physics the x,y,z axes are a righthanded oriented system,

which the default system both in physics and mathematics to use. Only theta and phi have

been interchanged.

E.g. for (theta,phi) = (30°,60°):

octave sph2crt formula : (x,y,z) = ( sqrt(3)/4 , 3/4 , sqrt(3)/2 )

octave sph2crt(pi/6, pi/3) : (x,y,z) = ( 0.43301 , 0.25000 , 0.86603 )

physics formula : (x,y,z) = ( 1/4 , sqrt(3)/4 , sqrt(3)/2 )

mathematics formula : (x,y,z) = ( 3/4 , sqrt(3)/4 , 1/2 )

In the attachment I have compared the outputs of sph2crt(theta,phi,1)

with the outputs of the explicit formulas expressed above:

It show that the formulas for (x,y,z) for physics and mathematics give different results than

those for the explicit octave computation.

I think that it is very important that you give a clear picture of how sph2crt computes x,y,z.

I suggest that you simply put the formula

x = cos(phi) * cos(theta)

y = cos(phi) * sin(theta)

z = sin(phi)

in the manual ... nobody can be confused anymore that way.

regards,

Hans

------------------------------------------------------------------------------------

example publication:

CRDS of thin layers :

www.darklands-sewer-system.eu/outlet/FTP/CavityRingdownPaper.pdf
sailing:

SV Morgenster bottom-up :

www.darklands-sewer-system.eu/outlet/FTP/bottom-up-small.mov
SV Morgenster top-down :

www.darklands-sewer-system.eu/outlet/FTP/top-down-small.mov
rowing:

8+ :

www.darklands-sewer-system.eu/outlet/FTP/RowingTheClubAcht-28February2015-small.mp4