Gravity Engine 2 4.0
Loading...
Searching...
No Matches
GravityEngine2.PolynomialSolver Class Reference

Static Public Member Functions

static Complex[] BrokenCubic (double p, double q, double r)
 Solutions of the cubic y^3 + p y^2 + q y + r = 0.
 
static double[] Quadratic (double a, double b, double c)
 Solve the equation ax^2 + bx + c = 0 for two real roots. If solution is complex, return NaN.
 
static Complex[] Quartic (double a, double b, double c, double d)
 Solve a Quartic of the form: x^4 + a x^3 + b x^2 + c x + d = 0.
 
static Complex[] SolveCubic (double a, double b, double c, double d)
 Solve ax^3+bx^2+cx+d=0 for x. Calculation of the 3 roots of a cubic equation according to https://en.wikipedia.org/wiki/Cubic_equation#General_cubic_formula Using the complex struct from System.Numerics Visual Studio 2010, .NET version 4.0 (Initial Implementation from https://www.daniweb.com/programming/software-development/code/454493/solving-the-cubic-equation-using-the-complex-struct (added fix for initial C=0)
 

Member Function Documentation

◆ BrokenCubic()

static Complex[] GravityEngine2.PolynomialSolver.BrokenCubic ( double p,
double q,
double r )
static

Solutions of the cubic y^3 + p y^2 + q y + r = 0.

From CRC Standard Math Tables, 28th Edition p9.

Parameters
p
q
r
Returns

DOES not work. Something to do with the choice of cube roots maybe?

◆ Quadratic()

static double[] GravityEngine2.PolynomialSolver.Quadratic ( double a,
double b,
double c )
static

Solve the equation ax^2 + bx + c = 0 for two real roots. If solution is complex, return NaN.

Parameters
a
b
c
Returns

◆ Quartic()

static Complex[] GravityEngine2.PolynomialSolver.Quartic ( double a,
double b,
double c,
double d )
static

Solve a Quartic of the form: x^4 + a x^3 + b x^2 + c x + d = 0.

CRC Math Handbook. 28th Ed. p 12

Returns
array of solutions

◆ SolveCubic()

static Complex[] GravityEngine2.PolynomialSolver.SolveCubic ( double a,
double b,
double c,
double d )
static

Solve ax^3+bx^2+cx+d=0 for x. Calculation of the 3 roots of a cubic equation according to https://en.wikipedia.org/wiki/Cubic_equation#General_cubic_formula Using the complex struct from System.Numerics Visual Studio 2010, .NET version 4.0 (Initial Implementation from https://www.daniweb.com/programming/software-development/code/454493/solving-the-cubic-equation-using-the-complex-struct (added fix for initial C=0)

Parameters
areal coefficient of x to the 3th power
breal coefficient of x to the 2nd power
creal coefficient of x to the 1th power
dreal coefficient of x to the zeroth power
Returns
A list of 3 complex numbers

The documentation for this class was generated from the following file: