# Equations

Description | Operators | Functions | Series Manipulation | Psuedo-Logic | See Also

## Description

Draco uses the Math Expression String Parser (MESP) system for parsing and solving all equations. MESP supports all standard mathematics operators and uses standard order of operations rules. MESP and Draco provide a range of functions for use in equations. All operations are performed in double-precision regardless of type.

## Operators

MESP supports the following operators and symbols:

Operator | Description
+ | Addition
- | Subtraction
* | Multiplication
/ | Division
^ | Power
( and ) | Parentheses

## Functions

The following basic mathematical functions are available via MESP:

Function(x) | Description
abs(x) | Absolute Value
acos(x) | Arc-cosine in radians
acos(x) | Hyperbolic arc-cosine
asin(x) | Arc-sine in radians
asinh(x) | Hyperbolic arc-sine
atan(x) | Arc-tangent in radians
atanh(x) | Hyperbolic arc-tangent
avg(x1,x2,...) | Average of a series of numbers
ceil(x) | Rounded-up value of a floating point number
cos(x) | Cosine of value x (in radians)
cosh(x) | Hyperbolic cosine
exp(x) | Exponential (ex)
fact(x) | Factorial
floor(x) | Rounded-down value of a floating point number
ln(x) | Natural logarithm
log(x) | Base-10 logarithm
max(x1,x2,...) | Largest value in a series
min(x1,x2,...) | Smallest value in a series
mod(x1,x2) | Modulus (remainder) of x1/x2
pi() | Value of pi (~3.14...)
pow(x1,x2) | x1 raised to the x2 value
rand() | Random floating point value between 0 (inclusive) and 1 (non-inclusive)
round(x) | Rounded-to-nearest-whole value of a floating point number
sign(x) | Returns -1 for negatives, 1 for all others
sin(x) | Sine of x (in radians)
sinh(x) | Hyperbolic sine
sqrt(x) | Square root
sum(x1,x2,...) | Sum of a series of numbers
tan(x) | Tangent of x in radians
tanh(x) | Hyperbolic tangent

## Series Manipulation

Draco extends MESP with the following functions providing series manipulation. These functions are only applicable when setting column values.

Function | Description
back(x1[,x2]) | Inserts the value of variable x1 either 1 step back from the current step, or x2 steps back if x2 is specified.
front(x1[,x2]) | Inserts the value of variable x1 either 1 step forward from the current step, or x2 steps back if x2 is specified.

As an example of the above functions, consider the following variable:

ser0
1
2
3
4
5

If a new variable is created using back(ser0), the data set becomes:

ser0 | ser1
1 |
2 | 1
3 | 2
4 | 3
5 | 4

If a new variable is created using back(ser0,2), the data set becomes:

ser0 | ser1
1 |
2 |
3 | 1
4 | 2
5 | 3

## Psuedo-Logic

Draco currently uses a collection of psuedo-logic functions for evaluating logic problems. The functions appear below:

Function | Description
and(x1,x2) | Returns 1.0 if both x1 and x2 are greater than zero and not empty, 0.0 otherwise
eq(x1,x2) | Returns 1.0 if x1 equals x2, 0.0 otherwise otherwise
ge(x1,x2) | Returns 1.0 if x1 is greater than or equal to x2, 0.0 otherwise
gt(x1,x2) | Returns 1.0 if x1 is greater than x2, 0.0 otherwise
if(x1,x2[,x3]) | If x1 is positive and not null, returns the value of x2. Otherwise, returns nothing or x3 if specified.
le(x1,x2) | Returns 1.0 if x1 is less than or equal to x2, 0.0 otherwise
lt(x1,x2) | Returns 1.0 if x1 is less than x2, 0.0 otherwise
ne(x1,x2) | Returns 1.0 if x1 is not equal to x2, 0.0 otherwise
not(x) | Returns 0.0 if x1 is positive, 1.0 otherwise
or(x1,x2) | Returns 1.0 if either x1 or x2 are greater than zero and not empty, 0.0 otherwise

The psuedo-logic functions can be used for setting column values easily. For example, to eliminate all negatives from a series, the following equation can be used:
if(ge(ser0,0.0),ser0)
The above formula will set the column of interest (which can be ser0) to be the value of ser0 if positive or 0.0, but blank all values that are negative.

## See Also

Variables
Constants Windows

Copyright © 2007 Approximatrix, LLC
Text licensed under the Creative Commons Attribution-Share Alike 3.0 License
DracoTM and the Approximatrix logo are trademarks of Approximatrix, LLC
Other trademarks are property of their respective owners