ln
-- the natural logarithmln
(x)
represents the natural logarithm of
x.
ln(x)
x |
- | an arithmetical expression |
an arithmetical expression.
x
When called with a floating point argument, the function is
sensitive to the environment variable DIGITS
which determines the numerical
working precision.
Type::Numeric
yield the result ln(exp(y)) = y + k*2*PI*I. Here
k is some suitable integer, such that the imaginary part of
the result lies in the interval (-PI,PI].expand
, combine
or simplify
to manipulate expressions
involving ln
. Cf. example 4.We demonstrate some calls with exact and symbolic input data:
>> ln(2), ln(-3), ln(1/4), ln(1 + I), ln(x^2)
2 ln(2), I PI + ln(3), -ln(4), ln(1 + I), ln(x )
Floating point values are computed for floating point arguments:
>> ln(123.4), ln(5.6 + 7.8*I), ln(1.0/10^20)
4.815431112, 2.261980065 + 0.948125538 I, -46.05170186
Some special symbolic simplifications are implemented:
>> ln(1), ln(-1), ln(exp(-5)), ln(exp(5 + 27/4*I))
0, I PI, -5, (5 + 27/4 I) - 2 I PI
The negative real axis is a branch cut. The imaginary
part of the values returned by ln
jump when crossing this
cut:
>> ln(-2.0), ln(-2.0 + I/10^1000), ln(-2.0 - I/10^1000)
0.6931471806 + 3.141592654 I, 0.6931471806 + 3.141592654 I, 0.6931471806 - 3.141592654 I
The functions diff
, float
, limit
, series
etc. handle expressions
involving ln
:
>> diff(ln(x^2), x), float(ln(PI + I))
2 -, 1.192985153 + 0.3081690711 I x
>> limit(ln(x)/x, x = infinity), series(x*ln(sin(x)), x = 0, 10)
3 5 7 9 x x x x 10 0, x ln(x) - -- - --- - ---- - ----- + O(x ) 6 180 2835 37800
The functions expand
, combine
, and simplify
react to properties set
via assume
. The
following call does not produce an expanded result, because the
arithmetical rule ln(x*y) = ln(x) + ln(y) does not hold for
arbitrary complex x,y:
>> expand(ln(x*y))
ln(x y)
However, the rule is valid, if one of the factors is real and positive:
>> assume(x > 0): expand(ln(x*y))
ln(x) + ln(y)
>> combine(%, ln)
ln(x y)
>> simplify(ln(x^3*y) - ln(x) - ln(y))
2 ln(x)
>> unassume(x):