cmath
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

cmath

This is a library of fast and robust math operations.

testQuad and solveQuad

Arguments to both are the polynomial coefficients a, b, c for the polynomial ax² + bx + c.

testQuad returns true if the polynomial has roots between x=0 and x=1, inclusive. Otherwise it returns false. This is useful for example in piecewise curve intersections.

solveQuad returns an array with all the roots without any range limit.

testCubic and solveCubic

Arguments to both are the polynomial coefficients a, b, c, d for the polynomial ax³ + bx² + cx + d.

testCubic returns a positive number if the polynomial has roots between x=0 and x=1, inclusive. Otherwise it returns a negative number. This is useful for example in piecewise curve intersections.

solveCubic returns an array with all the roots without any range limit.

License

The MIT License

Copyright (c) 2017-2018 BusFaster Ltd

Readme

Keywords

none

Package Sidebar

Install

npm i cmath

Weekly Downloads

2

Version

0.0.1

License

MIT

Unpacked Size

24.1 kB

Total Files

14

Last publish

Collaborators

  • jjrv