Building Blocks

*Formulize* searches for formula by combining mathematical building-blocks (e.g. add, subtract, multiply, divide). The list below describes all of the standard building blocks available.

## Arithmetic

Name | Usage | Comments |
---|---|---|

constant | 1.234 | Allows solutions to use real-valued constants |

integer | 7 | Allows solutions to use integer constants |

add | x + y or add(x,y) | |

subtract | x - y or sub(x,y) | |

multiply | x * y or mul(x,y) | |

divide | x / y or div(x,y) | y must be non-zero |

negation | -x |

## Trigonometric

Name | Usage | Comments |
---|---|---|

sine | sin(x) | The angle is in radians |

cosine | cos(x) | The angle is in radians |

tangent | tan(x) | The angle is in radians |

## Exponential

Name | Usage | Comments |
---|---|---|

exponential | exp(x) | Returns e^x |

logarithm | log(x) | This is the natural logaritm (base e) |

factorial | factorial(x) or x! | Computes the real valued factorial as gamma(x+1) |

power | x ^ y or pow(x,y) | x and y could be any expression |

sqrt | sqrt(x) | x must be positive |

## History Functions

Name | Usage | Comments |
---|---|---|

Delayed Variable | delay(x,num_rows) | Returns the value of the x variable num_rows prior to the current row |

Simple Moving Average | smm(x,num_rows) | Returns the average value of the last num_rows values of the x variable |

Weighted Moving Average | wma(x,num_rows) | Returns the arithmetically weighted average value of the last num_rows values of the x variable |

Modified Moving Average | mma(x,num_rows) | Returns the modified average value of the last num_rows values of the x variable |

Simple Moving Median | smm(x,num_rows) | Returns the median value of the last num_rows values of the x variable |

## Squashing Functions

Name | Usage | Comments |
---|---|---|

logistic function | logistic(x) | This is a common sigmoid squashing function. Returns 1/(1+ exp(-x)) |

step function | step(x) | Returns 1 if x is positive, zero otherwise |

sign function | sgn(x) | Returns -1 if x is negative, +1 if x is positive, and 0 if x is zero |

gaussian function | gauss(x) | This is a bell-shaped squashing function. Returns exp(-x^2) |

hyperbolic tangent | tanh(x) | This is a common squashing function. Returns a value between -1 and +1 |

Error Function | erf(x) | Integral of the normal distribution. Returns a value between -1 and +1 |

Error Function Compliment | erfc(x) | Returns 1.0 - erf(x) |

## Boolean

Name | Usage | Comments |
---|---|---|

equal to | equal(x,y) | Returns 1 if x equals y numerically, 0 otherwise |

less than | less(x,y) | Returns 1 if x < y, 0 otherwise |

less than or equal to | less_or_equal(x,y) | Returns 1 if x <= y, 0 otherwise |

greater than | greater(x,y) | Returns 1 if x > y, 0 otherwise |

greater than or equal to | greater_or_equal(x,y) | Returns 1 if x >= y, 0 otherwise |

if-then-else | if(x,y,z) | Returns y if x is greater than 0, z otherwise |

logical and | and(x,y) | Returns 1 if both x and y are greater than 0, 0 otherwise |

logical or | or(x,y) | Returns 1 if either x or y are greater than 0, 0 otherwise |

logical xor | xor(x,y) | Returns 1 if (x <= 0 and y > 0) or (x > 0 and y <= 0), 0 otherwise |

logical not | not(x) | Returns 0 if x is greater than 0, 1 otherwise |

## Other

Name | Usage | Comments |
---|---|---|

minimum | min(x,y) | Returns the minimum (signed) result of x and y for the data point |

maximum | max(x,y) | Returns the maximum (signed) result of x and y for the data point |

modulo | mod(x,y) | Returns the remainder of x/y |

floor | floor(x) | Returns an integer of x rounded down toward -infinity |

ceiling | ceil(x) | Returns an integer of x rounded up toward +infinite |

round | round(x) | Returns an integer of x rounded to the nearest integer |

absolute value | abs(x) | Returns the positive value of x |

## Inverse Trigonometry

Name | Usage | Comments |
---|---|---|

Arcsine | asin(x) | The inverse of the sine function |

Arccosine | acos(x) | The inverse of the cosine function |

Arctangent | atan(x) | The inverse of the tangent function |

Two-argument Arctangent | atan2(x,y) | The inverse of the tangent function |