Core 1.0
Octic Class Reference

Octic polynomials. More...

#include <octic.h>

Public Member Functions

 Octic ()
 Empty.
 Octic (const double &, const double &, const double &, const double &, const double &, const double &, const double &, const double &, const double &)
 Creates a Octic polynomial.
 Octic (const Septic &)
 Creates an octic given a septic. The degree-8 coefficient is set to zero.
 Octic (const Sextic &)
 Creates an octic given a sextic. Higher coefficients are set to zero.
 Octic (const Quintic &)
 Creates an octic given a quintic. Higher coefficients are set to zero.
 Octic (const Quartic &)
 Creates an octic given a quartic. Higher coefficients are set to zero.
 Octic (const Cubic &)
 Creates an octic given a cubic. Higher coefficients are set to zero.
 Octic (const Quadric &)
 Creates an octic given a quadric. Higher coefficients are set to zero.
 ~Octic ()
 Empty.
constexpr double & operator[] (int)
 Access to the coefficients of the octic.
constexpr double operator[] (int) const
 Overloaded.
int CheckDegree () const
 Check the degree of the octic.
Octic operator- () const
 Unary.
Octic & operator+= (const Octic &)
 Destructive sum of two octics.
Octic & operator-= (const Octic &)
 Destructive difference of two octics.
Octic & operator*= (const double &)
 Scale an octic by a double value.
Octic & operator/= (const double &)
 Scale an octic by a double value.
int Solve (double *) const
 Solve the octic equation.
int Solve (double *, const double &, const double &) const
 Search the roots of an octic equation within a given interval.
Septic Prime () const
 Computes the first derivative of a Octic.
Sextic Second () const
 Computes the second derivative of a Octic.
Quintic Third () const
 Computes the third derivative of a Octic.
constexpr double operator() (const double &) const
 Evaluates the Octic.
constexpr double Derivative (const double &) const
 Computes the derivative of the octic.

Static Public Attributes

static const double epsilon = 1.0e-10
 Epsilon value used to check discriminant terms in the root finding process.

Protected Attributes

double c [9] = { 0.0 }
 Array of coefficients.

Friends

Octic operator+ (const Octic &u, const Octic &v)
 Overloaded.
Octic operator- (const Octic &v, const Octic &u)
 Overloaded.
Octic operator* (const Octic &u, const double &e)
 Overloaded.
Octic operator* (const double &a, const Octic &p)
 Overloaded.
Octic operator/ (const Octic &p, const double &a)
 Overloaded.
Octic operator* (const Quartic &u, const Quartic &v)
 Multiply two quartics.
Octic operator* (const Sextic &s, const Quadric &q)
 Multiply a sextic by a quadric.
std::ostream & operator<< (std::ostream &s, const Octic &p)
 Overloaded output-stream operator.

Detailed Description

Octic polynomials.

Constructors should provide the coefficients in descending order. Example of how to code the octic \( 19x^8 - x + 1 \):

Octic p(19.0,0.0,0.0,0.0,0.0,0.0,0.0,-1.0,1.0);
Octic()
Empty.
Definition octic.h:13

Constructor & Destructor Documentation

◆ Octic() [1/6]

Octic::Octic ( const Septic & p)
inline

Creates an octic given a septic. The degree-8 coefficient is set to zero.

Parameters
pSeptic.

◆ Octic() [2/6]

Octic::Octic ( const Sextic & p)
inline

Creates an octic given a sextic. Higher coefficients are set to zero.

Parameters
pSextic.

◆ Octic() [3/6]

Octic::Octic ( const Quintic & p)
inline

Creates an octic given a quintic. Higher coefficients are set to zero.

Parameters
pQuintic.

◆ Octic() [4/6]

Octic::Octic ( const Quartic & p)
inline

Creates an octic given a quartic. Higher coefficients are set to zero.

Parameters
pQuartic.

◆ Octic() [5/6]

Octic::Octic ( const Cubic & p)
inline

Creates an octic given a cubic. Higher coefficients are set to zero.

Parameters
pCubic.

◆ Octic() [6/6]

Octic::Octic ( const Quadric & p)
inline

Creates an octic given a quadric. Higher coefficients are set to zero.

Parameters
pQuadric.

Member Function Documentation

◆ Derivative()

double Octic::Derivative ( const double & x) const
inlineconstexpr

Computes the derivative of the octic.

This function is more efficient than using Prime() and then evaluating the derivative for a given input value.

Parameters
xReal.

◆ operator()()

double Octic::operator() ( const double & x) const
inlineconstexpr

Evaluates the Octic.

Parameters
xArgument value of the function.

◆ Solve() [1/2]

int Octic::Solve ( double * roots) const

Solve the octic equation.

Calls Polynomial::Solve() when the leading coefficient is non-zero. Otherwise cascades to lower-degree solvers (Septic down to Quadric) by dropping zero leading coefficients.

Parameters
rootsThe array of roots.

◆ Solve() [2/2]

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

Search the roots of an octic equation within a given interval.

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

◆ operator* [1/2]

Octic operator* ( const Quartic & u,
const Quartic & v )
friend

Multiply two quartics.

Parameters
u,vArgument quartics.

◆ operator* [2/2]

Octic operator* ( const Sextic & s,
const Quadric & q )
friend

Multiply a sextic by a quadric.

Parameters
sSextic.
qQuadric.

◆ operator<<

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

Overloaded output-stream operator.

Parameters
sStream.
pThe Octic.