@alesmenzel/cubic-equation
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

🥉 Cubic equation

Javascript implementation calculating roots of cubic equation. Based on Alexander Shtuchkin's implementation.

Installation

npm install @alesmenzel/cubic-equation

Usage

import { calculateCubicRoots } from "@alesmenzel/cubic-equation"

// ax^3 + bx^2 + cx + d = 0
const a = 1
const b = 2
const c = 3
const d = 4
calculateCubicRoots(a, b, c, d)
calculateCubicRoots(a, b, c, d, {
  isZero(value) {
    return value === 0 // or use the default that treats numbers < 1e10 as zeros
  }
})

Readme

Keywords

none

Package Sidebar

Install

npm i @alesmenzel/cubic-equation

Weekly Downloads

3

Version

1.0.0

License

MIT

Unpacked Size

10.2 kB

Total Files

7

Last publish

Collaborators

  • alesmenzel