UNPKG

@nexys/math-ts

Version:

[![npm version](https://badge.fury.io/js/%40nexys%2Fmath-ts.svg)](https://www.npmjs.com/package/@nexys/math-ts) [![TavisCI](https://travis-ci.com/Nexysweb/tableau-wdc-react.svg?branch=master)](https://travis-ci.com/github/Nexysweb/math-ts) [![Deployment](

13 lines (12 loc) 392 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.linear = (x, m, b) => exports.polynomial(x, [b, m]); exports.quadratic = (x, a, b, c) => exports.polynomial(x, [c, b, a]); exports.polynomial = (x, a) => { if (a.length === 0) { return 0; } return a.map((v, i) => { return v * (Math.pow(x, i)); }).reduce((a, b) => a + b); };