HP 17B Solver - another ARCTAN(Y/X) approximation
05-16-2021, 01:03 PM
Post: #4
 Albert Chan Senior Member Posts: 2,100 Joined: Jul 2018
RE: HP 17B Solver - another ARCTAN(Y/X) approximation
Why not have the solver solve something !

Example, we can convert y = atan(x), |x| ≤ 1, into sin(y) = x/sqrt(x*x+1), for y

Compare to atan(t), sin(t) taylor series taper factorially fast !

atan(t) = t - t^3/3 + t^5/5 - t^7/7 + t^9/9 - t^11/11 + ...
sin(t) = t - t^3/3! + t^5/5! - t^7/7! + t^9/9! - t^11/11! + ...

Another benefit is argument is further reduced. abs(x/sqrt(x*x+1)) ≤ 1/sqrt(2) ≈ 0.7071

Using only above terms, atan (via solving sin) is very good (HP Prime emulator, CAS side):

myatan(x) := fsolve(t-t^3/6*(1-t^2/20*(1-t^2/42*(1-t^2/72*(1-t^2/110)))) = x/sqrt(x*x+1.), t=x)
relerr(ok, est) := 1 - est/ok

relerr(π/4, myatan(1)) = −1.24700250126e−11
relerr(π/5,myatan(√(5-2*√5))) = −7.60280727263e−13 ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ // cos(pi/5) = φ/2
relerr(π/6, myatan(1/(√3))) ﻿= −7.1054273576e−14
relerr(π/8, myatan(√2-1)) = 7.1054273576e−15
relerr(π/10,myatan(1/(√(5+2*√5)))) = 0. ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ // sin(pi/10) = 1/(2φ)
relerr(π/12, myatan(2-(√3))) = −7.1054273576e−15
 « Next Oldest | Next Newest »

 Messages In This Thread HP 17B Solver - another ARCTAN(Y/X) approximation - Martin Hepperle - 05-15-2021, 09:14 AM RE: HP 17B Solver - another ARCTAN(Y/X) approximation - Albert Chan - 05-15-2021, 11:01 PM RE: HP 17B Solver - another ARCTAN(Y/X) approximation - Martin Hepperle - 05-16-2021, 08:42 AM RE: HP 17B Solver - another ARCTAN(Y/X) approximation - Albert Chan - 05-16-2021 01:03 PM RE: HP 17B Solver - another ARCTAN(Y/X) approximation - Albert Chan - 05-16-2021, 05:04 PM RE: HP 17B Solver - another ARCTAN(Y/X) approximation - Albert Chan - 05-17-2021, 12:43 PM RE: HP 17B Solver - another ARCTAN(Y/X) approximation - Albert Chan - 05-31-2021, 04:42 PM RE: HP 17B Solver - another ARCTAN(Y/X) approximation - Albert Chan - 05-31-2021, 07:30 PM RE: HP 17B Solver - another ARCTAN(Y/X) approximation - Albert Chan - 05-31-2021, 09:51 PM RE: HP 17B Solver - another ARCTAN(Y/X) approximation - Martin Hepperle - 06-01-2021, 03:16 PM RE: HP 17B Solver - another ARCTAN(Y/X) approximation - Albert Chan - 06-01-2021, 04:38 PM RE: HP 17B Solver - another ARCTAN(Y/X) approximation - Albert Chan - 08-29-2021, 11:39 PM RE: HP 17B Solver - another ARCTAN(Y/X) approximation - Albert Chan - 05-17-2021, 06:01 PM RE: HP 17B Solver - another ARCTAN(Y/X) approximation - Albert Chan - 08-19-2021, 02:42 AM

User(s) browsing this thread: 1 Guest(s)