exp -- the exponential function
Introductionexp(x) represents the value of the
exponential function at the point x.
Call(s)exp(x)
Parametersx |
- | an arithmetical expression |
Returnsan arithmetical expression
x
Side
EffectsWhen called with a floating point argument, the function is
sensitive to the environment variable DIGITS which determines the numerical
working precision.
Related
Functions
DetailsType::Constant) yields the
result y^c.lambertV or lambertW.Numerical overflow/underflow may happen, when the
absolute value of the real part of a floating point argument
x is large. A protection against underflow is implemented:
if Re(x) < -10^6, then exp(x)
may return the truncated result 0.0. Cf. example 2.
E is an alias for
exp(1).
Example
1We demonstrate some calls with exact and symbolic input data:
>> E, exp(2), exp(-3), exp(1/4), exp(1 + I), exp(x^2)
2
exp(1), exp(2), exp(-3), exp(1/4), exp(1 + I), exp(x )
Floating point values are computed for floating point arguments:
>> exp(1.23), exp(4.5 + 6.7*I), exp(1.0/10^20), exp(123456.7)
3.421229536, 82.31014791 + 36.44342846 I, 1.0,
3.660698702e53616
Some special symbolic simplifications are implemented:
>> exp(I*PI), exp(x - 22*PI*I), exp(3 + I*PI)
-1, exp(x), -exp(3)
>> exp(ln(-2)), exp(ln(x)*PI), exp(lambertW(5))
PI 5
-2, x , -----------
lambertW(5)
Example
2The truncated result 0.0 may be returned
for floating point arguments with negative real parts. This prevents
numerical underflow:
>> exp(-5.81*10^6), exp(-5.82*10^6)
1.148529374e-2523251, 0.0
>> exp(-5.81*10^6 + 10^10*I), exp(-5.82*10^6 + 10^10*I)
1.002803534e-2523251 - 5.599149896e-2523252 I, 0.0
No such protection is implemented for numerical overflow:
>> exp(5.81*10^6)
8.706786458e2523250
>> exp(5.82*10^6)
Error: Overflow/underflow in arithmetical operation;
during evaluation of 'exp::float'
Example
3System functions such as limit, series, expand, combine etc. handle expressions
involving exp:
>> limit(x*exp(-x), x = infinity), series(exp(x/(x + 1)), x = 0)
2 3 4 5
x x x 19 x 6
0, 1 + x - -- + -- + -- - ----- + O(x )
2 6 24 120
>> expand(exp(x + y + (sqrt(2) + 5)*PI*I))
1/2
- exp(x) exp(y) exp(I PI 2 )
>> combine(%, exp)
1/2
- exp(x + y + I PI 2 )
0.0 may
now be returned for floating point arguments with large negative real
part. The special values exp(infinity) = infinity and
exp(-infinity) = 0 were implemented.