# log

## Purpose

Natural logarithm.

## Synopsis

    Y = log(X)

## Description

`log` is an elementary function that operates element-wise on matrices. Its domain includes complex numbers, which can lead to unexpected results if used unintentionally.

`log(X)` is the natural logarithm of the elements of `X`. For complex or negative z, where z `=` x `+` y*i, the complex logarithm is returned:

## Examples

The statement `log(-1)` is a clever way to generate `pi`:

    ans =
        0.0000 + 3.1416i

## See Also

    exp, log10, logm

(c) Copyright 1994 by The MathWorks, Inc.