Arithmetic Functions

<< Click to Display Table of Contents >>

Navigation:  Reference Manual > Equations >

Arithmetic Functions

Abs(x)

Returns the absolute value of a number, e.g., Abs(5.3)=Abs(-5.3)=5.3.

Exp(x)

Returns e (Euler's number) raised to the power of x, e.g., Exp(2.2)=e2.2=9.02501.

Gammaln(x)

Returns the natural logarithm of the Gamma function (Γ(x)), e.g., Gammaln(2.2)=0.0969475.

GCD(n,k)

Returns the greatest common integer divisor of its two integer arguments n and k, e.g., GCD(15,25)=5. When the arguments are not integers, their fractional part is ignored.

Inf()

Returns positive infinity. For negative infinity, please use -Inf().

LCM(n,k)

Returns the least common integer multiple of its two integer arguments n and k, e.g., LCM(15,25)=75.When the arguments are not integers, their fractional part is ignored.

Ln(x)

Returns the natural logarithm of x, which has to be non-negative, e.g., Ln(10)=2.30259.

Log(x,b)

Returns the base b logarithm of x, which has to be non-negative, e.g., Log(10,2)=3.32193.

Log10(x)

Returns decimal logarithm of x, which has to be non-negative, e.g., Log10(100)=2.

Pow10(x)

Returns 10 raised to the power of x, e.g., Pow10(2)=102=100.

Round(x)

Returns the integer that is nearest to x, e.g., Round(2.2)=2, Round(3.5)=4.

Sign(x)

Returns 1 if x>0, 0 when x=0, and -1 if x<0, e.g., Sign(2.2)=1, Sign(0)=0, Sign(-3.5)=-1.

Sqrt(x)

Returns the square root of x, which has to be non-negative, e.g., Sqrt(2)=1.41421.

SqrtPi(x)

Returns square root of π multiplied by x, which has to be non-negative, e.g. SqrtPi(2)=Sqrt(Pi()*2)=2.50663. This function is provided for the sake of compatibility with Microsoft Excel.

Sum(x1,x2,...)

Returns the sum of its arguments, e.g., Sum(2.2, 3.5, 1.3)=7.0. Sum() requires at least two arguments.

SumSq(x1,x2,...)

Returns the sum of squares of its arguments, e.g., SumSq(2.2, 3.5, 1.3)=18.78. SumSq() requires at least two arguments.

Trim(x,lo,hi)

Trims the value of the argument x to a value in the interval <lo, hi>. If xlo, the function returns lo, if xhi, the function returns hi, if lo<x<hi, the function returns x. The function is a shortcut to two nested conditional functions If() and is equivalent to If(x<lo,lo,If(x>hi,hi,x)). For example, Trim(-0.5,0,1)=0, Trim(0.5,0,1)=0.5, Trim(1.5,0,1)=1.

Truncate(x)

Returns the integer part of x, e.g., Truncate(2.2)=2.