What algorithm do scientific calculators use to calculate Logarithms
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I have been introduced to numerical analysis and have been researching quite a bit on its applications recently. One specific application would be the scientific calculator.
From the information that I found, computers typically use the Taylor Series to compute trigonometric problems and calculators would usually take a different approach and use the CORDIC algorithm to compute such problems, including hyperbolic, inverse trigo, square roots etc.
However, how would they calculate logarithmic problems? I couldn't really find any information about this and was hoping someone would point me in the right direction or provide any insights on what kind of algorithms are used is such calculations.
Thanks in advance.
numerical-methods logarithms applications calculator
add a comment |Â
up vote
2
down vote
favorite
I have been introduced to numerical analysis and have been researching quite a bit on its applications recently. One specific application would be the scientific calculator.
From the information that I found, computers typically use the Taylor Series to compute trigonometric problems and calculators would usually take a different approach and use the CORDIC algorithm to compute such problems, including hyperbolic, inverse trigo, square roots etc.
However, how would they calculate logarithmic problems? I couldn't really find any information about this and was hoping someone would point me in the right direction or provide any insights on what kind of algorithms are used is such calculations.
Thanks in advance.
numerical-methods logarithms applications calculator
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I have been introduced to numerical analysis and have been researching quite a bit on its applications recently. One specific application would be the scientific calculator.
From the information that I found, computers typically use the Taylor Series to compute trigonometric problems and calculators would usually take a different approach and use the CORDIC algorithm to compute such problems, including hyperbolic, inverse trigo, square roots etc.
However, how would they calculate logarithmic problems? I couldn't really find any information about this and was hoping someone would point me in the right direction or provide any insights on what kind of algorithms are used is such calculations.
Thanks in advance.
numerical-methods logarithms applications calculator
I have been introduced to numerical analysis and have been researching quite a bit on its applications recently. One specific application would be the scientific calculator.
From the information that I found, computers typically use the Taylor Series to compute trigonometric problems and calculators would usually take a different approach and use the CORDIC algorithm to compute such problems, including hyperbolic, inverse trigo, square roots etc.
However, how would they calculate logarithmic problems? I couldn't really find any information about this and was hoping someone would point me in the right direction or provide any insights on what kind of algorithms are used is such calculations.
Thanks in advance.
numerical-methods logarithms applications calculator
asked Aug 6 at 5:06


