# Excel to Analytica Mappings/Math Functions

This page shows how Excel Mathematical functions translate to Analytica equivalents

## ABS(x)

Analytica equivalent:

Abs(x)

## ACOS(x)

Analytica equivalent:

## ACOSH(x)

Analytica equivalent:

Ln(x+Sqrt((x - 1)*(x + 1))

## ASIN(x)

Analytica equivalent:

## ASINH

Analytica equivalent:

Ln(x + Sqrt(x^2 + 1))

## ATAN(x)

Analytica equivalent:

## ATAN2(x, y)

Analytica equivalent:

## ATANH

Analytica equivalent:

Ln((1+x)/(1 - x))/2

## CEILING(x)

Analytica equivalent:

Ceil(x)

Analytica does not provide an equivalent to `CEILING(x, significance)`. You can approximate this using:

Ceil(x/abs(significance))*significance

This is only an approximation since round-off errors can through it off slightly.

## COMBIN(n, k)

Analytica equivalent:

Combinations(k, n)

## COS(x)

Analytica equivalent:

Cos(Degrees(x))

## COSH

Analytica equivalent:

Cosh(x)

Analytica equivalent:

## EVEN(x)

Analytica equivalent:

2*Round(x/2)

## EXP(x)

Analytica equivalent:

Exp(x)

## FACT(n)

Analytica equivalent:

Factorial(n)

## FACTDOUBLE(n)

This function is not provided by Analytica. The following user-defined function can be used:

`Function FactDouble(n : scalar)`
<code<Definition: Product(Sequence(n, 1, 2))</code>

## FLOOR(x)

Analytica equivalent:

Floor(x)

Analytica does not have an exact equivalent to `FLOOR(x, significance)`, but this can be approximated as:

Floor(x/significance) * significance

This is only an approximation because numeric roundoff may cause slight discrepancies.

## GCD(number1, number2, ...)

Analytica does not have a built-in GCD function. To use GCD, add the GCD function library.ana to your model, and then use the GCD2 or GCD functions as needed. For example:

`GCD([2297295, 2457, 10395]) → 189`

or when A is an array of numbers indexed by I:

GCD(A, I)

## INT(x)

Analytica equivalent:

Floor(x)

## ISO.CEILING(number, significance)

With «significance» omitted, the equivalent is just:

Ceil(number)

For a significance that is a multiple of 10, such as 0.01 or 100, the best equivalent is to specify the number of digits, 10-digits (so that digits==2 for 0.01 or -2 for 100) and use:

Ceil(number, digits)

For other multiples that are not a power of 10, the equivalent is:

Ceil(number/significance)*significance

## LN(x)

Analytica equivalent:

Ln(x)

## LOG(x, base)

Analytica equivalent:

Ln(x)/Ln(base)

## LOG10(x)

Analytica equivalent:

LogTen(x)

## MDETERM(array)

Analytica equivalent:

Determinant(array, I, J)

where I and J are indexes of «array».

## MINVERSE(array)

Analytica equivalent:

Invert(array, I, J)

where I and J are indexes of «array».

## MMULT(array1, array2)

Analytica equivalent:

MatrixMultiply(array1, I1, J1, array2, I2, J2)

where I1 and J1 are the indexes of «array1», and I2 and J2 are the indexes of «array2». J1 and I2 must be of the same length.

## MOD(number, divisor)

Analytica equivalent:

Mod(number, divisor)

## MROUND(number, multiple)

There is no precise equivalent to this, but you can accomplish this using:

Round(number/multiple)*multiple

## MULTINOMIAL(a, b, c, ...)

If the numbers are small enough so that numeric overflow is not a problem, this can be encoded as follows, where the numbers are in array A along index I:

Factorial(Sum(A, I))/Sum(Factorial(A), I)

## ODD(number)

Analytica equivalent:

Ceil((number - 1)/2)*2 + 1

## PI()

Analytica equivalent:

Pi

## POWER(number, power)

Analytica equivalent:

number^power

## PRODUCT(number1, number2, ...)

Analytica equivalent:

number1*number2*....

or if your numbers are in an array:

Product(A, I)

## QUOTIENT(numerator, denominator)

Analytica equivalent:

numerator/denominator

Analytica equivalent:

## RAND( )

Analytica equivalent:

Random()

## RANDBETWEEN(bottom, top)

Analytica equivalent:

Random(Uniform(bottom, top, integer: true))

## ROUND(number, num_digits)

The Analytica equivalent of ROUND(number, 0) is:

Round(number)

## ROUNDDOWN(number, num_digits)

Analytica equivalent of ROUNDDOWN(number, 0) is:

If number<0 then Ceil(x) else Floor(x)

## ROUNDUP(number, num_digits)

Analytica equivalent of ROUNDUP(number, 0) is:

If number>0 then Ceil(x) else Floor(x)

## SERIESSUM(x, n, m, coefficients)

When doing the equivalent in Analytica, your coefficient array will have an index, say I. The equivalent is then:

Sum(coefficients * x^(n + (@I - 1)*m), I)

## SIGN(x)

Analytica equivalent:

Sign(x)

## SIN(x)

Analytica equivalent:

Sin(Degrees(x))

## SINH(x)

Analytica equivalent:

Sinh(x)

## SQRT(x)

Analytica equivalent:

Sqrt(x)

## SQRTPI(x)

Analytica equivalent:

Sqrt(x*Pi)

## SUM(number1, number2, ....)

Analytica equivalent:

number1 + number2 + ...

or when the numbers are in an array:

Sum(A, I)

## SUMIF(range, criteria, sum_range)

The Analytica equivalent is:

Sum(if criteria then range else 0, I)

The index I would typically be shared by both «criteria» and «range» arrays. For example:

`Sum(if est > 0 then est else 0, Time)`

When you are certain that range contains only finite numbers (no INF or NaN), then you can also use:

Sum(criteria * range, I)

E.g.:

`Sum((est > 0) * est, I)`

## SUMPRODUCT(array1, array2, ....)

Analytica equivalents:

Sum(array1*array2*..., I)
Sum(Product(A, J), I)

When your arrays (in Excel) are 2-D, where the corresponding dimensions in Analytica are the indexes Row and Col, then the equivalents become:

Sum(array1*array2*..., Row, Col)
Sum(Product(A, J), Row, Col)

## SUMSQ(number1, number2, ...)

Analytica equivalents:

Sum([number1, number2, ....]^2)
Sum(A^2, I)

## SUMX2MY2(array-x, array_y)

Analytica equivalent:

Sum(array_x^2 - array_y^2, I)

## SUMX2PY2(array_x, array_y)

Analytica equivalent:

Sum(array_x^2 + array_y^2, I)

## SUMXMY2(array_x, array_y)

Analytica equivalent:

Sum((array_x-array_y)^2, I)

## TAN(x)

Analytica equivalent:

Tan(Degrees(x))

## TANH(x)

Analytica equivalent:

Tanh(x)

## TRUNC(x, num_digits)

Analytica equivalent of TRUNC(x):

x - Mod(x, 1)

The equivalent of TRUNC(x, digits) is:

x - Mod(x, 10^(-digits))