# Template Math

### Introduction

LoanPro provides some basic functions that can be used to perform basic mathematical operations. To use one of these functions, you will need to know the function name and parameters. For most of these functions, at least one of the parameters will usually be a variable name. This article will go over the names and parameters of each function and show an example of how to use each one.

The available functions are:

- mathAdd()
- mathSubtract()
- mathMultiply()
- mathDivide()
- mathSqrt()
- mathPow()
- evalFormula()

### Addition

This function lets you add two numbers together.

Function | Parameter 1 | Parameter 2 |

mathAdd() | Number | Number |

**Example:**

*[[mathAdd(‘setup-loan-amount’, ‘setup-underwriting’)]]*

This will output the loan amount plus the underwriting fee. So, if the loan amount was $10,000 and the underwriting fee was $150, this will output 10150.

### Subtraction

This function allows you to subtract one number from another.

Function | Parameter 1 | Parameter 2 |

mathSubtract() | Number | Number |

Parameter 2 will be subtracted from parameter 1, so the result will be negative if parameter 2 is the larger number.

**Example:**

*[[mathSubtract(‘setup-loan-amount’, ‘setup-underwriting’)]]*

This will output the difference between the loan amount and the underwriting fee. So, if the loan amount was $10,000 and the underwriting fee was $150, this will output 9850.

### Multiplication

This function will let you multiply two numbers.

Function | Parameter 1 | Parameter 2 |

mathMultiply() | Number | Number |

**Example:**

*[[mathMultiply(‘setup-loan-amount’, 10)]]*

This will multiply the loan amount and the number 10. So, if the loan amount was $10,000, the output will be 100000.

### Division

This function will let you divide one number by another number.

Function | Parameter 1 | Parameter 2 |

mathDivide() | Number | Number |

Parameter 1 will be divided by parameter 2.

**Example:**

*[[mathDivide(‘setup-loan-amount’, 10)]]*

This will output the quotient of the loan amount and 10. So, if the loan amount was $10,000, this will output 1000.

### Square Root

This function will let you find the square root of a number.

Function | Parameter |

mathSqrt() | Number |

**Example:**

*[[mathSqrt(‘setup-loan-amount’)]]*

This will output the square root of the loan amount. So, if the loan amount was $10,000, this will output 100.

### Raise to the Power

This function will raise a number to a power.

Function | Parameter 1 | Parameter 2 |

mathPow() | Number | Number |

The first parameter will be raised to the power of the second parameter.

**Example:**

*[[mathPow(‘setup-loan-amount’, 2)]]*

This will output the loan amount to the second power. So, if the loan amount was $10,000, this will ouput 100000000.

### Evaluate Formula

When you enter a formula as a string into the function it will be evaluated.

Function | Parameter |

evalFormula() | String |

Example

*[[evalFormula('(+ status-amount-due 50000 setup-loan-amount)')]]*

This will output the amount past due + 50000 + the loan amount. So, if the amount due is $320.00 and the loan amount is $10,000 the output will be 60320.