## Formula Calculation

### Instalation
```
yarn add mathjs algebra.js
```


### Example
```ts
import * as math from 'mathjs'
import { Equation, parse } from 'algebra.js'

const formula = 'dpp - (dpp*ppn) - (dpp*retribusi) - (dpp*service) - (dpp*ppn3)'
const total = '300000'

const variable = {
  ppn: 11,
  retribusi: 5000,
  service: 5,
  ppn3: 5000
}

try {
  
  const x1 = math.simplify(formula, variable).toString()
  console.log('Formula ', x1)
  const dppFormula = parse(x1)
  const totalFormula = parse(total)
  const equation = new Equation(totalFormula, dppFormula)

  console.log(equation.toString())
  const result = equation.solveFor('dpp').toString()
  console.log(result)
  
  const value = math.evaluate(result)
  console.log(value)

} catch (e) {
  console.log(e)
}
```