Wei Xiong Yeo
987
987
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
4
down vote
accepted
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) = 2 ln(sqrtx)$$
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) = m ln(sqrt[m]x)$$
which can be computed by the Taylor series.
If you store numbers in mantissa-exponent form in base 10, an easy identity to exploit is
$$ ln(m cdot 10^e) = e ln(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)$.
add a comment |Â
up vote
3
down vote
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)=a_1 x + a_2 x^2 + a_3 x^3 + a_4 x^4 + a_5 x^5 + a_6 x^6 + a_7 x^7 + a_8 x^8 + epsilon(x)$$
for $0 le x le 1$ with $| epsilon(x) | le 3 times 10 ^-8$, where
$$beginalign
a_1 &= .99999 ;64239 \
a_2 &= -.49987 ;41238 \
a_3 &= .33179 ;90258 \
a_4 &= -.24073 ;38084 \
a_5 &= .16765 ;40711 \
a_6 &= -.09532 ;93897 \
a_7 &= .03608 ;84937 \
a_8 &= -.00645 ;35422
endalign$$
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
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) = 2 ln(sqrtx)$$
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) = m ln(sqrt[m]x)$$
which can be computed by the Taylor series.
If you store numbers in mantissa-exponent form in base 10, an easy identity to exploit is
$$ ln(m cdot 10^e) = e ln(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)$.
add a comment |Â
up vote
4
down vote
accepted
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) = 2 ln(sqrtx)$$
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) = m ln(sqrt[m]x)$$
which can be computed by the Taylor series.
If you store numbers in mantissa-exponent form in base 10, an easy identity to exploit is
$$ ln(m cdot 10^e) = e ln(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)$.
add a comment |Â
up vote
4
down vote
accepted
up vote
4
down vote
accepted
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) = 2 ln(sqrtx)$$
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) = m ln(sqrt[m]x)$$
which can be computed by the Taylor series.
If you store numbers in mantissa-exponent form in base 10, an easy identity to exploit is
$$ ln(m cdot 10^e) = e ln(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)$.
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) = 2 ln(sqrtx)$$
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) = m ln(sqrt[m]x)$$
which can be computed by the Taylor series.
If you store numbers in mantissa-exponent form in base 10, an easy identity to exploit is
$$ ln(m cdot 10^e) = e ln(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)$.
edited Aug 6 at 6:12
answered Aug 6 at 5:47
Hurkyl
108k9112253
108k9112253
add a comment |Â
add a comment |Â
up vote
3
down vote
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)=a_1 x + a_2 x^2 + a_3 x^3 + a_4 x^4 + a_5 x^5 + a_6 x^6 + a_7 x^7 + a_8 x^8 + epsilon(x)$$
for $0 le x le 1$ with $| epsilon(x) | le 3 times 10 ^-8$, where
$$beginalign
a_1 &= .99999 ;64239 \
a_2 &= -.49987 ;41238 \
a_3 &= .33179 ;90258 \
a_4 &= -.24073 ;38084 \
a_5 &= .16765 ;40711 \
a_6 &= -.09532 ;93897 \
a_7 &= .03608 ;84937 \
a_8 &= -.00645 ;35422
endalign$$
add a comment |Â
up vote
3
down vote
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)=a_1 x + a_2 x^2 + a_3 x^3 + a_4 x^4 + a_5 x^5 + a_6 x^6 + a_7 x^7 + a_8 x^8 + epsilon(x)$$
for $0 le x le 1$ with $| epsilon(x) | le 3 times 10 ^-8$, where
$$beginalign
a_1 &= .99999 ;64239 \
a_2 &= -.49987 ;41238 \
a_3 &= .33179 ;90258 \
a_4 &= -.24073 ;38084 \
a_5 &= .16765 ;40711 \
a_6 &= -.09532 ;93897 \
a_7 &= .03608 ;84937 \
a_8 &= -.00645 ;35422
endalign$$
add a comment |Â
up vote
3
down vote
up vote
3
down vote
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)=a_1 x + a_2 x^2 + a_3 x^3 + a_4 x^4 + a_5 x^5 + a_6 x^6 + a_7 x^7 + a_8 x^8 + epsilon(x)$$
for $0 le x le 1$ with $| epsilon(x) | le 3 times 10 ^-8$, where
$$beginalign
a_1 &= .99999 ;64239 \
a_2 &= -.49987 ;41238 \
a_3 &= .33179 ;90258 \
a_4 &= -.24073 ;38084 \
a_5 &= .16765 ;40711 \
a_6 &= -.09532 ;93897 \
a_7 &= .03608 ;84937 \
a_8 &= -.00645 ;35422
endalign$$
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)=a_1 x + a_2 x^2 + a_3 x^3 + a_4 x^4 + a_5 x^5 + a_6 x^6 + a_7 x^7 + a_8 x^8 + epsilon(x)$$
for $0 le x le 1$ with $| epsilon(x) | le 3 times 10 ^-8$, where
$$beginalign
a_1 &= .99999 ;64239 \
a_2 &= -.49987 ;41238 \
a_3 &= .33179 ;90258 \
a_4 &= -.24073 ;38084 \
a_5 &= .16765 ;40711 \
a_6 &= -.09532 ;93897 \
a_7 &= .03608 ;84937 \
a_8 &= -.00645 ;35422
endalign$$
answered Aug 6 at 14:30
awkward
5,14111021
5,14111021
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2873604%2fwhat-algorithm-do-scientific-calculators-use-to-calculate-logarithms%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password