Skip to content

Log ​

The logarithm of z in base b, defaulting to base 10.

WikipediaLogarithmMathWorldLogarithmWikidataQ11197Encyclopedia of MathematicsLogarithm_of_a_numbernLablogarithmBritannicascience/logarithmFungrimLog
Log(z)the base-10 logarithm of z.
SageMathlog(z, 10)!SymPylog(z, 10)mpmathlog(z, 10)Juliaenumeratio_ball(_log10, z)Rustlog10(z)
Log(z, b)the logarithm of z in base b.
SageMathlog(z, b)!SymPylog(z, b)mpmathlog(z, b)Juliaenumeratio_ball(_log_base, z, b)
Log(z, b = 10)The logarithm of z in base b, defaulting to base 10.
SageMathlog(z, b = 10)!SymPylog(z, b = 10)mpmathlog(z, b = 10)Juliaenumeratio_ball(_log_base, z, b = 10)
Typed signatures
TypePackageApplies
(complex | infinity, base: (complex | infinity)?) -> numberanalyticreplaces compute-enginealways
(complex | infinity, base: (complex | infinity)?) -> numbercompute-enginealways

Domain: Elementary functions

Details
  • compute-engine's default base is 10, not ee: Log(z) means log⁡10(z)\log_{10}(z), and Ln is the natural logarithm.
  • compute-engine's Log(z,b)\mathrm{Log}(z, b) takes the value first (value, then base) and defaults to base 10 in the one-argument form; for the natural logarithm use Ln.
  • Product rule: log⁡b(xy)=log⁡b(x)+log⁡b(y)\log_b(xy) = \log_b(x) + \log_b(y). Power rule: log⁡b(xk)=klog⁡b(x)\log_b(x^k) = k \log_b(x).

Plot

ComplexPlot
real slice

Examples

4 more kept as data, checked against the oracles
Basic #

Default base is 10

live ↗
Inlog⁡10(100)\log_{10}(100)Out22

Same result written with an explicit base

live ↗
Inlog⁡10(100)\log_{10}(100)Out22

Base 2 via the explicit second argument

live ↗
Inlog⁡2(8)\log_{2}(8)Out33
Scope #

log⁡31.5\log_3 1.5 at machine precision

live ↗
Inlog⁡3(1.5)\log_{3}(1.5)Out0.369 070 246 428 542 562 90.369\,070\,246\,428\,542\,562\,9
live ↗
Inlog⁡3(9)\log_{3}(9)Out22

Threads over a list of values

live ↗
Inlog⁡2([2,4,8])\log_{2}(\bigl\lbrack2, 4, 8\bigr\rbrack)Out[1,2,3]\bigl\lbrack1, 2, 3\bigr\rbrack

Threads over a list of bases

live ↗
Inlog⁡[2,e,10](2.5)\log_{\bigl\lbrack2, e, 10\bigr\rbrack}(2.5)Out[1.321 928 094 887 362 347 87,0.916 290 731 874 155 144 52,0.397 940 008 672 037 609 573]\bigl\lbrack1.321\,928\,094\,887\,362\,347\,87, 0.916\,290\,731\,874\,155\,144\,52, 0.397\,940\,008\,672\,037\,609\,573\bigr\rbrack

Derivative in base 3: 1xln⁡3\frac{1}{x\ln 3}

live ↗
Indlog⁡3(x)dx\frac{\mathrm{d}\log_{3}(x)}{\mathrm{d}x}Out1xln⁡(3)\frac{1}{x\ln(3)}

log⁡218=−3\log_2\tfrac18 = -3; an exact negative power of the base folds too

live ↗
Inlog⁡2(18)\log_{2}(\frac{1}{8})Out−3-3
Properties #

Confirms the default base is 10

live ↗
Inlog⁡10(100)=log⁡10(100)\log_{10}(100)=\log_{10}(100)OutTrue\mathrm{True}

Product rule: log⁡b(xy)=log⁡b(x)+log⁡b(y)\log_b(xy) = \log_b(x) + \log_b(y)

live ↗
Inlog⁡2(8×4)=log⁡2(8)+log⁡2(4)\log_{2}(8×4)=\log_{2}(8)+\log_{2}(4)OutTrue\mathrm{True}

Power rule: log⁡b(xk)=klog⁡b(x)\log_b(x^k) = k \log_b(x)

live ↗
Inlog⁡2(25)=5log⁡2(2)\log_{2}(2^5)=5\log_{2}(2)OutTrue\mathrm{True}
Possible issues #

log⁡10(0)=−∞\log_{10}(0) = -\infty

live ↗
Inlog⁡10(0)\log_{10}(0)Out−∞-∞

A negative argument stays symbolic, with the default base filled in; wrap in N(...) for the complex value

live ↗
Inlog⁡10(−5)\log_{10}(-5)Outlog⁡10(−5)\log_{10}(-5)
About
Examples18
Checked againstWolfram Language 15 agree3 differSageMath 15 agree3 differSymPy 14 agree4 differmpmath 14 agree3 differJulia 13 agree3 differ1 errorRust 11 agree6 error
CrosswalkWikipediaMathWorldWikidataEncyclopedia of MathematicsnLabBritannicaFungrimSageMath ×2SymPy ×2mpmath ×2Julia ×2Rust

Implementation

mappedsympypackages/oracle/src/mappings.ts

compute-engine's one-argument Log is base 10, not the natural logarithm; SymPy's log takes the value first and then the base.

mappedsympypackages/oracle/src/mappings.ts
mappedmpmathpackages/oracle/src/mappings.ts
mappedmpmathpackages/oracle/src/mappings.ts
mappedsagepackages/oracle/src/mappings.ts
mappedsagepackages/oracle/src/mappings.ts
mappedjuliapackages/oracle/src/mappings.ts
mappedjuliapackages/oracle/src/mappings.ts
mappedrustpackages/oracle/src/mappings.ts
mappedrustpackages/oracle/src/mappings.ts

The quotient of natural logarithms: std has no logarithm to a base.

See also: Ln, Log2, Log10, Lb