Difference between revisions of "Excel to Analytica Mappings/Math Functions"

 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
[[Category: Excel to Analytica mappings]]
 +
 
This page shows how Excel Mathematical functions translate to Analytica equivalents
 
This page shows how Excel Mathematical functions translate to Analytica equivalents
  
= ABS(x) =
+
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
 +
__TOC__
 +
</div>
  
Analytica equivalent:
+
== ABS(x) ==
[[Abs]](x)
 
  
= ACOS(x) =
+
''Analytica equivalent:''
 +
:[[Abs]](x)
  
Analytica equivalent:
+
== ACOS(x) ==
[[ArcCos]](x)
 
  
= ACOSH(x) =
+
''Analytica equivalent:''
 +
:[[Radians]]([[ArcCos]](x))
  
Analytica equivalent:
+
== ACOSH(x) ==
[[Ln]](x+[[Sqrt]]( (x-1)*(x+1) )
 
  
= ASIN(x) =
+
''Analytica equivalent:''
 +
:[[Ln]](x+[[Sqrt]]((x - 1)*(x + 1))
  
Analytica equivalent:
+
== ASIN(x) ==
[[ArcSin]](x)
 
  
= ASINH =
+
''Analytica equivalent:''
 +
:[[Radians]]([[ArcSin]](x))
  
Analytica equivalent:
+
== ASINH ==
[[Ln]](x+[[Sqrt]](x^2+1))
 
  
= ATAN(x) =
+
''Analytica equivalent:''
 +
:[[Ln]](x + [[Sqrt]](x^2 + 1))
  
Analytica equivalent:
+
== ATAN(x) ==
[[ArcTan]](x)
 
  
= ATAN2(x,y) =
+
''Analytica equivalent:''
 +
:[[Radians]]([[ArcTan]](x))
  
Analytica equivalent:
+
== ATAN2(x, y) ==
[[ArcTan2]](y,x)
 
  
= ATANH =
+
''Analytica equivalent:''
 +
:[[Radians]]([[ArcTan2]](y, x))
  
Analytica equivalent:
+
== ATANH ==
[[Ln]]( (1+x)/(1-x) ) / 2
 
  
= CEILING(x) =
+
''Analytica equivalent:''
 +
:[[Ln]]((1+x)/(1 - x))/2
  
Analytica equivalent:
+
== CEILING(x) ==
  [[Ceil]](x)
+
 
 +
''Analytica equivalent:''
 +
:[[Ceil]](x)
 +
 
 +
Analytica does not provide an equivalent to <code>CEILING(x, significance)</code>. You can approximate this using:
 +
:[[Ceil]](x/abs(significance))*significance
  
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.
 
This is only an approximation since round-off errors can through it off slightly.
  
= COMBIN(n,k) =
+
== COMBIN(n, k) ==
  
Analytica equivalent:
+
''Analytica equivalent:''
[[Combinations]](k,n)
+
:[[Combinations]](k, n)
  
= COS(x) =
+
== COS(x) ==
  
Analytica equivalent:
+
''Analytica equivalent:''
[[Cos]](x)
+
:[[Cos]]([[Degrees]](x))
  
= COSH =
+
== COSH ==
Analytica equivalent:
 
[[Cosh]](x)
 
  
= DEGREES(angle_in_radians) =
+
''Analytica equivalent:''
 +
:[[Cosh]](x)
  
Analytica equivalent:
+
== DEGREES(angle_in_radians) ==
[[Degrees]](angle_in_radians)
 
  
= EVEN(x) =
+
''Analytica equivalent:''
 +
:[[Degrees]](angle_in_radians)
  
Analytica equivalent:
+
== EVEN(x) ==
2*[[Round]](x/2)
 
  
= EXP(x) =
+
''Analytica equivalent:''
 +
:2*[[Round]](x/2)
  
Analytica equivalent:
+
== EXP(x) ==
[[Exp]](x)
 
  
= FACT(n) =
+
''Analytica equivalent:''
 +
:[[Exp]](x)
  
Analytica equivalent:
+
== FACT(n) ==
[[Factorial]](n)
 
  
= FACTDOUBLE(n) =
+
''Analytica equivalent:''
 +
:[[Factorial]](n)
 +
 
 +
== FACTDOUBLE(n) ==
  
 
This function is not provided by Analytica.  The following user-defined function can be used:
 
This function is not provided by Analytica.  The following user-defined function can be used:
  
Function FactDouble( n : scalar )
+
:<code>Function FactDouble(n : scalar)</code>
  Definition: [[Product]]( [[Sequence]](n,1,2) )
+
:<code<Definition: Product(Sequence(n, 1, 2))</code>
 +
 
 +
== FLOOR(x) ==
 +
 
 +
''Analytica equivalent:''
 +
:[[Floor]](x)
 +
 
 +
Analytica does not have an exact equivalent to <code>FLOOR(x, significance)</code>,  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 [[media:GCD function library.ana|GCD function library.ana]] to your model,  and then use the GCD2 or [[GCD]] functions as needed.  For example:
 +
 
 +
:<code>GCD([2297295, 2457, 10395]) &rarr; 189</code>
 +
 
 +
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<sup>-digits</sup>'' (so that digits==2 for 0.01 or -2 for 100) and use:
  
= FLOOR(x) =
+
:[[Ceil]](number, digits)
  
Analytica equivalent:
+
For other multiples that are not a power of 10,  the equivalent is:
[[Floor]](x)
 
  
Analytica does not have an exact equivalent to FLOOR(x,significance), but this can be approximated as:
+
:[[Ceil]](number/significance)*significance
[[Floor]](x/significance) * significance
 
This is only an approximation because numeric roundoff may cause slight descrepancies.
 
  
= GCD(number1'',number2,...'') =
+
== LCM(number1'', number2, ...'') ==
  
= INT(x) =
+
== LN(x) ==
  
Analytica equivalent:
+
''Analytica equivalent:''
[[Floor]](x)
+
:[[Ln]](x)
  
= LCM(number1'',number2,...'') =
+
== LOG(x, base) ==
  
= LN(x) =
+
''Analytica equivalent:''
 +
:[[Ln]](x)/[[Ln]](base)
  
Analytica equivalent:
+
== LOG10(x) ==
[[Ln]](x)
 
  
= LOG(x,base) =
+
''Analytica equivalent:''
 +
:[[LogTen]](x)
  
Analytica equivalent:
+
== MDETERM(array) ==
[[Ln]](x) / [[Ln]](base)
 
  
= LOG10(x) =
+
''Analytica equivalent:''
 +
:[[Determinant]](array, I, J)
  
Analytica equivalent:
 
[[LogTen]](x)
 
  
= MDETERM(array) =
+
where ''I'' and ''J'' are indexes of «array».
  
Analytica equivalent:
+
== MINVERSE(array) ==
[[Determinant]](array,I,J)
 
where ''I'' and ''J'' are indexes of ''array''.
 
  
= MINVERSE(array) =
+
''Analytica equivalent:''
 +
:[[Invert]](array, I, J)
  
Analytica equivalent:
+
where ''I'' and ''J'' are indexes of «array».
[[Invert]](array,I,J)
 
where ''I'' and ''J'' are indexes of ''array''.
 
  
= MMULT(array1,array2) =
+
== MMULT(array1, array2) ==
  
Analytica equivalent:
+
''Analytica equivalent:''
[[MatrixMultiply]](array1,I1,J1,array2,I2,J2)
+
:[[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) =
+
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.
  
Analytica equivalent:
+
== MOD(number, divisor) ==
[[Mod]](number,divisor)
 
  
= MROUND(number,multiple) =
+
''Analytica equivalent:''
 +
:[[Mod]](number, divisor)
  
There is no precise equivalent to this, but you can accomplish this using:
+
== MROUND(number, multiple) ==
[[Round]](number/multiple) * multiple
 
  
= MULTINOMIAL(a,b,c,...) =
+
There is no precise equivalent to this,  but you can accomplish this using:
 +
:[[Round]](number/multiple)*multiple
  
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:
+
== MULTINOMIAL(a, b, c, ...) ==
[[Factorial]]([[Sum]](A,I)) / [[Sum]]([[Factorial]](A),I)
 
  
= ODD(number) =
+
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)
  
Analytica equivalent:
+
== ODD(number) ==
[[Ceil]]((number-1)/2) * 2 + 1
 
  
= PI() =
+
''Analytica equivalent:''
 +
:[[Ceil]]((number - 1)/2)*2 + 1
  
Analytica equivalent:
+
== PI() ==
Pi
 
  
= POWER(number,power) =
+
''Analytica equivalent:''
 +
:[[Pi]]
  
Analytica equivalent:
+
== POWER(number, power) ==
number^power
 
  
= PRODUCT(number1'',number2,...'') =
+
''Analytica equivalent:''
 +
:number^power
 +
 
 +
== PRODUCT(number1'', number2, ...'') ==
 +
 
 +
''Analytica equivalent:''
 +
:number1*number2*....
  
Analytica equivalent:
 
number1 * number2 * ....
 
 
or if your numbers are in an array:
 
or if your numbers are in an array:
  [[Product]](A,I)
+
:[[Product]](A, I)
 +
 
 +
== QUOTIENT(numerator, denominator) ==
 +
 
 +
''Analytica equivalent:''
 +
:numerator/denominator
 +
 
 +
== RADIANS(angle_in_degrees) ==
 +
 
 +
''Analytica equivalent:''
 +
:[[Radians]](angle_in_degrees)
 +
 
 +
== RAND( ) ==
 +
 
 +
''Analytica equivalent:''
 +
:[[Random]]()
 +
 
 +
== RANDBETWEEN(bottom, top) ==
 +
 
 +
''Analytica equivalent:''
 +
:[[Random]]([[Uniform]](bottom, top, integer: true))
 +
 
 +
== ROMAN ==
 +
 
 +
== 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)
 +
 
 +
== SUBTOTAL ==
 +
 
 +
== 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:
 +
:<code>Sum(if est > 0 then est else 0,  Time)</code>
 +
 
 +
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.:
 +
:<code>Sum((est > 0) * est,  I)</code>
 +
 
 +
== 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) ==
  
