HP 17B Solver - another ARCTAN(Y/X) approximation
|
05-15-2021, 09:14 AM
(This post was last modified: 05-15-2021 09:23 AM by Martin Hepperle.)
Post: #1
|
|||
|
|||
HP 17B Solver - another ARCTAN(Y/X) approximation
HP 17BII Solver approximation of ARCTAN(Y/X) as part of an Rectangular (X,Y) to Polar (R,Ø) Conversion.
These equations produce two outputs from two inputs, therefore they are not reversible. A) Approximation of ARCTAN(Y,X) in the first quadrant (X>0,Y>0) The approximation of ARCTAN is quite accurate for (Y/X) < 1 If (Y/X) < 1 we use the approximation ARCTAN(Y/X) otherwise we transform ARCTAN(Y/X) = PI/2 - ARCTAN(X/Y) Visible variables: Ø - angle X - horizontal coordinate Y - vertical coordinate Invisible, intermediate variables: Case: X>Y X<=Y B: argument: Y/X X/Y S: sign: +1 -1 P: additive term: 0 PI/2 The first part sets local variables B, S, P Ø = (R-R) + (IF(X>Y : L(B:Y÷X) + L(S:1) + L(P:0) : L(B:X÷Y) + L(S:-1) + L(P:PI÷2)) + L(A:SQ(1÷G(B))) + L(R:SQRT(SQ(X)+SQ(Y))) )×0 + This is the core approximation G(P) + G(S)×(15159+(147455+(345345+225225×G(A))×G(A))×G(A)) ÷ (35×G(B)×(35+(1260+(6930+(12012+6435×G(A))×G(A))×G(A))×G(A))) B) Approximation of ARCTAN(Y,X) for all 4 quadrants: 0 <= Ø <= 2*PI Additional Invisible, intermediate variables: Case: Q1 Q2 Q3 Q4 Angle to 90 180 270 360 deg T: sign: +1 -1 +1 -1 Q: add.term: 0 PI PI 2*PI This first part sets local variables Q and T for quadrants Ø = (R-R) + (IF(X<0 : L(Q:PI) + IF(Y<0 : L(T:1) : L(T:-1)) : IF(Y<0 : L(Q:2×PI) + L(T:-1) : L(Q:0) + L(T:1))) + This second part sets local variables B, S, P as above IF(ABS(X)>ABS(Y) : L(B:ABS(Y÷X)) + L(S:1) + L(P:0) : L(B:ABS(X÷Y)) + L(S:-1) + L(P:PI÷2)) + L(A:SQ(1÷G(B))) + L(R:SQRT(SQ(X)+SQ(Y))) )×0 + This is the core approximation G(Q) + G(T)×(G(P) + G(S) × (15159+(147455+(345345+225225×G(A))×G(A))×G(A)) ÷ (35×G(B)×(35+(1260+(6930+(12012+6435×G(A))×G(A))×G(A))×G(A)))) I guess there are options to reduce the complexity of the quadrant handling. I have added these equations to my LET/GET notes under https://www.mh-aerotools.de/hp/. For more good trig function approximations see also https://www.hpmuseum.org/cgi-sys/cgiwrap...i?read=695 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)