The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function

 Arcsin in Valentin Albillo's HP-12C Tried & Tricky Trigonometrics
11-25-2019, 06:40 AM
Post: #1
 jklsadf Junior Member Posts: 43 Joined: Nov 2017
Arcsin in Valentin Albillo's HP-12C Tried & Tricky Trigonometrics
I've been going through Valentin Albillo's "HP-12C Tried & Tricky Trigonometrics"
article trying to understand the algorithms used, and am so far completely stumped as to how the arcsin calculation is done. http://www.hpcc.org/datafile/hp12/12c_Tr...ctions.pdf

The sin calculation uses a fairly straightforward application of the taylor series expansion of sin(x) = x - x^3/3! + x^5/5! - x^7/7! + ... = sum(-1^n * x^(2n+1) / (2n+1)! from 0 to infinity) as stated in the article, with register 5 holding the running sum, and register 6 holding n.

For arcsin, the article states that "To guarantee fast convergence for all x, a suitable scaling of the input value is previously performed, followed by a change of variable, and finally a Taylor Series Expansion is used to generate an intermediate result, which is then scaled back to give the final result." The motivation of guaranteeing fast convergence makes sense, as does calculating arctan in terms of arcsin (since all of the terms in the arcsin series have the same sign) instead of the other way around, but I don't fully understand what the scaling or change of variable is.

As far as I can tell, register 5 (which holds the running sum), first has the scaling (1 - sqrt(1 - x^2)) / 2 done repeatedly (3 times), which seems like it might be trying to convert to arccos or something (at least the sqrt(1 - x^2) part)? Or maybe it's related to the fact that arcsin(x) = integral(dt/sqrt(1 - t^2) from 0 to x)? There's some additional operations before getting the initial values for register 5 (which hold the running sum) and register 6 (which holds n), which I understand even less. Line 59 seems to always compute 0!, which is 1.

Then after the change of variable, it looks like the series expansion used is simply: x - x^3/3 * x^5/5 - x^7/7 + ... which is surprisingly simple compared to the original series expansion for arcsin(x).

The final scaling back to give the final result doesn't make much sense either, and seems to consist of just multiplying by 8 and correcting the sign. The only thing I can think of is 2^3 is 8, and 3 was the number of scaling iterations done initially, maybe from a half angle formula. Miraculously this all seems to work and give the correct answer, but I have no idea how.

Maybe this will make more sense if I look at it more, but I was hoping Valentin (if he reads this) or someone else could shed some more light on how exactly arcsin(x) is being calculated, and why. The last time I've had to look at anything similar was in school, and although I'm probably a bit younger than most people on this forum, that was still a long time ago.
 « Next Oldest | Next Newest »

 Messages In This Thread Arcsin in Valentin Albillo's HP-12C Tried & Tricky Trigonometrics - jklsadf - 11-25-2019 06:40 AM RE: Arcsin in Valentin Albillo's HP-12C Tried & Tricky Trigonometrics - jklsadf - 11-25-2019, 06:56 AM RE: Arcsin in Valentin Albillo's HP-12C Tried & Tricky Trigonometrics - Albert Chan - 11-25-2019, 04:32 PM RE: Arcsin in Valentin Albillo's HP-12C Tried & Tricky Trigonometrics - Albert Chan - 11-27-2019, 06:31 PM RE: Arcsin in Valentin Albillo's HP-12C Tried & Tricky Trigonometrics - jklsadf - 11-26-2019, 01:02 AM RE: Arcsin in Valentin Albillo's HP-12C Tried & Tricky Trigonometrics - Don Shepherd - 11-26-2019, 03:33 AM

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