The Museum of HP Calculators

HP Forum Archive 21

 Sqrt(1 - x^2) & Sqrt(1 + x^2) functionsMessage #1 Posted by Gerson W. Barbosa on 8 May 2012, 9:45 p.m. In the latest Datafile issue (V31 N2) Wlodek Mier-Jedrzejowicz says his best slide rule (one he actually never used as it was soon replaced by the HP-35), a top of the range model from the German company Aristo, had 30 scales on it. They included the sqrt(1 - x2) and sqrt(1 + x2) functions, which to this day, he says, are not available on calculators. Well, they can be implemented using only two steps each (four, if we count LBL and RTN) on most RPN programmable calculators, like the HP-11C, for instance. Is someone willing to present these or other solutions?

 Re: Sqrt(1 - x^2) & Sqrt(1 + x^2) functionsMessage #2 Posted by Crawl on 8 May 2012, 9:55 p.m.,in response to message #1 by Gerson W. Barbosa Sin(Arccos(x)) = Sqrt(1 - x^2) Cosh(Arcsinh(x)) = Sqrt(1 + x^2)

 Re: Sqrt(1 - x^2) & Sqrt(1 + x^2) functionsMessage #3 Posted by Gerson W. Barbosa on 8 May 2012, 9:58 p.m.,in response to message #2 by Crawl Exactly!

 Re: Sqrt(1 - x^2) & Sqrt(1 + x^2) functionsMessage #4 Posted by Paul Dale on 8 May 2012, 11:07 p.m.,in response to message #1 by Gerson W. Barbosa More interesting from a numeric standpoint are 1-sqrt(1-x2) and sqrt(1+x2)-1. - Pauli

 Re: Sqrt(1 - x^2) & Sqrt(1 + x^2) functionsMessage #5 Posted by Dieter on 9 May 2012, 8:01 a.m.,in response to message #4 by Paul Dale No problem - all this can be done with two other functions that are available on HP calculators since 1979 - and today again on the 34s: ``` sqrt(1+x^2) - 1 1 - sqrt(1-x^2) = exp(ln(1+x^2)/2) - 1 = 1 - exp(ln(1-x^2)/2 LBL A LBL B x^2 x^2 LN1+x +/- 2 LN1+x / 2 e^x-1 / RTN e^x-1 +/- RTN ``` That's what these functions are made for. ;-) Dieter

 Re: Sqrt(1 - x^2) & Sqrt(1 + x^2) functionsMessage #6 Posted by Eduardo Duenez on 10 May 2012, 10:04 a.m.,in response to message #4 by Paul Dale It's true that a numerically stable formula for sqrt(1-x^2)-1 for small x can be given in terms of ln(x+1) and exp(x)-1. However, a logarithm/exp combination is a very inefficient way to compute these functions! (E.g., the algorithm for x^2 is not exponentiating twice the log. For that matter, efficient algorithms for x^2 do not simply multiply x by itself.) A related thought: On the opposite case, when abs(x) is close to 1, say for concreteness that x=1-t for some small t, then evaluating sqrt(1-(1-t)^2) directly is numerically unstable, but never forget your algebra: rewrite in the stable form sqrt(t*(2-t)).

 Re: Sqrt(1 - x^2) & Sqrt(1 + x^2) functionsMessage #7 Posted by Paul Dale on 10 May 2012, 6:28 p.m.,in response to message #6 by Eduardo Duenez Alternatively, multiply through by (1 + sqrt(1-x2)) over itself. A little bit of algebra leads to this formula: 1-sqrt(1-x2) = x2 / (1 + sqrt(1-x2)) which is stable. The same can be done for sqrt(1+x2)-1. - Pauli

 Re: Sqrt(1 - x^2) & Sqrt(1 + x^2) functionsMessage #8 Posted by Palmer O. Hanson, Jr. on 10 May 2012, 10:27 p.m.,in response to message #1 by Gerson W. Barbosa The old NOVUS 4510 Mathematician had a function (M + x2).

 Re: Sqrt(1 - x^2) & Sqrt(1 + x^2) functionsMessage #9 Posted by Matt Agajanian on 10 May 2012, 11:06 p.m.,in response to message #8 by Palmer O. Hanson, Jr. Yeah. I remember that too. Wonder if that was added to give the 4510 a competitive edge, features incentive over TI & HP. Edited: 10 May 2012, 11:07 p.m.

 Re: Sqrt(1 - x^2) & Sqrt(1 + x^2) functionsMessage #10 Posted by Palmer O. Hanson, Jr. on 11 May 2012, 11:02 p.m.,in response to message #9 by Matt Agajanian If you go to Article 437 you will see that the function permitted efficient accumulation of the sums needed for single variable statistical analysis in a machine which did not have a built-in Sum+ capability.

Go back to the main exhibit hall