|
Core 1.0
|
Nonic polynomials. More...
#include <nonic.h>
Public Member Functions | |
| Nonic () | |
| Empty. | |
| Nonic (const double &, const double &, const double &, const double &, const double &, const double &, const double &, const double &, const double &, const double &) | |
| Creates a Nonic polynomial. | |
| Nonic (const Octic &) | |
| Creates a nonic given an octic. The degree-9 coefficient is set to zero. | |
| Nonic (const Septic &) | |
| Creates a nonic given a septic. Higher coefficients are set to zero. | |
| Nonic (const Sextic &) | |
| Creates a nonic given a sextic. Higher coefficients are set to zero. | |
| Nonic (const Quintic &) | |
| Creates a nonic given a quintic. Higher coefficients are set to zero. | |
| Nonic (const Quartic &) | |
| Creates a nonic given a quartic. Higher coefficients are set to zero. | |
| Nonic (const Cubic &) | |
| Creates a nonic given a cubic. Higher coefficients are set to zero. | |
| Nonic (const Quadric &) | |
| Creates a nonic given a quadric. Higher coefficients are set to zero. | |
| ~Nonic () | |
| Empty. | |
| constexpr double & | operator[] (int) |
| Access to the coefficients of the nonic. | |
| constexpr double | operator[] (int) const |
| Overloaded. | |
| int | CheckDegree () const |
| Check the degree of the Nonic. | |
| Nonic | operator- () const |
| Unary. | |
| Nonic & | operator+= (const Nonic &) |
| Destructive sum of two Nonics. | |
| Nonic & | operator-= (const Nonic &) |
| Destructive difference of two Nonics. | |
| Nonic & | operator*= (const double &) |
| Scale a Nonic by a double value. | |
| Nonic & | operator/= (const double &) |
| Scale a Nonic by a double value. | |
| int | Solve (double *) const |
| Solve the nonic equation. | |
| int | Solve (double *, const double &, const double &) const |
| Search the roots of a nonic equation within a given interval. | |
| Octic | Prime () const |
| Computes the first derivative of a nonic, which is an octic. | |
| Septic | Second () const |
| Computes the second derivative of a Nonic. | |
| Sextic | Third () const |
| Computes the third derivative of a Nonic. | |
| constexpr double | operator() (const double &) const |
| Evaluates the Nonic. | |
| constexpr double | Derivative (const double &) const |
| Computes the derivative of the nonic. | |
Static Public Member Functions | |
| static Nonic | Compose (const Cubic &, const Cubic &) |
| Compose two cubic polynomials into a nonic. | |
| static double | Smooth (const double &) |
| Compute the value of smooth \( C^4 \) interpolating function over unit interval. | |
| static double | SmoothStep (const double &, const double &, const double &) |
| Compute a Nonic smooth step. | |
| static double | Gaussian (const double &, const double &, const double &) |
| Compute a compactly supported Gaussian-like pulse. | |
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 [10] = { 0.0 } |
| Array of coefficients. | |
Friends | |
| Nonic | operator+ (const Nonic &u, const Nonic &v) |
| Overloaded. | |
| Nonic | operator- (const Nonic &v, const Nonic &u) |
| Overloaded. | |
| Nonic | operator* (const Nonic &u, const double &e) |
| Overloaded. | |
| Nonic | operator* (const double &a, const Nonic &p) |
| Overloaded. | |
| Nonic | operator/ (const Nonic &p, const double &a) |
| Overloaded. | |
| std::ostream & | operator<< (std::ostream &s, const Nonic &p) |
| Overloaded output-stream operator. | |
Nonic polynomials.
Constructors should provide the coefficients in descending order. Example of how to code the Nonic \( 19x^9 - x + 1 \):
|
inline |
Creates a nonic given an octic. The degree-9 coefficient is set to zero.
| p | Octic. |
|
inline |
Creates a nonic given a septic. Higher coefficients are set to zero.
| p | Septic. |
|
inline |
Creates a nonic given a sextic. Higher coefficients are set to zero.
| p | Sextic. |
|
inline |
Creates a nonic given a quintic. Higher coefficients are set to zero.
| p | Quintic. |
|
inline |
Creates a nonic given a quartic. Higher coefficients are set to zero.
| p | Quartic. |
|
inline |
Creates a nonic given a cubic. Higher coefficients are set to zero.
| p | Cubic. |
|
inline |
Creates a nonic given a quadric. Higher coefficients are set to zero.
| p | Quadric. |
Compose two cubic polynomials into a nonic.
This function computes p(q(x)), where p is the outer cubic and q the inner cubic.
| p | The outer cubic polynomial. |
| q | The inner cubic polynomial (argument). |
|
inlineconstexpr |
Computes the derivative of the nonic.
This function is more efficient than using Prime() and then evaluating the derivative for a given input value.
| x | Real. |
|
inlinestatic |
Compute a compactly supported Gaussian-like pulse.
The function has \( C^4 \) continuity.
| c | Center. |
| r | Radius. |
| x | Value. |
|
inlineconstexpr |
Evaluates the Nonic.
| x | Argument value of the function. |
|
inlinestatic |
Compute the value of smooth \( C^4 \) interpolating function over unit interval.
The Nonic is defined as \( x^5 (70 x^4 - 315 x^3 + 540 x^2 - 420 x + 126) \). Its first four derivatives at 0.0 and 1.0 are 0.0.
The Lipschitz constant of the smooth nonic over [0,1] is \( \lambda = 315/128 \).
| x | Argument in [0,1]. |
|
inlinestatic |
Compute a Nonic smooth step.
The code is slightly more efficient than:
| x | Input value. |
| a,b | Interval values. |
| int Nonic::Solve | ( | double * | roots | ) | const |
Solve the nonic equation.
| roots | Roots. |
| int Nonic::Solve | ( | double * | roots, |
| const double & | a, | ||
| const double & | b ) const |
Search the roots of a nonic equation within a given interval.
| roots | Array for storing the roots. |
| a,b | Interval range. |