Core 1.0
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | Friends | List of all members
Quintic Class Reference

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. More...
 
 Quintic (const Cubic &)
 Creates a quintic from a cubic. More...
 
 Quintic (const Quartic &)
 Creates a quintic from a quartic. More...
 
 ~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.
 
Quinticoperator+= (const Quintic &)
 Destructive sum.
 
Quinticoperator-= (const Quintic &)
 Destructive difference.
 
Quinticoperator*= (const double &)
 Scale.
 
Quinticoperator/= (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. More...
 
constexpr double operator() (const double &) const
 Evaluates the quintic. More...
 
constexpr double Derivative (const double &) const
 Computes the derivative value at a given point. More...
 
int Solve (double *) const
 Solve the quintic equation over a given interval. More...
 
int Solve (double *, const double &, const double &) const
 Search the roots of a quintic 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 quintic over a given interval. More...
 

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]. More...
 
static double Smooth (const double &)
 Compute the value of smooth C2 interpolating function over unit interval. More...
 
static double SmoothStep (const double &, const double &, const double &)
 Compute a quintic smooth step. More...
 
static double Gaussian (const double &, const double &, const double &)
 Compute a compactly supported Gaussian-like pulse. More...
 
static double GaussianThick (const double &, const double &, const double &, const double &)
 Compute a compactly supported Gaussian-like pulse with a thick plateau. 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 [6] = { 0.0,0.0,0.0,0.0,0.0,0.0 }
 Array of coefficients.
 

Friends

Quintic operator+ (const Quintic &, const Quintic &)
 Overloaded.
 
Quintic operator- (const Quintic &, const Quintic &)
 Overloaded.
 
Quintic operator* (const Quintic &, const double &)
 Overloaded.
 
Quintic operator* (const double &, const Quintic &)
 Overloaded.
 
Quintic operator/ (const Quintic &, const double &)
 Overloaded.
 
std::ostream & operator<< (std::ostream &, const Quintic &)
 Overloaded output-stream operator. More...
 

Detailed Description

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 p(1.0,0.0,0.0,-1.0,1.0);
Quintic polynomials.
Definition: quintic.h:8

Quintic implements some inline static member function such as:

inline double Quintic::Smooth(const double& x)
{
return x * x * x * (x * (x * 6 - 15) + 10);
}
static double Smooth(const double &)
Compute the value of smooth C2 interpolating function over unit interval.
Definition: quintic.h:242

Constructor & Destructor Documentation

◆ Quintic() [1/3]

Quintic::Quintic ( const Quadric p)
inline

Creates a quintic from a quadric.

Simply set higher coefficients to 0.

Parameters
pQuadric.

◆ Quintic() [2/3]

Quintic::Quintic ( const Cubic p)
inline

Creates a quintic from a cubic.

Simply set higher coefficients to 0.

Parameters
pCubic.

◆ Quintic() [3/3]

Quintic::Quintic ( const Quartic p)
inline

Creates a quintic from a quartic.

Parameters
pQuartic.

Member Function Documentation

◆ Derivative()

constexpr double Quintic::Derivative ( const double &  x) const
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.

Parameters
xReal.
See also
Quintic::Prime

◆ Gaussian()

double Quintic::Gaussian ( const double &  c,
const double &  r,
const double &  x 
)
inlinestatic

Compute a compactly supported Gaussian-like pulse.

The function has C2 continuity.

See also
Cubic::Gaussian()
Parameters
cCenter.
rRadius.
xValue.

◆ GaussianThick()

double Quintic::GaussianThick ( const double &  c,
const double &  t,
const double &  r,
const double &  x 
)
inlinestatic

Compute a compactly supported Gaussian-like pulse with a thick plateau.

See also
Cubic::GaussianThick()
Quintic::Gaussian()
Parameters
cCenter.
t,rThickness (plateau) and radius.
xValue.

◆ Hermite()

Quintic Quintic::Hermite ( const double &  a,
const double &  b,
const double &  ta,
const double &  tb,
const double &  na,
const double &  nb 
)
static

Creates an Hermite quintic polynomial on interval [0,1].

Parameters
a,bValues at t=0 and t=1.
ta,tbDerivatives at t=0 and t=1.
na,nbSecond derivatives at t=0 and t=1.

◆ K()

double Quintic::K ( const double &  a,
const double &  b 
) const

Compute the Lipschitz constant of the quintic.

Parameters
a,bInterval.

◆ operator()()

constexpr double Quintic::operator() ( const double &  x) const
inlineconstexpr

Evaluates the quintic.

Parameters
xArgument value of the function.

◆ Range()

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.

Parameters
a,bInterval.
x,yReturned range.

◆ Smooth()

double Quintic::Smooth ( const double &  x)
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.

Parameters
xArgument in [0,1].
See also
Septic::Smooth(), Cubic::Smooth()

◆ SmoothStep()

double Quintic::SmoothStep ( const double &  x,
const double &  a,
const double &  b 
)
inlinestatic

Compute a quintic smooth step.

The code is slightly more efficient than:

double y=Quintic::Smooth(Linear::Step(x,a,b));
static double Step(const double &, const double &, const double &)
Create a linear step.
Definition: linear.h:200
Parameters
xInput value.
a,bInterval values.
See also
Cubic::SmoothStep, Septic::SmoothStep()

◆ Solve() [1/2]

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.

Parameters
rootsThe array of roots.

◆ Solve() [2/2]

int Quintic::Solve ( double *  roots,
const double &  a,
const double &  b 
) const

Search the roots of a quintic equation over a given interval.

Parameters
rootsArray for storing the roots.
a,bInterval range.

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  s,
const Quintic p 
)
friend

Overloaded output-stream operator.

Parameters
sStream.
pThe quintic.