Log2

Log2[x]

gives the base-2 logarithm of x.

Details

  • Mathematical function, suitable for both symbolic and numerical manipulation.
  • Log2 gives exact integer or rational number results when possible.
  • For certain special arguments, Log2 automatically evaluates to exact values.
  • Log2 can be evaluated to arbitrary numerical precision.
  • Log2 automatically threads over lists.

Examples

open allclose all

Basic Examples  (5)

Log2 gives the logarithm to base 2:

Plot over a subset of the reals:

Plot over a subset of the complexes:

Series expansion shifted from the origin:

Asymptotic expansion at a singular point:

Scope  (43)

Numerical Evaluation  (7)

Evaluate numerically:

Evaluate to high precision:

The precision of the output tracks the precision of the input:

Complex number inputs:

Evaluate efficiently at high precision:

Log2 can deal with realvalued intervals:

Compute average-case statistical intervals using Around:

Compute the elementwise values of an array:

Or compute the matrix Log2 function using MatrixFunction:

Specific Values  (6)

Values of Log2 at fixed points:

Values at zero:

Values at infinity:

Zero argument gives a symbolic result:

Zero of Log2:

Find a value of x for which the Log2[x]=0.5:

Visualization  (3)

Plot the Log2 function:

Plot the real part of :

Plot the imaginary part of :

Polar plot with :

Function Properties  (10)

Log2 is defined for all positive values:

Log2 is defined for all nonzero complex values:

Function range of Log2:

Log2 is not an analytic function:

Nor is it meromorphic:

Log2 has a branch cut along the negative real axis:

Log2 is monotonic on the positive reals:

Log2 is injective:

Log2 is surjective:

Log2 is neither non-negative nor non-positive:

Log2 has both singularities and discontinuities for x0:

Log2 is concave on the positive reals:

TraditionalForm formatting:

Differentiation  (3)

First derivative:

Higher derivatives:

Plot the higher derivatives:

Formula for the ^(th) derivative:

Integration  (3)

Compute the indefinite integral using Integrate:

Definite integral of Log2:

More integrals:

Series Expansions  (5)

Find the Taylor expansion using Series:

Plots of the first three approximations around :

General term in the series expansion using SeriesCoefficient:

FourierSeries:

Asymptotic expansions at the branch cut:

Log2 can be applied to power series:

Function Identities and Simplifications  (6)

Basic identity for Log2:

Logarithm of a power function simplification:

Simplify logarithms with assumptions:

Logarithm of a product:

Change of base:

Expand assuming real variables x and y:

Applications  (5)

Worst-case complexity of merge sort algorithm from its functional equation:

Best-case complexity of merge sort algorithm:

Bubble sort is asymptotically worse than merge sort:

Find the age of a sample in units of its half-life time:

Compute the number of bits needed to store a large integer:

Compare to the exact result:

Find the number of rounds for a single tournament, with two players or teams, to determine a winner. For that, you can determine how many times 2 can be multiplied by itself to get a number equal to or greater than the total number of participants/teams.

For example, a tournament of 4 players requires 2 rounds to determine the winner, while a tournament of 32 teams requires 5 rounds. To calculate, use Log2:

Properties & Relations  (2)

Number of bits used to represent the Wolfram Language's machine reals:

Simplification with assumptions:

Wolfram Research (2008), Log2, Wolfram Language function, https://reference.wolfram.com/language/ref/Log2.html.

Text

Wolfram Research (2008), Log2, Wolfram Language function, https://reference.wolfram.com/language/ref/Log2.html.

CMS

Wolfram Language. 2008. "Log2." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Log2.html.

APA

Wolfram Language. (2008). Log2. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Log2.html

BibTeX

@misc{reference.wolfram_2024_log2, author="Wolfram Research", title="{Log2}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/Log2.html}", note=[Accessed: 21-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_log2, organization={Wolfram Research}, title={Log2}, year={2008}, url={https://reference.wolfram.com/language/ref/Log2.html}, note=[Accessed: 21-December-2024 ]}