Mathematical functions

<< Click to Display Table of Contents >>

Navigation:  Explain™ Control Language  > Library Routines >

Mathematical functions

Description

Basic math functions used in Explain scripts files (*.exp):

 

REAL Abs (REAL number)

Calculate the absolute value of a number. The number a REAL. The value returned is the same type as the argument.

 

number

REAL

The number for which the absolute value is desired.

result

REAL

The absolute value of number.

 

INDEX Abs (INDEX number)

Calculate the absolute value of a number. The number an INDEX. The value returned is the same type as the argument.

 

number

INDEX

The number for which the absolute value is desired.

result

INDEX

The absolute value of number.

 

REAL Exp (REAL number)

Calculate ex.

 

number

REAL

The exponent of e. Calculate enumber.

result

REAL

The result of enumber.

 

INDEX Index (ANY_TYPE Item)

Convert REAL, BITS, BOOL, or STRING to an INDEX.

 

item

REAL, BITS, BOOL, or STRING

item to be converted to an INDEX.

result

INDEX

The converted item.

 

REAL LineOpt (REAL OldTime)

Return a sample time that will result in successive samples 180° out of phase with the AC power line frequency.

 

OldTime

REAL

The time used as the basis for the calculation.

result

REAL

The time calculated to result in successive sample that are out of phase with the AC power line.

 

REAL Log (REAL number)

Calculate the natural (base e) logarithm of a number.

 

Gamry tip bulb

If number < 0, the absolute value is taken first.

 

number

REAL

number to find the log of.

result

REAL

The calculated result.

 

REAL Log10 (REAL number)

Calculate the base-10 logarithm of a number.

 

Gamry tip bulb

If number < 0, the absolute value is taken first.

 

number

REAL

number to find the log10 of.

result

REAL

The calculated result.

 

REAL Modulus (REAL RealPart, REAL ImagPart)

Calculate the modulus of a complex number.

 

 

RealPart

REAL

Real part of the complex number.

ImagPart

REAL

Imaginary part of the complex number.

result

REAL

The calculated result.

 

REAL Phase (REAL RealPart, REAL ImagPart)

Calculate the phase in degrees of a complex number.

 

 

RealPart

REAL

Real part of the complex number.

ImagPart

REAL

Imaginary part of the complex number.

result

REAL

The calculated result.

 

REAL Pow (REAL X, REAL Y)

Calculate a number raised to a power, xy.

 

X

REAL

Base value.

Y

REAL

Exponent.

result

REAL

The calculated result.

 

INDEX Rand (INDEX number)

Calculate a random number from 0 to RAND_MAX (32767).

 

Gamry tip bulb

The result varies depending on the input number.

 

number

INDEX

NIL

result

INDEX

The randomly generated number:

0 < result < RAND_MAX

 

number

INDEX

number < 0

result

INDEX

The randomly generated number:

result = RAND_MAX

 

number

INDEX

number > 0

result

INDEX

The randomly generated number. Random number generator is re-seeded.

 

REAL Real (ANY_TYPE item)

Convert INDEX, BITS, BOOL, or STRING to a REAL.

 

item

INDEX, BITS, BOOL, or STRING

item to be converted to an REAL.

result

REAL

The converted item.

 

REAL Round (REAL number, INDEX places)

Round a REAL value to a known number of decimal places.

 

number

REAL

The number to be rounded.

places

INDEX

The number of decimal places desired.

result

REAL

The resulting number.

 

REAL Sqrt (REAL number)

Calculate the square root of a number.

 

Gamry tip bulb

If number < 0, the absolute value is taken first.

 

number

REAL

The number to square-rooted.

result

REAL

The calculated result.

 

Related Topics