35#include "gsl/gsl_math.h"
36#include "gsl/gsl_errno.h"
37#include "gsl/gsl_poly.h"
53 fDerived_params(std::vector<
double>(
n) )
61 fDerived_params(std::vector<
double>(1) )
71 fDerived_params(std::vector<
double>(2) )
83 fDerived_params(std::vector<
double>(3) )
96 fDerived_params(std::vector<
double>(4) )
129 for (
unsigned int i = 0; i <
fOrder; ++i )
159 std::vector<std::complex<double>>
roots;
167 roots.push_back(std::complex<double>(
r, 0.0));
175 std::cout <<
"Polynomial quadratic ::- FAILED to find roots" << std::endl;
179 roots.push_back(std::complex<double>(
z1.dat[0],
z1.dat[1]));
180 roots.push_back(std::complex<double>(
z2.dat[0],
z2.dat[1]));
193 std::cout <<
"Polynomial cubic::- FAILED to find roots" << std::endl;
197 roots.push_back(std::complex<double>(
z1.dat[0],
z1.dat[1]));
198 roots.push_back(std::complex<double>(
z2.dat[0],
z2.dat[1]));
199 roots.push_back(std::complex<double>(
z3.dat[0],
z3.dat[1]));
214 std::cout <<
"Polynomial quartic ::- FAILED to find roots" << std::endl;
218 roots.push_back(std::complex<double>(
z1.dat[0],
z1.dat[1]));
219 roots.push_back(std::complex<double>(
z2.dat[0],
z2.dat[1]));
220 roots.push_back(std::complex<double>(
z3.dat[0],
z3.dat[1]));
221 roots.push_back(std::complex<double>(
z4.dat[0],
z4.dat[1]));
234 for (
const auto &
r :
roots)
235 if (std::abs(
r.imag()) < std::numeric_limits<double>::epsilon())
249 std::vector<std::complex<double>>
roots;
255 std::vector<double> z(2 *
n);
260 for (
unsigned int i = 0; i <
n; ++i)
261 roots.push_back(std::complex<double>(z[2 * i], z[2 * i + 1]));
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
const double * Parameters() const override
Access the parameter values.
std::vector< double > fParams
Parametric Function class describing polynomials of order n.
std::vector< std::complex< double > > FindRoots() const
Find the polynomial roots.
Polynomial(unsigned int n=0)
Construct a Polynomial function of order n.
std::vector< std::complex< double > > FindNumRoots() const
Find the polynomial roots using always an iterative numerical methods The numerical method used is fr...
double DoEvalPar(double x, const double *p) const override
Implementation of the evaluation function using the x value and the parameters.
IGenFunction * Clone() const override
Clone a function.
double DoParameterDerivative(double x, const double *p, unsigned int ipar) const override
Evaluate the gradient, to be implemented by the derived classes.
double DoDerivative(double x) const override
Function to evaluate the derivative with respect each coordinate. To be implemented by the derived cl...
std::vector< double > FindRealRoots() const
Find the only the real polynomial roots.
std::vector< double > fDerived_params
int gsl_poly_complex_solve_quartic(double a, double b, double c, double d, gsl_complex *z0, gsl_complex *z1, gsl_complex *z2, gsl_complex *z3)
Namespace for new Math classes and functions.
int gsl_poly_complex_solve_cubic(double a, double b, double c, gsl_complex *z0, gsl_complex *z1, gsl_complex *z2)