Core 1.0
|
Sextic polynomials, also known as hextics. More...
#include <sextic.h>
Public Member Functions | |
Sextic () | |
Empty. | |
Sextic (const double &, const double &, const double &, const double &, const double &, const double &, const double &) | |
Creates a sextic. | |
Sextic (const Quintic &) | |
Creates a sextic given a quintic. More... | |
Sextic (const Quadric &) | |
Creates a sextic given a quadric. More... | |
Sextic (const Cubic &) | |
Creates a sextic given a cubic. More... | |
Sextic (const Quartic &) | |
Creates a sextic given a quartic. More... | |
~Sextic () | |
Empty. | |
constexpr double & | operator[] (int) |
Access to the coefficients of the sextic. | |
constexpr double | operator[] (int) const |
Overloaded. | |
int | CheckDegree () const |
Check the degree of the sextic. | |
Sextic | operator- () const |
Unary. | |
Sextic & | operator+= (const Sextic &) |
Destructive sum of two sextics. | |
Sextic & | operator-= (const Sextic &) |
Destructive difference of two sextics. | |
Sextic & | operator*= (const double &) |
Scale a sextic by a double value. | |
Sextic & | operator/= (const double &) |
Scale a sextic by a double value. | |
Quintic | Prime () const |
Computes the first derivative of a sextic, which is a quintic. | |
Quartic | Second () const |
Computes the second derivative of a sextic, which is a quartic. | |
Cubic | Third () const |
Computes the third derivative of a sextic. | |
double | K (const double &, const double &) const |
Compute the Lipschitz constant of the sextic. More... | |
constexpr double | operator() (const double &) const |
Evaluates the sextic. More... | |
constexpr double | Derivative (const double &) const |
Computes the derivative of the sextic. More... | |
int | Solve (double *) const |
Solve the sextic equation over a given interval. More... | |
int | Solve (double *, const double &, const double &) const |
Search the roots of a sextic equation over a given interval. More... | |
void | Range (double &, double &, const double &=0.0, const double &=1.0) const |
Compute the range of values taken by a sextic over a given interval. More... | |
Static Public Member Functions | |
static Sextic | Compose (const Quadric &, const Cubic &) |
Compose the quadric by a cubic. More... | |
static Sextic | Compose (const Cubic &, const Quadric &) |
Compose the cubic by a quadric. More... | |
Static Public Attributes | |
static double | epsilon = 1.0e-10 |
Epsilon value used to check discriminant terms in the root finding process. | |
Protected Attributes | |
double | c [7] = { 0.0,0.0,0.0,0.0,0.0,0.0,0.0 } |
Array of coefficients. | |
Friends | |
Sextic | operator+ (const Sextic &, const Sextic &) |
Overloaded. | |
Sextic | operator- (const Sextic &, const Sextic &) |
Overloaded. | |
Sextic | operator* (const Sextic &, const double &) |
Overloaded. | |
Sextic | operator* (const double &, const Sextic &) |
Overloaded. | |
Sextic | operator/ (const Sextic &, const double &) |
Overloaded. | |
Sextic | operator* (const Quartic &, const Quadric &) |
Multiply a quartic by a quadric. More... | |
Sextic | operator* (const Cubic &, const Cubic &) |
Multiply two cubics which generates a sextic. More... | |
std::ostream & | operator<< (std::ostream &, const Sextic &) |
Overloaded output-stream operator. More... | |
Sextic polynomials, also known as hextics.
Constructors should provide the coefficients in descending order. Example of how to code the sextic 4x6-x+1:
|
inline |
Creates a sextic given a quintic.
Simply set higher coefficients to 0.
p | Quintic. |
|
inline |
Creates a sextic given a quadric.
Simply set higher coefficients to 0.
p | Quadric. |
|
inline |
Creates a sextic given a cubic.
Simply set higher coefficients to 0.
p | Cubic. |
|
inline |
Creates a sextic given a quartic.
Simply set highest coefficient to 0.
p | Quartic. |
Compose the cubic by a quadric.
This function computes p ( q(x) ), where p denotes the cubic and q the quadric.
p | The cubic. |
q | The quadric. |
Compose the quadric by a cubic.
This function computes p ( q(x) ), where p denotes the current quadric and q the argument cubic.
p | The quadric. |
q | The cubic. |
|
inlineconstexpr |
Computes the derivative of the sextic.
This function is more efficient than using Prime() and then evaluating the derivative for a given input value.
x | Real. |
double Sextic::K | ( | const double & | a, |
const double & | b | ||
) | const |
Compute the Lipschitz constant of the sextic.
a,b | Interval. |
|
inlineconstexpr |
Evaluates the sextic.
x | Argument value of the function. |
void Sextic::Range | ( | double & | x, |
double & | y, | ||
const double & | a = 0.0 , |
||
const double & | b = 1.0 |
||
) | const |
Compute the range of values taken by a sextic over a given interval.
a,b | Interval. |
x,y | Returned range. |
int Sextic::Solve | ( | double * | roots | ) | const |
Solve the sextic equation over a given interval.
This function stores the sorted roots in an array and returns the number of roots.
This function calls Polynomial::Solve() if the highest coefficient is not nul, otherwise it calls Quartic::Solve() and other lower degree polynomial solvers which are more efficient.
roots | The array of roots. |
int Sextic::Solve | ( | double * | roots, |
const double & | a, | ||
const double & | b | ||
) | const |
Search the roots of a sextic equation over a given interval.
roots | Array for storing the roots. |
a,b | Interval range. |
Multiply two cubics which generates a sextic.
u,v | Arguments. |
Multiply a quartic by a quadric.
u,v | Arguments. |
|
friend |
Overloaded output-stream operator.
s | Stream. |
p | The sextic. |