function

log . math . sncode

VERSIONlatest This function computes the logarithm of a number.

LOG(1e)

NAME

log - This function computes the logarithm of a number.

SYNOPSIS

log(argument)

DESCRIPTION

This mathematical function allows the user to compute the natural logarithm of a number. The natural logarithm is the logarithm that has the constant e as its base. E is an irrationnal and transcendantal number. In litterature, you might find the log written as ln. The logarithm of a number x is the exponent y to which e must be raised to give x. Log x=y, where x=exp(y). The exponential is its inverse operation. This function is defined in the first quadrant and the 4th, meaning that 0<x<INF and -INF<y<INF.

PARAMETERS

Number
Specify the number (float) used as argument for the log function.

RETURN

The value of the logarithm.

EXAMPLES

Note: In the followings examples, the _ between the { should be removed to make it work.

One can use this function with integers:

test(q(res={_{log(45);}}.),q(res=3.80666.));

With floats:

test(q(res={_{log(4.5);}}.),q(res=1.50408.));

With another variable:

test(q(res={_{
%include "/includes/extenso.sn";
a=3;
log(a);
}}.),
q(res=1.09861.));

With a trigonometric function:

test(q(res={_{
%include "/includes/extenso.sn";
a=cos(0);
log(a);
}}.),
q(res=0.));

With the limits:

test(q(res={_{
%include "/includes/extenso.sn";
log(0);
}}.),
q(res=INF.));

With an array:

test(q(res={_{log(1,45,4.5);}}.),q(res=\[0,3.80666,1.50408\].));

But not with negative numbers:

test(q(res={_{log(-1);}}.),q(res=NAN.));

Since this function is defined in the first and fourth quadrant, the x must
always be positive. However, this returns an imaginary number, PI*i.

AUTHOR

Written by Caroline Laplante, <claplante@sednove.com>