PLUTO
|
Solve quartic and cubic equations-. More...
#include "pluto.h"
Go to the source code of this file.
Macros | |
#define | DEBUG NO |
#define | swap(x, y) f = x; x = y; y = f; |
#define | SWAP(x, y) {double _t; _t = x; x = y; y = _t;} |
Functions | |
void | PrintSolution (double *z) |
int | QuarticNewton (double b, double c, double d, double e, double *z) |
void | QuarticPrintCoeffs (double b, double c, double d, double e) |
double | CheckSolution (double b, double c, double d, double e, double x) |
double | ResolventCubic (double b, double c, double d, double e, double x) |
int | QuarticSolveNew (double b, double c, double d, double e, double *z) |
int | QuadraticSolve (double a, double b, double c, double *x) |
int | QuarticSolve (double b, double c, double d, double e, double *z) |
int | CubicSolve (double b, double c, double d, double z[]) |
Variables | |
static int | debug_print = DEBUG |
#define DEBUG NO |
Definition at line 13 of file quartic.devel1.c.
#define swap | ( | x, | |
y | |||
) | f = x; x = y; y = f; |
Definition at line 30 of file quartic.devel1.c.
#define SWAP | ( | x, | |
y | |||
) | {double _t; _t = x; x = y; y = _t;} |
Definition at line 31 of file quartic.devel1.c.
double CheckSolution | ( | double | b, |
double | c, | ||
double | d, | ||
double | e, | ||
double | x | ||
) |
int CubicSolve | ( | double | b, |
double | c, | ||
double | d, | ||
double | z[] | ||
) |
Solve a cubic equation in the form
For its purpose, it is assumed that ALL roots are double. This makes things faster.
[in] | b | coefficient of the cubic |
[in] | c | coefficient of the cubic |
[in] | d | coefficient of the cubic |
[out] | z | vector containing the roots of the cubic. Roots should be sorted in increasing order. |
Reference: http://www.1728.com/cubic2.htm
Definition at line 213 of file quartic.devel1.c.
void PrintSolution | ( | double * | z | ) |
Definition at line 659 of file quartic.devel1.c.
int QuadraticSolve | ( | double | a, |
double | b, | ||
double | c, | ||
double * | x | ||
) |
Solve a quadratic equation in the form
ax^2 + bx + c = 0
Return roots in increasing order
Definition at line 679 of file quartic.devel1.c.
int QuarticNewton | ( | double | b, |
double | c, | ||
double | d, | ||
double | e, | ||
double * | z | ||
) |
Solve the quartic equation using Newton method for multiple roots.
Reference
Definition at line 571 of file quartic.devel1.c.
void QuarticPrintCoeffs | ( | double | b, |
double | c, | ||
double | d, | ||
double | e | ||
) |
Definition at line 616 of file quartic.devel1.c.
int QuarticSolve | ( | double | b, |
double | c, | ||
double | d, | ||
double | e, | ||
double * | z | ||
) |
Solve a quartic equation in the form
For its purpose, it is assumed that ALL roots are double. This makes things faster.
[in] | b | coefficient of the quartic |
[in] | c | coefficient of the quartic |
[in] | d | coefficient of the quartic |
[in] | e | coefficient of the quartic |
[out] | z | vector containing the (double) roots of the quartic |
Reference:
http://www.1728.com/quartic2.htm
Definition at line 34 of file quartic.devel1.c.
int QuarticSolveNew | ( | double | b, |
double | c, | ||
double | d, | ||
double | e, | ||
double * | z | ||
) |
Solve a quartic equation in the form
For its purpose, it is assumed that ALL roots are double. This makes things faster.
[in] | b | coefficient of the quartic |
[in] | c | coefficient of the quartic |
[in] | d | coefficient of the quartic |
[in] | e | coefficient of the quartic |
[out] | z | vector containing the (double) roots of the quartic |
Reference:
https://en.wikipedia.org/wiki/Quartic_function
Definition at line 319 of file quartic.devel1.c.
double ResolventCubic | ( | double | b, |
double | c, | ||
double | d, | ||
double | e, | ||
double | x | ||
) |
|
static |
Definition at line 24 of file quartic.devel1.c.