Core 1.0
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.
 
 Sextic (const Quadric &)
 Creates a sextic given a quadric.
 
 Sextic (const Cubic &)
 Creates a sextic given a cubic.
 
 Sextic (const Quartic &)
 Creates a sextic given a quartic.
 
 ~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.
 
constexpr double operator() (const double &) const
 Evaluates the sextic.
 
constexpr double Derivative (const double &) const
 Computes the derivative of the sextic.
 
int Solve (double *) const
 Solve the sextic equation over a given interval.
 
int Solve (double *, const double &, const double &) const
 Search the roots of a sextic 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 sextic over a given interval.
 

Static Public Member Functions

static Sextic Compose (const Quadric &, const Cubic &)
 Compose the quadric by a cubic.
 
static Sextic Compose (const Cubic &, const Quadric &)
 Compose the cubic by a quadric.
 

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 &u, const Sextic &v)
 Overloaded.
 
Sextic operator- (const Sextic &v, const Sextic &u)
 Overloaded.
 
Sextic operator* (const Sextic &u, const double &e)
 Overloaded.
 
Sextic operator* (const double &a, const Sextic &p)
 Overloaded.
 
Sextic operator/ (const Sextic &p, const double &a)
 Overloaded.
 
Sextic operator* (const Quartic &u, const Quadric &v)
 Multiply a quartic by a quadric.
 
Sextic operator* (const Cubic &u, const Cubic &v)
 Multiply two cubics which generates a sextic.
 
std::ostream & operator<< (std::ostream &s, const Sextic &p)
 Overloaded output-stream operator.
 

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()
Empty.
Definition sextic.h:12

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()

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()()

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 Symbol 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.