Calculator
Example data table
This example uses a diagonal matrix, so the logarithm is taken entrywise on the diagonal.
| Input matrix A | Property | log(A) result |
|---|---|---|
[[2, 0], [0, 3]] |
Positive diagonal entries; principal log is real. | [[ln(2), 0], [0, ln(3)]] ≈ [[0.693147, 0], [0, 1.098612]] |
Formula used
The matrix logarithm log(A) is defined as a matrix L such that exp(L) = A, where exp is the matrix exponential.
When A is diagonalizable, a common identity is:
A = VΛV⁻¹ and log(A) = V·log(Λ)·V⁻¹, where log(Λ) applies the scalar logarithm to eigenvalues.
This calculator approximates the principal branch using repeated square roots to move A near the identity,
then applies the Taylor series log(I+X) = Σ (-1)^{k+1} X^k / k.
How to use this calculator
- Choose the matrix size that matches your square matrix.
- Enter values using the grid or the text matrix option.
- Adjust decimals, series terms, and square-root settings if needed.
- Press Calculate to view
log(A)above the form. - Use the CSV or PDF buttons to export the computed matrix.
If the matrix has eigenvalues on the negative real axis, results may be complex; this tool returns a real approximation and may warn or fail.
Why the matrix logarithm matters
Many processes are modeled with x(t)=exp(At)x(0). If you observe a discrete transition matrix M over a time step Δt, the generator can be estimated as A ≈ (1/Δt)·log(M). This converts multiplicative change into additive rates, making comparison, averaging, and sensitivity studies easier. It is widely used in control, stochastic models, and deformation measurements. For small matrices, careful scaling and validation offer dependable insight, even when full eigenvalue decomposition is unavailable or numerically unstable in practice often.
When a principal real logarithm exists
A matrix logarithm requires an invertible matrix. The principal branch is real only when eigenvalues avoid the closed negative real axis, where branch cuts cause complex values. Practical screening helps before trusting results: a determinant near zero suggests non invertibility, and large deviation from the identity can slow convergence. The calculator reports determinant, scaling steps, and a norm indicator to guide decisions.
Scaling and series method used here
Series for log(I+X) converges best when X is small. The tool therefore computes repeated matrix square roots to form B = A^(1/2^k), bringing B closer to I. It then evaluates log(B) ≈ Σ (-1)^{j+1}(B−I)^j/j and rescales with log(A)=2^k·log(B). You can tune term count, tolerance, and iteration limits for stability.
Reading the output and checking quality
The output L should satisfy exp(L)≈A under the chosen branch. A quick numeric check is comparing trace(L) with ln(det(A)) when conditions support a principal real log. If warnings appear, try more series terms, allow additional scaling steps, or reconsider whether the matrix implies complex behavior. Symmetric positive definite matrices typically yield the most reliable real results.
Common uses and export-ready reporting
In mechanics, log maps turn deformation gradients into additive strain measures that average cleanly across samples. In data science, log helps linearize multiplicative updates and analyze stability. In economics and demography, log of transition matrices supports continuous rate interpretation. For documentation, the calculator outputs formatted tables and provides CSV for spreadsheets plus a PDF snapshot suitable for audits, lab records, and client reports.
FAQs
What does log(A) represent?
It is a matrix L such that exp(L) equals A on the chosen branch. It turns multiplicative effects into additive ones, which helps interpret rates and generators.
Why must the matrix be invertible?
If det(A)=0, no matrix logarithm exists because exp(L) is always invertible. A near‑zero determinant also makes numerical steps unstable.
What if my matrix has negative eigenvalues?
The principal real logarithm may not exist. The true logarithm can be complex, while this tool returns a real approximation and may warn or fail.
How can I improve accuracy?
Increase series terms, allow more square‑root steps, and tighten the square‑root tolerance. Also reduce rounding by showing more decimals in the output.
Why do I see convergence warnings?
Warnings appear when B is not close to the identity after scaling, or when determinants and norms suggest difficult spectra. Results can still be usable, but verify externally.
Can I export the result for documentation?
Yes. After a successful run, use Download CSV for spreadsheet workflows or Download PDF for a one‑page record suitable for reports and audits.