Sunday, March 5, 2017

HP Prime: Parabolic Coordinates



HP Prime:  Parabolic Coordinates



The Formulas

The relationship and conversion factors between parabolic coordinates (μ, v, ϕ) and rectangular coordinates (x, y, z) are as follows:

x = μ * v * cos ϕ
y = μ * v * sin ϕ
z = 1/2 * (μ^2 – v^2)

ϕ = atan(y/x)
v = √( -z + √(x^2 + y^2 + z^2))
μ = √( 2*z + v^2)
(note the sequence)

where μ ≥ 0 and v ≥ 0

Derivation

The formulas to find the rectangular coordinates are given.  We can derive the formulas for the parabolic coordinates by the following:

Assume that μ > 0 and v > 0 (neither are zero).  Then:

x = μ * v * cos ϕ  
y = μ * v * sin ϕ
x / y = (μ * v * cos ϕ)/( μ * v * sin ϕ)
x / y = 1 / tan ϕ
y / x = tan ϕ
ϕ = atan (y / x)

Express μ in terms of z:

z = 1/2 * (μ^2 – v^2)
2 * z = μ^2 – v^2
μ^2 = 2*z + v^2

Since μ is positive, only the positive square root is considered:
μ = √(2*z + v^2)

Can we find an expression for v?  If we can, we have found our formulas:

x = μ * v * cos ϕ

Square both sides:
x^2 = μ^2 * v^2 * cos^2 ϕ    (I)

Note that for a given variable w, cos(atan w) = 1 / √(w^2 + 1)
In this case, w = y/x or:
cos^2 ϕ
= (cos (atan ϕ))^2
= √(1 / ((y/x)^2 + 1))^2
= 1 / ((y/x)^2 + 1)
= x^2 / x^2 * 1 / ((y/x)^2 + 1)
= x^2 / (x^2 + y^2)

Back to (I):
x^2 = μ^2 * v^2 * cos^2 ϕ    (I)
‘x^2 = (2*z + v^2) * v^2 * x^2 / (x^2 + y^2)

Assuming x≠0, divide both sides by x^2:
1 = (2*z + v^2) * v^2 * 1 / (x^2 + y^2)
1 = (2*z*v^2 + v^4) * 1/(x^2 + y^2)
0 = 1/(x^2 + y^2) * v^4 + (2*z)/(x^2 + y^2) * v^2 – 1

Here we have a quadratic equations in the form of Av^4 + Bv^2 + C = 0 where:
A = 1/(x^2 + y^2)
B = (2*z)/(x^2 + y^2)
C = -1

The solution is v^2 = (-B + √(B^2 – 4*A*C)/(2*A).  Remember that v > 0, so only positive roots will be considered.  Then:
-B/(2*A)  = -(2*z)/(x^2 + y^2) * (x^2 + y^2)/2 = -z


And:
B^2 – 4*A*C = (4*z^2 + 4*(x^2 + y^2))/(x^2 + y^2)^2
√( B^2 – 4*A*C) = 2 * √(x^2 + y^2 + z^2)/(x^2 + y^2)
√( B^2 – 4*A*C)/(2*A) = √(x^2 + y^2 + z^2)

Hence:
v^2 = -z + √(x^2 + y^2 + z^2)
v = √(-z + √(x^2 + y^2 + z^2))

HP Prime Program PBC2REC (Parabolic to Rectangular)

EXPORT PBC2REC(u,v,φ)
BEGIN
// Parabolic to Rectangular
// u≥0, v≥0, 0≤φ<2π
// EWS 2017-02-28
LOCAL x:=u*v*COS(φ);
LOCAL y:=u*v*SIN(φ);
LOCAL z:=1/2*(u^2-v^2);
RETURN {x,y,z};
END;

HP Prime Program REC2PBC (Rectangular to Parabolic)

EXPORT REC2PBC(x,y,z)
BEGIN
// Rectangular to Parabolic
// u≥0, v≥0, 0≤φ<2π
// EWS 2017-02-28
LOCAL φ:=ATAN(y/x);
LOCAL v:=√(−z+√(x^2+y^2+z^2));
LOCAL u:=√(2*z+v^2);
RETURN {u,v,φ};
END;

Examples (angles are in radians)

μ = 1, v = 3, ϕ = 0.4
Result:  x ≈ 2.76318, y ≈ 1.16826, z = -4

x = 1.69042, y = 7.9006. z = -2.76432
Result:  μ ≈ 2.40311, v ≈ 3.36208, ϕ ≈ 1.36000

Source:
P. Moon and D.E. Spencer.  Field Theory Handbook:  Including Coordinate Systems Differential Equations and Their Solutions.  2nd ed. Springer-Verlag:  Berlin, Heidelberg, New York.  1971.  ISBN 0-387-02732-7

This blog is property of Edward Shore, 2017.

No comments:

Post a Comment

HP 15C: Pythagorean Triples

HP 15C:   Pythagorean Triples This program calculates the Pythagorean triple (A, B, C) such that A^2 + B^2 = C^2 by the formulas: ...