JSL Syntax Reference > JSL Functions > Numeric Functions
Publication date: 11/10/2021

# Numeric Functions

Abs(n)

Description

Calculates the absolute value of n.

Returns

Returns a positive number of the same magnitude as the value of n.

Argument

n

Any number.

Ceiling(n)

Description

If n is not an integer, rounds n to the next highest integer.

Returns

Returns the smallest integer greater than or equal to n.

Argument

n

Any number.

Derivative(expr, {name, ...}, ...)

Description

Calculates the derivative of the expr expression with respect to name.

Returns

Returns the derivative.

Arguments

expr

Any expression. Indirect arguments (for example, Name Expr, Expr, Eval) are supported.

name

Can be a single variable or a list of variables.

Notes

Floor(n)

Description

If n is not an integer, rounds n to the next lowest integer.

Returns

Returns the largest integer less than or equal to n.

Argument

n

Any number.

Examples

`Floor( 2.7 );`

2

`Floor( –.5 );`

–1

Integrate(expr, varname, lowLimit, upLimit, <<Tolerance(1e-10), <<StoreInfo({list }), <<StartingValue(val))

Description

Integrates an expression with respect to a scalar value, using the adaptive quadrature method from Gander and Gautschi (2000).

Arguments

expr an expression that defines the integrand.

varname the name of the variable of integration. If this variable contains a value, that value specifies a starting value that is used as a typical value to improve the accuracy of the integral.

lowLimit specifies the lower limit of integration. To specify negative infinity as the lower limit of integration, set this to missing.

upLimit specifies the upper limit of integration. To specify positive infinity as the upper limit of integration, set this to missing.

StoreInfo saves diagnostics of the numerical integration routine to the argument of StoreInfo().

StartingValue specifies a starting value that is used as a typical value to improve the accuracy of the integral.

Invert Expr(expr, name)

Description

Attempts to unfold expr around name.

Mod()

Modulo(number, divisor)

Mod(number, divisor)

Description

Returns the remainder when number is divided by divisor.

Examples

`Modulo( 6, 5 );`

1

Normal Integrate(muVector, sigmaMatrix, expr, x, nStrata, nSim)

Description

Returns the result of radial-spherical integration for smooth functions of multivariate, normally distributed variables.

Arguments

muVector

A vector.

sigmaMatrix

A matrix.

expr

An expression in terms of the variable x.

x

The variable used in the expression expr.

nStrata

Number of strata.

nSim

Number of simulations.

Num Deriv(f(x,...), <parnum=1>)

Description

Returns the numerical derivative of the f( x,... ) function with respect to one of its arguments. You can specify that argument as the second argument in the Num Deriv function. If no second argument is specified, the derivative is taken with respect to the function's first argument. The derivative is evaluated using numeric values specified in the f( x,... ) function expression.

Notes

The Num Deriv() function might appear not to produce the correct results as seen here:

`x = 3;`
`n = Num Deriv( 3 * x ^ 2 );`

// 9.00000000001455

The preceding usage is not correct. The function was designed to be used in the Nonlinear platform to differentiate functions for which it does not know the analytic derivatives. The proper usage takes the following form:

`x = 3;`
`f = Function( {x}, 3 * x ^ 2 );`
`n = Num Deriv( f( x ), 1 );`

// 18.000029999854

Num Deriv2(f(x,...))

Description

Returns the numerical second derivative of the f( x,... ) function with respect to x. The derivative is evaluated using numeric values specified in the f( x,... ) function expression.

Round(n, places)

Description

Rounds n to number of decimal places given.

Simplify Expr(expr(expression))

Simplify Expr(nameExpr(global))

Description

Algebraically simplifies an expression