Core 1.0
|
Quintic polynomials. More...
#include <quintic.h>
Public Member Functions | |
Quintic () | |
Empty. | |
Quintic (const double &, const double &, const double &, const double &, const double &, const double &) | |
Creates a quintic polynomial. | |
Quintic (const Quadric &) | |
Creates a quintic from a quadric. | |
Quintic (const Cubic &) | |
Creates a quintic from a cubic. | |
Quintic (const Quartic &) | |
Creates a quintic from a quartic. | |
~Quintic () | |
Empty. | |
constexpr double & | operator[] (int) |
Access to the coefficients of the quintic. | |
constexpr double | operator[] (int) const |
Overloaded. | |
int | CheckDegree () const |
Check the degree of the quintic. | |
Quintic | operator- () const |
Unary. | |
Quintic & | operator+= (const Quintic &) |
Destructive sum. | |
Quintic & | operator-= (const Quintic &) |
Destructive difference. | |
Quintic & | operator*= (const double &) |
Scale. | |
Quintic & | operator/= (const double &) |
Scale. | |
Quartic | Prime () const |
Computes the first derivative of a quintic, which is a quartic. | |
Cubic | Second () const |
Computes the second derivative of a quintic, which is a cubic. | |
Quadric | Third () const |
Computes the third derivative of a quintic. | |
double | K (const double &, const double &) const |
Compute the Lipschitz constant of the quintic. | |
constexpr double | operator() (const double &) const |
Evaluates the quintic. | |
constexpr double | Derivative (const double &) const |
Computes the derivative value at a given point. | |
int | Solve (double *) const |
Solve the quintic equation over a given interval. | |
int | Solve (double *, const double &, const double &) const |
Search the roots of a quintic equation over a given interval. | |
void | Range (double &, double &, const double &=0.0, const double &=1.0) const |
Compute the range of values taken by a quintic over a given interval. | |
Static Public Member Functions | |
static Quintic | Hermite (const double &, const double &, const double &, const double &, const double &, const double &) |
Creates an Hermite quintic polynomial on interval [0,1]. | |
static double | Smooth (const double &) |
Compute the value of smooth C2 interpolating function over unit interval. | |
static double | SmoothStep (const double &, const double &, const double &) |
Compute a quintic smooth step. | |
static double | Gaussian (const double &, const double &, const double &) |
Compute a compactly supported Gaussian-like pulse. | |
static double | GaussianThick (const double &, const double &, const double &, const double &) |
Compute a compactly supported Gaussian-like pulse with a thick plateau. | |
static Quintic | FromRoots (const QVector< double > &) |
Create a quintic from a set of roots. | |
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 [6] = { 0.0,0.0,0.0,0.0,0.0,0.0 } |
Array of coefficients. | |
Friends | |
Quintic | operator+ (const Quintic &u, const Quintic &v) |
Overloaded. | |
Quintic | operator- (const Quintic &v, const Quintic &u) |
Overloaded. | |
Quintic | operator* (const Quintic &u, const double &e) |
Overloaded. | |
Quintic | operator* (const double &a, const Quintic &p) |
Overloaded. | |
Quintic | operator/ (const Quintic &p, const double &a) |
Overloaded. | |
std::ostream & | operator<< (std::ostream &s, const Quintic &p) |
Overloaded output-stream operator. | |
Quintic polynomials.
Closed form expression of roots does not exist for polynomials with a degree greater than 5.
Constructors should provide the coefficients in descending order. Example of how to code the quintic x5-x+1:
Quintic implements some inline static member function such as:
|
inline |
|
inline |
|
inlineconstexpr |
Computes the derivative value at a given point.
If only one evaluation is to be made, this function is more efficient than Prime() and then evaluating the derivative for a given input value.
x | Real. |
|
static |
Create a quintic from a set of roots.
r | Set of roots. |
Example of how to code the quintic (x-1)3(x+1)(x+2):
|
inlinestatic |
Compute a compactly supported Gaussian-like pulse.
The function has C2 continuity.
c | Center. |
r | Radius. |
x | Value. |
|
inlinestatic |
Compute a compactly supported Gaussian-like pulse with a thick plateau.
c | Center. |
t,r | Thickness (plateau) and radius. |
x | Value. |
|
static |
Creates an Hermite quintic polynomial on interval [0,1].
a,b | Values at t=0 and t=1. |
ta,tb | Derivatives at t=0 and t=1. |
na,nb | Second derivatives at t=0 and t=1. |
double Quintic::K | ( | const double & | a, |
const double & | b ) const |
Compute the Lipschitz constant of the quintic.
a,b | Interval. |
|
inlineconstexpr |
Evaluates the quintic.
x | Argument value of the function. |
void Quintic::Range | ( | double & | x, |
double & | y, | ||
const double & | a = 0.0, | ||
const double & | b = 1.0 ) const |
Compute the range of values taken by a quintic over a given interval.
a,b | Interval. |
x,y | Returned range. |
|
inlinestatic |
Compute the value of smooth C2 interpolating function over unit interval.
The quintic is defined as x3(6 x2-15 x + 10). Its first and second derivatives at 0.0 and 1.0 are 0.0.
The Lipschitz constant of the smooth quintic over [0,1] is λ=15/8.
x | Argument in [0,1]. |
|
inlinestatic |
Compute a quintic smooth step.
The code is slightly more efficient than:
x | Input value. |
a,b | Interval values. |
int Quintic::Solve | ( | double * | roots | ) | const |
Solve the quintic 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 Quintic::Solve | ( | double * | roots, |
const double & | a, | ||
const double & | b ) const |
Search the roots of a quintic equation over a given interval.
roots | Array for storing the roots. |
a,b | Interval range. |
|
friend |
Overloaded output-stream operator.
s | Stream. |
p | The quintic. |