15.1. CEL Mathematical Functions

The following mathematical functions are available for use with all CEL expressions.


Note:  In the Function column in the table below, [a] denotes any dimension of the first operand.


Table 15.1: Standard Mathematical CEL Functions

Function

Operand’s Values

Result’s Dimensions

abs( [a] )

Any

[a]

acos( [ ] )

Radians

asin( [ ] )

Radians

atan( [ ] )[a]

Any

Radians

atan2( [a], [a] )[a]

Any

Radians

besselJ( [ ], [ ] )[b]

Dimensionless

besselY( [ ], [ ] )[b]

Dimensionless

cos( [radians] )

Any

Dimensionless

cosh( [ ] )

Any

Dimensionless

exp( [ ] )

Any

Dimensionless

int([ ])[c]

Dimensionless

Dimensionless

loge( [ ] )[d]

Dimensionless

log10( [ ] )[e]

Dimensionless

min( [a], [a] )

Any

[a]

max( [a], [a] )

Any

[a]

mod( [a], [a] )[f]

Any

[a]

nint([ ])[g]

Dimensionless

Dimensionless

sin( [radians] )

Any

Dimensionless

sinh( [ ] )

Any

Dimensionless

sqrt( [a] )

[a]^0.5

step( [ ] ) [h]

Any

Dimensionless

tan( [radians] )[i]

Any

Dimensionless

tanh( [ ] )

Any

Dimensionless

[a] atan does not determine the quadrant of the result, but atan2 does.

[b] The value of the first dimensionless operand n, also referred to as the order of the Bessel function, must be an integer (n=0, 1, 2, ....). The second argument is a dimensionless real number.

[c] The int() function truncates the dimensionless argument to its integer part.

Examples:

int(1) = 1

int(2.5) = 2

int(-3.1) = -3

int(-4.8) = -4

The int() function requires a dimensionless argument but will not report an error if the argument of the function has a dimension of radians or degrees.

[d] ln(x) is valid as an alias for loge(x)

[e] log(x) is valid as an alias for log10(x)

[f] mod(x, y) returns the remainder on dividing x by y; the function is not defined for y = 0.

[g] The nint function requires a dimensionless argument and is defined as:

int(x + 0.5) if x >= 0

int(x - 0.5) if x < 0

See the implementation of int( ) function in the table above.

Examples:

nint(2.6) = 3

nint(2.5) = 3

nint(2.4) = 2

nint(1) = 1

nint(-1) = -1

nint(-2.4) = -2

nint(-2.5) = -3

nint(-2.6) = -3

Note that the nint() function will not report an error if the argument of the function has a dimension of radians or degrees.

[h] step(x) is 0 for negative x, 1 for positive x and 0.5 for x=0. x must be dimensionless.

[i] tan(x) is undefined for x=n/2, where n=1, 3, 5, ...