Log
Details
- Log is a mathematical function, suitable for both symbolic and numerical manipulation.
- Log gives exact rational number results when possible.
- For certain special arguments, Log automatically evaluates to exact values.
- Log can be evaluated to arbitrary numerical precision.
- Log automatically threads over lists.
- Log[z] has a branch cut discontinuity in the complex z plane running from
to
. - Log can be used with Interval and CenteredInterval objects. »
Examples
open all close allBasic Examples (6)
Log gives the natural logarithm (to base
):
Log[1000.]Log[b,z] gives the logarithm to base b:
Log[10, 1000]Plot over a subset of the reals:
Plot[Log[x], {x, 0, 5}]Plot over a subset of the complexes:
ComplexPlot3D[Log[z ^ 3], {z, -2 - 2I, 2 + 2I}, PlotLegends -> Automatic]Series expansion shifted from the origin:
Series[Log[1 + x], {x, 0, 10}]Asymptotic expansion at a singular point:
Series[Log[x], {x, -1, 3}, Assumptions -> Im[x] > 0]Scope (51)
Numerical Evaluation (7)
Log[1.5]Log[3, 1.5]Evaluate numerically to high precision:
N[Log[5 / 2], 50]The precision of the output tracks the precision of the input:
Log[2.50000000000000000000000000000000000000000000]Log[2.5 + I]Evaluate Log efficiently at high precision:
Log[2.5`500]//TimingLog[2.5`100000];//TimingLog threads elementwise over lists and matrices:
Log[{1, 2.1, 3.1, 4.1}]Log[(| | |
| :- | :- |
| 1 | u |
| v | 0 |)]//MatrixFormIt threads over lists in either argument:
Log[{2, E, 10}, 2.5]Log[2, {2, 4, 8}]Compute worst-case guaranteed intervals using Interval and CenteredInterval objects:
Log[Interval[{1 / 3, E}]]Log[2, CenteredInterval[7, 1 / 10]]Log[CenteredInterval[2 + 3I, (1 + I) / 10]]Or compute average-case statistical intervals using Around:
Log[ E, Around[2, 0.01]]Compute the elementwise values of an array:
Log[2, {{E, -1}, {0, 1 / 2}}]Or compute the matrix Log function using MatrixFunction:
MatrixFunction[Log[2, #]&, {{E, -1}, {0, 1 / 2}}]//FullSimplifySpecific Values (5)
Simple exact values are generated automatically:
Log[E]Log[2, 1024]Log[3, 3 ^ -12]Log[Pi, Sqrt[Pi]]Log[Infinity]Log[ComplexInfinity]Zero argument gives a symbolic result:
Log[0]Zero of Log:
Log[b, 1]Find a value of x for which the Log[x]=0.5:
xval = x /. FindRoot[Log[x] == 0.5, {x, 0.1}]Plot[Log[x], {x, 0, 2E}, Epilog -> Style[Point[{xval, Log[xval]}], PointSize[Large], Red]]Visualization (3)
Plot the Log function:
Plot[Log[x], {x, 0, 4}]ComplexContourPlot[Re[Log[z]], {z, -2 - 2I, 2 + 2 I}, Contours -> 20]ComplexContourPlot[Im[Log[z]], {z, -2 - 2I, 2 + 2 I}, Contours -> 20]PolarPlot[Log[ϕ], {ϕ, 0, 12π}, Frame -> True]Function Properties (12)
Log[z] gives the logarithm with base E:
Log[E, z]Log is defined for all real positive values:
FunctionDomain[Log[x], x]FunctionDomain[Log[z], z, Complexes]Log achieves all real values:
FunctionRange[Log[x], x, y]FunctionRange[Log[z], z, y, Complexes]Solve[Exp[y] == x, y, Reals]FunctionAnalytic[Log[x], x]FunctionMeromorphic[Log[x], x]The issue is a branch cut along the negative real axis:
Limit[Log[-2 + ϵ I], ϵ -> 0, Direction -> "FromAbove"]Limit[Log[-2 + ϵ I], ϵ -> 0, Direction -> "FromBelow"]The branch cut exists for any fixed value of
:
FunctionMeromorphic[Log[b, x], x, Assumptions -> Log[b] ≠ 0]
is increasing on the positive reals for
and decreasing for
:
FunctionMonotonicity[Log[b, x], x, PositiveReals, Assumptions -> b > 1]FunctionMonotonicity[Log[b, x], x, PositiveReals, Assumptions -> 0 < b < 1]Log is injective:
FunctionInjective[Log[x], x]Plot[{Log[x], 1 / 2}, {x, 0, 5}]Log is surjective:
FunctionSurjective[Log[x], x]Plot[{Log[x], 5}, {x, 0, 200}]Log is neither non-negative nor non-positive:
FunctionSign[Log[x], x]
has both singularities and discontinuities for x≤0:
FunctionSingularities[Log[b, x], x]FunctionDiscontinuities[Log[b, x], x]
is concave on the positive reals for
and convex for
:
FunctionConvexity[{Log[b, x], x > 0}, x, Assumptions -> b > 1]FunctionConvexity[{Log[b, x], x > 0}, x, Assumptions -> 0 < b < 1]TraditionalForm formatting:
Log[x]//TraditionalFormLog[b, x]//HoldForm//TraditionalFormDifferentiation (5)
The first derivative with respect to z:
D[Log[z], z]The first derivative with respect to b:
D[Log[b, z], b]Table[D[Log[x], {x, n}], {n, 1, 4}]Plot[Evaluate[%], {x, 0, 3}, PlotLegends -> {"First Derivative", "Second Derivative", "Third Derivative", "Fourth Derivative"}]D[Log[x], {x, n}]Derivative of a nested logarithmic function:
D[Log[Log[x]], x]Integration (3)
Indefinite integrals of Log:
Integrate[Log[x], x]Integrate[Log[b, x], x]Definite integral of Log:
Integrate[Log[x], {x, 0, 1}]Integrate[Log[z]^a, z]Integrate[Exp[-t]Log[t], {t, 0, 1}]Integrate[(Log[a + b z]^2/e + f z), z]Integrate[a^α - 1Log[a, z], a]Series Expansions (5)
Taylor expansion for Log:
Series[Log[x], {x, 1, 4}]Plot the first three approximations for Log around
:
terms = Normal@Table[Series[Log[x], {x, 1, m}], {m, 1, 3}];
Plot[{Log[x], terms}, {x, 0, 2}]General term in the series expansion of Log around
:
SeriesCoefficient[Log[x], {x, 1, n}]Asymptotic expansions at the branch cut:
Series[Log[x], {x, -2, 3}]The first term in the Fourier series of Log:
FourierSeries[Log[z], z, 1]Log can be applied to power series:
Log[x + (x^2/2) + (x^3/3) + O[x]^4]Log[a + (a^2/2) + (a^3/3) + O[a]^4, x]//SimplifyFunction Identities and Simplifications (6)
Basic identity for Log:
b ^ Log[b, x]Logarithm of a power function simplification:
FunctionExpand[Log[x^a], x > 0 && a∈Reals]Simplify logarithms with assumptions:
Log[E ^ n]Simplify[%, n > 0]FunctionExpand[Log[x y], x > 0 && x + y ≥ 0]FullSimplify[Log[b, x] == (Log[a, x]/Log[a, b])]Expand assuming real variables x and y:
ComplexExpand[Log[x + I y]]Function Representations (5)
Integrate[1 / t, {t, 1, x}, Assumptions -> Re[x] > 0 || x∉Reals]Sum[(-1)^k - 1((z - 1)^k/k), {k, 1, Infinity}]Log arises from the power function in a limit:
Limit[(z^ϵ - 1/ϵ), ϵ -> 0]Log can be represented in terms of MeijerG:
Log[x] == MeijerG[{{1, 1}, {}}, {{1}, {0}}, x - 1]//FullSimplifyLog can be represented as a DifferentialRoot:
DifferentialRootReduce[Log[x], x]Generalizations & Extensions (2)
Applications (8)
Plot Log for various bases:
Plot[{Log[2, x], Log[E, x], Log[10, x]}, {x, 0.5, 10}]Plot the real and imaginary parts of Log:
Plot[{Re[Log[x]], Im[Log[x]]}, {x, -2, 2}, PlotStyle -> Thick]Plot the real and imaginary parts over the complex plane:
{Plot3D[Re[Log[x + I y]], {x, -2, 2}, {y, -2, 2}], Plot3D[Im[Log[x + I y]], {x, -2, 2}, {y, -2, 2}]}Plot data logarithmically and doubly logarithmically:
data = Table[{x / 100, (x / 100) ^ 5}, {x, 100}];{ListPlot[data], ListLogPlot[data], ListLogLogPlot[data]}//RowBenford's law predicts that the probability of the first digit is
in many sequences:
Table[{n, Log[10, 1 + 1. / n]}, {n, 1, 9}]Analyze the first digits of the following sequence:
seq = NestList[3 / 2(# + Mod[#, 2])&, 1, 9999];
Take[seq, 15]Use Tally to count occurrences of each digit:
Sort[Tally[IntegerDigits[seq][[All, 1]]]]Shannon entropy for a set of probabilities:
h[p_List] := -p.Log[p]Equi‐entropy surfaces for four symbols:
h[{p1, p2, p3, 1 - p1 - p2 - p3}]ContourPlot3D[Re[%], {p1, 0, 1}, {p2, 0, 1}, {p3, 0, 1}, RegionFunction -> (1 - #1 - #2 - #3 > 0&), Contours -> 5]ListPlot[{Table[Prime[n], {n, 2, 100}], Table[Round[ n(Log[n] + Log[Log[n]] - 1)], {n, 2, 100}]}]Exponential divergence of two nearby trajectories for a quadratic map:
ListPlot[Log[Abs[NestList[38 / 10 #(1 - #)&, N[1 / 4, 1000], 200] - NestList[38 / 10 #(1 - #)&, N[1 / 4 + 10 ^ -20, 1000], 200]]]]Properties & Relations (13)
Compositions with the inverse function might need PowerExpand:
Exp[Log[z]]Log[Exp[z]]PowerExpand[%]Get expansion that is correct for all complex arguments:
PowerExpand[Log[Exp[z]], Assumptions -> {}]PowerExpand[Log[(1/z)], Assumptions -> {}]PowerExpand[Log[z w], Assumptions -> {}]PowerExpand[Log[z ^ 2], Assumptions -> {}]PowerExpand[Log[z ^ a], Assumptions -> {}]Simplify logarithms with assumptions:
Log[E ^ n]Simplify[%, n > 0]Refine[%%, n > 0]Convert inverse trigonometric and hyperbolic functions into logarithms:
TrigToExp[{ArcSin[z], ArcCosh[z]}]Log arises from the power function in a limit:
Limit[(z^ϵ - 1/ϵ), ϵ -> 0]Reduce[Log[z]^3 - 5 Log[z] == 2, z]Reduce a logarithmic equation:
Reduce[Log[Exp[z]] == w, z]Numerically find a root of a transcendental equation:
FindRoot[Log[z]^2 - 5 Log[z + 3] + z == 6, {z, 10}]The natural logarithms of integers are transcendental:
Refine[Log[n]∈Algebraics, n∈Integers && n > 1]LaplaceTransform[Log[t], t, s]FourierTransform[Log[t], t, s]DSolve[a w[a] Derivative[2][w][a] - 2 a Derivative[1][w][a]^2 + w[a] Derivative[1][w][a] == 0, w, a]DSolve[w'[a] + Log[a]w[a] == 0, w, a]Limit[x^1 - Log[Log[Log[(1/x)]]], x -> 0]Log is automatically returned as a special case for various special functions:
{HypergeometricPFQ[{1, 1}, {2}, z], MeijerG[{{1, 1}, {}}, {{1}, {0}}, z]}Possible Issues (7)
For a symbolic base, the base b log evaluates to a quotient of logarithms:
Log[b, z]Log[Exp[-100. I]]Exp[Log[-100. I]]Because intermediate results can be complex, approximate zeros can appear:
Exp[Log[-SetPrecision[100, 50] I]]Machine-precision inputs can give numerically wrong answers on branch cuts:
Log[-2 + I ((Pi + 1) ^ 2 - Pi ^ 2 - 2Pi - 1 - Exp[-Pi ^ 4])]//NUse arbitrary‐precision arithmetic to obtain correct results:
Log[-2 + I ((Pi + 1) ^ 2 - Pi ^ 2 - 2Pi - 1 - Exp[-Pi ^ 4])]//N[#, 100]&//NCompositions of logarithms can give functions that are zero almost everywhere:
f[z_] := Log[z] + Log[1 / z]ListPlot3D[Flatten[Table[{x, y, Im[f[x + I y]]}, {x, -3, 3, 6 / 25}, {y, -3, 3, 6 / 24}], 1], PlotRange -> All]This function is a differential-algebraic constant:
D[f[z], z]Logarithmic branch cuts can occur without their corresponding branch point:
f[z_] = Log[z + Sqrt[-1 + z] Sqrt[1 + z]];The argument of the logarithm never vanishes:
Reduce[z + Sqrt[-1 + z] Sqrt[1 + z] == 0, z, Complexes]But it can take negative values, so the logarithm has a branch cut:
(z + Sqrt[-1 + z] Sqrt[1 + z]) /. z -> -7The kink at
marks the appearance of the second sheet:
Plot3D[Im[f[x + I y]], {x, -3, 3}, {y, -1, 1}, Exclusions -> {{y == 0, x < 1}}]Logarithmic terms in Puiseux series are considered coefficients inside SeriesData:
Series[x ^ x + Log[Log[1 / x]], {x, 0, 3}]InputForm[%]In traditional form, parentheses are needed around the argument:
log xlog(x)ln(x)Subscript[log, b](x)Neat Examples (6)
Successive integrals of the log function:
NestList[Integrate[#, x]&, Log[x], 4]p[z_] = z^3 - 2 z^2 + I z + 3;
ParametricPlot[{Log[Abs[r E^I φ]], Log[Abs[p[r E^I φ]]]}, {r, 0.01, 4}, {φ, 0, 2 π}]Plot the Riemann surface of Log:
ParametricPlot3D[{Re[Exp[x + I y]], Im[Exp[x + I y]], y}, {x, -2, 2}, {y, -2Pi, 2Pi}]Plot Log at integer points:
ArrayPlot[Table[FractionalPart[Abs[Log[x y]]], {x, -20, 20}, {y, -20, 20}]]Calculate Log through an analytically continued summed Taylor series:
log[n_, z_] = (z - 1)Underoverscript[∑, k = 0, n]((-1)^k(z - 1)^k/1 + k)Visualize how the value is approached as
:
Log[0.1 + 0.2I]Plot[{Re@log[n, 0.1 + 0.2I], Im@log[n, 0.1 + 0.2I]}, {n, 0, 20}]Plot the Riemann surface of Log[Log[z]]:
ParametricPlot3D[Evaluate[{Re[Exp[Exp[x + I y]]], Im[Exp[Exp[x + I y]]], y}], {x, -2, 2}, {y, -2Pi, 2Pi}, BoxRatios -> {1, 1, 3 / 2}]Tech Notes
History
Introduced in 1988 (1.0) | Updated in 2021 (13.0)
Text
Wolfram Research (1988), Log, Wolfram Language function, https://reference.wolfram.com/language/ref/Log.html (updated 2021).
CMS
Wolfram Language. 1988. "Log." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/Log.html.
APA
Wolfram Language. (1988). Log. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Log.html
BibTeX
@misc{reference.wolfram_2026_log, author="Wolfram Research", title="{Log}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/Log.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_log, organization={Wolfram Research}, title={Log}, year={2021}, url={https://reference.wolfram.com/language/ref/Log.html}, note=[Accessed: 13-June-2026]}