= QUOTIENT(numerator,denominator) =
+
''Analytica equivalent:''
 +
: [[Sum]]((array_x-array_y)^2, I)
  
Analytica equivalent:
+
== TAN(x) ==
numerator / denominator
 
  
= RADIANS(angle_in_degrees) =
+
''Analytica equivalent:''
 +
:[[Tan]]([[Degrees]](x))
  
Analytica equivalent:
+
== TANH(x) ==
Radians(angle_in_degrees)
 
  
= RAND( ) =
+
''Analytica equivalent:''
 +
:[[Tanh]](x)
  
Analytica equivalent:
+
== TRUNC(x, num_digits) ==
[[Random()]]
 
  
= RANDBETWEEN(bottom,top) =
+
''Analytica equivalent of TRUNC(x):''
 +
:x - [[Mod]](x, 1)
  
Analytica equivalent:
+
''The equivalent of TRUNC(x, digits) is:''
[[Random]]([[Uniform]](bottom,top,integer:true))
+
:x - [[Mod]](x, 10^(-digits))
  
= ROMAN =
+
==See Also==
= ROUND =
+
* [[Excel to Analytica Mappings]]
= ROUNDDOWN =
 
= ROUNDUP =
 
= SERIESSUM =
 
= SIGN =
 
= SIG =
 
