cubic-roots

Implementation of Kahan's cubic root finder.

Last updated 3 years ago by
muralha .

MIT ·
Repository ·
Bugs ·
Original npm ·
Tarball ·
package.json
$ cnpm install cubic-roots

SYNC missed versions from
official npm registry.

Implementation of Kahan's cubic root finder.

According to Kahan, standard cubic root finders based on classical methods are prone to numerical inaccuracies. This is an implementation of a numerically stable method illustrated in Kahan's notes titled "To Solve a Real Cubic Equation".

The notes can be found here: http://people.eecs.berkeley.edu/~wkahan/Math128/Cubic.pdf.

The quadratic equation solved is Ax^{2} + Bx + C = 0. The cubic equation solved is Ax^{3} + Bx^{2} + Cx + D = 0.

- getQuadraticRoots(A, B, C)
- returns 4 real numbers: A1, B1, A2, B2
- this corresponds to the (possibly) complex roots A1 + B1 * i and A2 + B2 * i.

- getCubicRoots(A, B, C, D)
- returns 5 real numbers: A0, A1, B1, A2, B2
- this corresponds to the 1 real and 2 (possibly) complex roots A0, A1 + B1 * i, and A2 + B2 * i.

Algorithm and pseudocode by William Kahan. Implementation in Javascript by Tim Bright

(c) Tim Bright, 2017. MIT License.

- 2.0.0 ... latest (3 years ago)

Maintainers (1)

Downloads

Today
0

This Week
0

This Month
1

Last Day
0

Last Week
0

Last Month
3

Dev Dependencies (0)

None
Dependents (1)

Copyright 2014 - 2017 © taobao.org |