CalcLog

CalcLog

CalcLog[ x, b ] calculates the logarithm of x with base b, if the result is exact.

Usages

CalcLog[ x, b ]

CalcLog[ x, b ] calculates blog(x): the exponent to which b must be raised to get x. Note that the number comes first and the base second. The result is only calculated if it is an integer; otherwise CalcLog is left unevaluated (use Numerical for a decimal approximation).

Example in out
102 = 100. CalcLog[ 100, 10 ] 2
23 = 8. CalcLog[ 8, 2 ] 3
A fraction. CalcLog[ 1/8, 2 ] -3
A decimal number. CalcLog[ 0.001, 10 ] -3
A power of the base. CalcLog[ 2^5, 2 ] 5
The result is not an integer, so it is not calculated. CalcLog[ 10, 2 ] CalcLog[10, 2]
A decimal approximation. Numerical[ CalcLog[10, 2], 3 ] 3.322
Details
  • Undefined logarithms: a number that is 0 or negative, or a base that is 1, 0 or negative, gives NaN: CalcLog[ 0, 2 ] and CalcLog[ 8, 1 ] give NaN.
  • The base is required: CalcLog[ 100 ] is left unevaluated.
  • Lists are not supported: CalcLog[ {8, 16}, 2 ] is left unevaluated. Use Map.
  • Natural logarithm: CalcLog[ EulerE, EulerE ] is left unevaluated. Use Ln with Simplify or Numerical.

See also: CalcPower, Numerical, Math functions