Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Exponential function
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=={{anchor|exp|expm1}}Computation== The Taylor series definition above is generally efficient for computing (an approximation of) <math>e^x</math>. However, when computing near the argument <math>x=0</math>, the result will be close to 1, and computing the value of the difference <math>e^x-1</math> with [[floating-point arithmetic]] may lead to the loss of (possibly all) [[significant figures]], producing a large relative error, possibly even a meaningless result. Following a proposal by [[William Kahan]], it may thus be useful to have a dedicated routine, often called <code>expm1</code>, which computes {{math|''e<sup>x</sup>'' β 1}} directly, bypassing computation of {{math|''e''{{isup|''x''}}}}. For example, one may use the Taylor series: <math display="block">e^x-1=x+\frac {x^2}2 + \frac{x^3}6+\cdots +\frac{x^n}{n!}+\cdots.</math> This was first implemented in 1979 in the [[Hewlett-Packard]] [[HP-41C]] calculator, and provided by several calculators,<ref name="HP48_AUR"/><ref name="HP50_AUR"/> [[operating system]]s (for example [[Berkeley UNIX 4.3BSD]]<ref name="Beebe_2017"/>), [[computer algebra system]]s, and programming languages (for example [[C99]]).<ref name="Beebe_2002"/> In addition to base {{math|''e''}}, the [[IEEE 754-2008]] standard defines similar exponential functions near 0 for base 2 and 10: <math>2^x - 1</math> and <math>10^x - 1</math>. A similar approach has been used for the logarithm; see [[log1p]]. An identity in terms of the [[hyperbolic tangent]], <math display="block">\operatorname{expm1} (x) = e^x - 1 = \frac{2 \tanh(x/2)}{1 - \tanh(x/2)},</math> gives a high-precision value for small values of {{math|''x''}} on systems that do not implement {{math|expm1(''x'')}}. ===Continued fractions=== The exponential function can also be computed with [[continued fraction]]s. A continued fraction for {{math|''e''{{isup|''x''}}}} can be obtained via [[Euler's continued fraction formula|an identity of Euler]]: <math display="block"> e^x = 1 + \cfrac{x}{1 - \cfrac{x}{x + 2 - \cfrac{2x}{x + 3 - \cfrac{3x}{x + 4 - \ddots}}}}</math> The following [[generalized continued fraction]] for {{math|''e''{{isup|''z''}}}} converges more quickly:<ref name="Lorentzen_2008"/> <math display="block"> e^z = 1 + \cfrac{2z}{2 - z + \cfrac{z^2}{6 + \cfrac{z^2}{10 + \cfrac{z^2}{14 + \ddots}}}}</math> or, by applying the substitution {{math|1=''z'' = {{sfrac|''x''|''y''}}}}: <math display="block"> e^\frac{x}{y} = 1 + \cfrac{2x}{2y - x + \cfrac{x^2} {6y + \cfrac{x^2} {10y + \cfrac{x^2} {14y + \ddots}}}}</math> with a special case for {{math|1=''z'' = 2}}: <math display="block"> e^2 = 1 + \cfrac{4}{0 + \cfrac{2^2}{6 + \cfrac{2^2}{10 + \cfrac{2^2}{14 + \ddots }}}} = 7 + \cfrac{2}{5 + \cfrac{1}{7 + \cfrac{1}{9 + \cfrac{1}{11 + \ddots }}}}</math> This formula also converges, though more slowly, for {{math|''z'' > 2}}. For example: <math display="block"> e^3 = 1 + \cfrac{6}{-1 + \cfrac{3^2}{6 + \cfrac{3^2}{10 + \cfrac{3^2}{14 + \ddots }}}} = 13 + \cfrac{54}{7 + \cfrac{9}{14 + \cfrac{9}{18 + \cfrac{9}{22 + \ddots }}}}</math>
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Exponential function
(section)
Add topic