Function calls and parameters

Revision as of 19:49, 26 August 2015 by DKontotasiou (talk | contribs) (Created page with "Category:Analytica User Guide <languages /> <translate> Analytica User Guide > Analytica provides a large number of built-in functions for performing mathematical, ar...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Analytica User Guide >

Analytica provides a large number of built-in functions for performing mathematical, array, statistical, textual, and financial computations. There are also probability distribution functions for uncertainty and sensitivity analysis. Other more advanced or specialized functions are described inChapter 13: Other Functions. The Enterprise edition of Analytica also includes functions for accessing external ODBC data sources. Finally, you can write and use your own user-defined functions (see Chapter 20: Building Functions and Libraries).

Position-based function calls: The conventional position-based syntax to call a function uses this form:

FunctionName(param1, param2, ...)

You follow the function name by a comma-separated list of parameters enclosed between parentheses, with the parameters in the specified sequence. In most cases, parameters can them- selves be expressions built out of constants, variable names, operators, and function calls. Here are some simple examples of expressions involving functions.

Exp(1) 2.718281828459
Sqrt(3^2 + 4^2) 5 Mod(7, 3) 1
Pmt(8%, 30, -1000) $88.83
Normal(500, 100)

Some functions have optional parameters. In that case, you can simply omit the trailing parameters that will use their default values.

Name-based function calls: Analytica also offers name-based parameter syntax as an alternative for calling most functions: You name each parameter, followed by a colon (:) and the value passed to that parameter. Since the parameters are named, you can list them in any order. For example, this function has four parameters, of which you can provide any two to define the distribution:

Lognormal(median, gsdev, mean, stddev)

Calling it using name-based syntax:

Lognormal(mean: 10, stddev: 1.5)

is equivalent to the following using position-based syntax, which uses commas to indicate that the first two parameters are omitted:

Lognormal( , , 10, 1.5)

because mean and stddev (standard deviation) are the third and fourth parameters. Name-based syntax is useful for functions with many optional parameters. It’s usually easier to read name-based function calls because you don’t need to remember the ordering of the parameters.

See Also

IF a THEN b ELSE c <- Function calls and parameters -> Math functions
Comments


You are not allowed to post comments.