= SINH =
 
= SQRT =
 
= SQRTPI =
 
= SUBTOTAL =
 
= SUM =
 
= SUMIF =
 
= SUMPRODUCT =
 
= SUMSQ =
 
= SUMX2MY2 =
 
= SUMX2PY2 =
 
= SUMXMY2 =
 
= TAN =
 
= TANH =
 
= TRUNC =
 

Latest revision as of 23:43, 16 March 2016


This page shows how Excel Mathematical functions translate to Analytica equivalents

ABS(x)

Analytica equivalent:

Abs(x)

ACOS(x)

Analytica equivalent:

Radians(ArcCos(x))

ACOSH(x)

Analytica equivalent:

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

ASIN(x)

Analytica equivalent:

Radians(ArcSin(x))

ASINH

Analytica equivalent:

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

ATAN(x)

Analytica equivalent:

Radians(ArcTan(x))

ATAN2(x, y)

Analytica equivalent:

Radians(ArcTan2(y, x))

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)

DEGREES(angle_in_radians)

Analytica equivalent:

Degrees(angle_in_radians)

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))

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

LCM(number1, number2, ...)

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

RADIANS(angle_in_degrees)

Analytica equivalent:

Radians(angle_in_degrees)

RAND( )

Analytica equivalent:

Random()

RANDBETWEEN(bottom, top)

Analytica equivalent:

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

ROMAN

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)

SUBTOTAL

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))

See Also

Comments


You are not allowed to post comments.