This site is supported by donations to The OEIS Foundation.

Template:Log

From OeisWiki
Jump to: navigation, search

The {{log}} (alternatively {{log_e}} or {{ln}}) mathematical function template returns the natural logarithm of , where is a positive real number.

You may also use ln with the parser function extension #expr:, e.g.

{{#expr: ln 15 }} giving 2.7080502011022

Usage

{{log|a positive real number}}

or

{{log_e|a positive real number}}

or

{{ln|a positive real number}}

Valid input

A positive real number as argument.

Examples

Examples with valid input

Code Result
{{ln|e^(-1)}} -1
{{ln|e^(-0.5)}} -0.5
{{ln|0.5}} -0.69314718055995
{{log|1}} 0
{{ln|1.5}} 0.40546510810816
{{ln|e^({{phi}})}} 1.6180339887499
{{log_e|10}} 2.302585092994
{{ln|1.5*e^4}} 4.4054651081082
{{log|1000}} 6.9077552789821
{{log|e^40}} 40
{{log|e^25 * e^40}} 65

Examples with invalid input (returns an error message)

Code Result
{{log|i}} Log error: Argument must be a positive real number
{{log|-1}} Log error: Argument must be a positive real number
{{log|0}} Log error: Argument must be a positive real number

Code


<noinclude>{{documentation}}</noinclude><includeonly>{{ifnum| {{{1|NaN}}}
| {{#ifexpr: ( {{{1}}} ) > 0
  | {{#expr: ln ( {{{1}}} ) }}
  | {{error| Log error: Argument must be a positive real number }}
  }}
| {{error| Log error: Argument must be a positive real number }}
}}</includeonly>

See also