Computer Science, asked by rohit123425, 11 months ago

what is the algorithm for scientific calculator​

Answers

Answered by FIREFROST
0

Mathematics Series 55 (which is available for free on-line), lists several polynomial approximations to the natural logarithm function in formulas 4.1.41 through 4.1.44. The Handbook says these approximations are from C. Hastings Jr., Approximations for digital computers. The most accurate of the formulas, 4.1.44, reads

ln(1+x)=a1x+a2x2+a3x3+a4x4+a5x5+a6x6+a7x7+a8x8+ϵ(x)

for 0≤x≤1 with |ϵ(x)|≤3×10−8, where

a1a2a3a4a5a6a7a8=.9999964239=−.4998741238=.3317990258=−.2407338084=.1676540711=−.0953293897=.0360884937=−.0064535422

Answered by taimurwazir80
0

4

Modern Computer Arithmetic suggests using an arithmetic-geometric mean algorithm. I'm not sure if this approach is meant for the low amount of precision one typically works with or if its meant for calculation in very high precision.

Another approach is to observe that the Taylor series for ln(x) is efficient if x is very close to 1. We can use algebraic identities to reduce the general case to this special case.

One method is to use the identity

ln(x)=2ln(x−−√)

to reduce the calculation of ln(x) to that of an argument closer to 1. We could use a similar identity for more general radicals if we can compute those efficiently.

By iteratively taking roots until we get an argument very close to 1, we can reduce to

ln(x)=mln(x−−√m)

which can be computed by the Taylor series.

If you store numbers in mantissa-exponent form in base 10, an easy identity to exploit isln(m⋅10e)=eln(10)+ln(m)

so the plan is to precompute the value of ln(10), and then use another method to obtain ln(m), where m is not large or small.

A similar identity holds in base 2, which a computer is likely to use.

A way to use lookup tables to accelerate the calculation of ln(x) when x is not large or small is to observe that

ln(x)=ln(k)+ln(x/k)

The idea here is that you store a table of ln(k) for enough values of k so that you can choose the k nearest x to make x/k very near 1, and then all that's left is to compute ln(x/k).

                      OR

3

The Handbook of Mathematical Functions by Abramowitz and Stegun, National Bureau of Standards Applied Mathematics Series 55 (which is available for free on-line), lists several polynomial approximations to the natural logarithm function in formulas 4.1.41 through 4.1.44. The Handbook says these approximations are from C. Hastings Jr., Approximations for digital computers. The most accurate of the formulas, 4.1.44, reads

ln(1+x)=a1x+a2x2+a3x3+a4x4+a5x5+a6x6+a7x7+a8x8+ϵ(x)

for 0≤x≤1 with |ϵ(x)|≤3×10−8, where

a1a2a3a4a5a6a7a8=.9999964239=−.4998741238=.3317990258=−.2407338084=.1676540711=−.0953293897=.0360884937=−.0064535422

Similar questions