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

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.
 
Sexticoperator+= (const Sextic &)
 Destructive sum of two sextics.
 
Sexticoperator-= (const Sextic &)
 Destructive difference of two sextics.
 
Sexticoperator*= (const double &)
 Scale a sextic by a double value.
 
Sexticoperator/= (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...
 

Detailed Description

Sextic polynomials, also known as hextics.

Constructors should provide the coefficients in descending order. Example of how to code the sextic 4x6-x+1:

Sextic p(4.0,0.0,0.0,0.0,-1.0,1.0);
Sextic polynomials, also known as hextics.
Definition: sextic.h:8

Constructor & Destructor Documentation

◆ Sextic() [1/4]

Sextic::Sextic ( const Quintic p)
inline

Creates a sextic given a quintic.

Simply set higher coefficients to 0.

Parameters
pQuintic.

◆ Sextic() [2/4]

Sextic::Sextic ( const Quadric p)
inline

Creates a sextic given a quadric.

Simply set higher coefficients to 0.

Parameters
pQuadric.

◆ Sextic() [3/4]

Sextic::Sextic ( const Cubic p)
inline

Creates a sextic given a cubic.

Simply set higher coefficients to 0.

Parameters
pCubic.

◆ Sextic() [4/4]

Sextic::Sextic ( const Quartic p)
inline

Creates a sextic given a quartic.

Simply set highest coefficient to 0.

Parameters
pQuartic.

Member Function Documentation

◆ Compose() [1/2]

Sextic Sextic::Compose ( const Cubic p,
const Quadric q 
)
static

Compose the cubic by a quadric.

This function computes p ( q(x) ), where p denotes the cubic and q the quadric.

Parameters
pThe cubic.
qThe quadric.

◆ Compose() [2/2]

Sextic Sextic::Compose ( const Quadric p,
const Cubic q 
)
static

Compose the quadric by a cubic.

This function computes p ( q(x) ), where p denotes the current quadric and q the argument cubic.

Parameters
pThe quadric.
qThe cubic.

◆ Derivative()

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

Parameters
xReal.

◆ K()

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

Compute the Lipschitz constant of the sextic.

Parameters
a,bInterval.

◆ operator()()

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

Evaluates the sextic.

Parameters
xArgument value of the function.

◆ Range()

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.

Parameters
a,bInterval.
x,yReturned range.

◆ Solve() [1/2]

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.

Parameters
rootsThe array of roots.

◆ Solve() [2/2]

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

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

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

Friends And Related Function Documentation

◆ operator* [1/2]

Sextic operator* ( const Cubic u,
const Cubic v 
)
friend

Multiply two cubics which generates a sextic.

Parameters
u,vArguments.

◆ operator* [2/2]

Sextic operator* ( const Quartic u,
const Quadric v 
)
friend

Multiply a quartic by a quadric.

Parameters
u,vArguments.

◆ operator<<

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

Overloaded output-stream operator.

Parameters
sStream.
pThe sextic.