Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Namespaces | Functions
MathUtils_Poly.hxx File Reference
#include <MathUtils_Core.hxx>
#include <cmath>
#include <array>

Namespaces

namespace  MathUtils
 Modern math solver types and result structures.
 

Functions

double MathUtils::EvalPoly (const double *theCoeffs, int theDegree, double theX)
 Evaluate polynomial using Horner's method. Coefficients are ordered as [a0, a1, a2, ...] for P(x) = a0 + a1*x + a2*x^2 + ...
 
void MathUtils::EvalPolyDeriv (const double *theCoeffs, int theDegree, double theX, double &theValue, double &theDeriv)
 Evaluate polynomial and its derivative using Horner's method. Computes both P(x) and P'(x) efficiently in a single pass.
 
double MathUtils::EvalPolyDesc (const double *theCoeffs, int theDegree, double theX)
 Evaluate polynomial with coefficients in descending order. Coefficients are ordered as [an, a(n-1), ..., a1, a0] for P(x) = an*x^n + ... + a0.
 
double MathUtils::RefinePolyRoot (const double *theCoeffs, int theDegree, double theRoot, int theMaxIter=5)
 Newton-Raphson refinement for polynomial root. Polishes an approximate root to higher precision.
 
double MathUtils::RefinePolyRootDesc (const double *theCoeffs, int theDegree, double theRoot, int theMaxIter=5)
 Newton-Raphson refinement with coefficients in descending order.
 
void MathUtils::SortRoots (double *theRoots, size_t theCount)
 Sort roots in ascending order (simple insertion sort for small arrays).
 
size_t MathUtils::RemoveDuplicateRoots (double *theRoots, size_t theCount, double theTolerance=1.0e-10)
 Remove duplicate roots within tolerance.
 
void MathUtils::DepressCubic (double theB, double theC, double theD, double &theP, double &theQ, double &theShift)
 Compute depressed cubic coefficients. Transforms x^3 + bx^2 + cx + d to t^3 + pt + q via x = t - b/3.
 
void MathUtils::DepressQuartic (double theB, double theC, double theD, double theE, double &theP, double &theQ, double &theR, double &theShift)
 Compute depressed quartic coefficients. Transforms x^4 + bx^3 + cx^2 + dx + e to t^4 + pt^2 + qt + r via x = t - b/4.