Go to the documentation of this file.
12 #ifndef ECL_GEOMETRY_POLYNOMIALS_HPP_
13 #define ECL_GEOMETRY_POLYNOMIALS_HPP_
44 template <
unsigned int N>
class Polynomial;
61 template<
unsigned int N>
62 class BluePrintFactory< Polynomial<N> > {
109 template <
unsigned int N>
127 Polynomial() : coeff(Coefficients::Constant(0.0)) {};
153 template<
typename Derived>
176 void shift_horizontal(
const double &shift);
192 for (
unsigned int i = 0; i < N; ++i ) {
193 derivative_coefficients[i] = (i+1)*coeff[i+1];
195 return derivative_polynomial;
205 double derivative(
const double &x)
const;
214 double dderivative(
const double &x)
const;
233 Coefficients& coefficients() {
return coeff; };
239 const Coefficients& coefficients()
const {
return coeff; };
249 double operator ()(
const double &x)
const;
263 template <
typename OutputStream,
unsigned int Degree>
295 Polynomial() : coeff(Coefficients::Constant(0.0)) {};
296 virtual ~Polynomial() {};
307 void shift_horizontal(
const double& ) {};
319 Polynomial<0> derivative()
const {
320 return Polynomial<0>();
329 double derivative(
const double& )
const {
339 double dderivative(
const double& )
const {
375 double operator ()(
const double& )
const {
395 template <
unsigned int N>
402 for (
unsigned int i = 0; i < N; ++i ) {
405 for ( iter = (pascals_triangle.
begin(i)+1); iter != pascals_triangle.
end(i); ++iter ) {
406 coeff[i] += (*iter)*tmp*coeff[j];
415 template <
unsigned int N>
419 double value = coeff[0];
420 for (
unsigned int i = 1; i <= N; ++i ) {
421 value += coeff[i]*tmp;
426 template <
unsigned int N>
430 return derivative()(x);
436 template <
unsigned int N>
440 return derivative().derivative()(x);
450 template <
typename OutputStream,
unsigned int Degree>
451 OutputStream&
operator << (OutputStream &ostream,
const Polynomial<Degree> &polynomial)
455 Format<double> format;
458 ostream << format(polynomial.coeff[0]);
459 for (
unsigned int i = 1; i <= Degree; ++i) {
460 ostream <<
" + " << format(polynomial.coeff[i]) <<
"x^" << i;
471 namespace blueprints {
507 LinearInterpolation(
const double x_i,
const double y_i,
const double x_f,
const double y_f) :
534 double x_initial, y_initial;
535 double x_final, y_final;
596 double x_final, y_final;
639 const double x_f,
const double y_f,
const double ydot_f) :
642 ydot_initial(ydot_i),
667 double x_initial, y_initial, ydot_initial;
668 double x_final, y_final, ydot_final;
709 const double x_f,
const double y_f,
const double yddot_f) :
712 yddot_initial(yddot_i),
727 base_type instantiate();
738 double x_initial, y_initial, yddot_initial;
739 double x_final, y_final, yddot_final;
784 QuinticInterpolation(
const double x_i,
const double y_i,
const double ydot_i,
const double yddot_i,
785 const double x_f,
const double y_f,
const double ydot_f,
const double yddot_f) :
788 ydot_initial(ydot_i),
789 yddot_initial(yddot_i),
816 double x_initial, y_initial, ydot_initial, yddot_initial;
817 double x_final, y_final, ydot_final, yddot_final;
861 static LinearInterpolation Interpolation(
const double x_i,
const double y_i,
const double x_f,
const double y_f);
870 static LinearPointSlopeForm PointSlopeForm(
const double x_f,
const double y_f,
const double slope);
910 const double x_f,
const double y_f,
const double ydot_f);
930 const double x_f,
const double y_f,
const double yddot_f);
971 static QuinticInterpolation Interpolation(
const double x_i,
const double y_i,
const double ydot_i,
const double yddot_i,
972 const double x_f,
const double y_f,
const double ydot_f,
const double yddot_f);
1052 virtual ~Minimum() {}
1076 virtual ~Minimum() {}
1090 Intersection() : last_operation_failed(false) {}
1091 virtual ~Intersection() {}
1109 bool fail()
const {
return last_operation_failed; }
1112 bool last_operation_failed;
1147 virtual ~Division() {};
1235 virtual ~FunctionMath() {};
1245 point = intersection(
f,g);
1287 virtual ~FunctionMath() {};
1316 virtual ~FunctionMath() {};
1345 static double Maximum(
const double& x_begin,
const double& x_end,
const CubicPolynomial &
function) {
Generic container storing a cartesian point of dimension N.
Synthetic division between quadratic and a factor.
Holds the coefficients for pascal's triangle up to row N.
#define ecl_compile_time_concept_check(Model)
OutputStream & operator<<(OutputStream &ostream, const Array< ElementType, ArraySize > &array)
Cartesian point representations.
Templatised specialisations for pascal's triangle.
Coefficients & coefficients()
Handle to the coefficient array, use to initialise the polynomial.
void shift_horizontal(const double &shift)
Horizontal shift transform.
Blueprint for interpolating a cubic polynomial between end point conditions.
CartesianPoint< double, 2 > CartesianPoint2d
Eigen style convenience handle for x, y, z triples in double format.
Primary template functor for the roots of a function (x-axis intercepts).
Blueprint for interpolating a cubic polynomial between end point conditions.
Functors for evaluating various mathematical properties of functions.
Polynomial< 1 > LinearFunction
Mathematical term for 1st order polynomials.
X axis intercepts for linear functions.
virtual ~BluePrintFactory()
#define ecl_geometry_PUBLIC
X axis intercepts for quadratics.
Polynomial< 2 > QuadraticPolynomial
Mathematical term for 2nd order polynomials.
Primary template functor for the minimum of a continuous function.
Mathematical maximum on a compact interval for linear functions.
Mathematical maximum on a compact interval for cubic polynomials.
Intersection of two linear functions.
Primary template functor for the maximum of a continuous function.
Mathematical minimum on a compact interval for linear functions.
Blueprint for interpolating a quintic polynomial between end point conditions.
Primary template functor for polynomial division.
X axis intercepts for cubic polynomials.
Representation of a polynomial function of n-th degree.
Used as a parent to load function math into function classes.
void implementApply(BaseType &object) const
double operator()(const double &x) const
Access the value of the polynomial at a certain point.
#define ecl_catch(exception)
#define ecl_throw(exception)
Polynomial< 5 > QuinticPolynomial
Mathematical term for 5th order polynomials.
Blueprint for interpolating a linear function connecting end point conditions.
const_iterator begin(unsigned int index=0) const
Iterator generator for diagonals of pascals triangle [begin].
Polynomial< 3 > CubicPolynomial
Mathematical term for 3rd order polynomials.
Coefficients & coefficients()
Handle to the coefficient array, use to initialise the polynomial.
Embedded control libraries.
Polynomial< N-1 > derivative() const
Generates the derivative polynomial.
Array< int,(N+2) *(N+1)/2 >::const_iterator const_iterator
Utilise the array's iterator for parsing the triangle.
Mathematical minimum on a compact interval for cubic polynomials.
double dderivative(const double &x) const
Access the second derivative directly.
const_iterator end(unsigned int index=0) const
Iterator generator for diagonals of pascals triangle [end].
Synthetic division between cubic and a factor.
ecl_geometry
Author(s): Daniel Stonier
autogenerated on Wed Mar 2 2022 00:16:39