1 #ifndef __JMATH__JPOLYNOME__
2 #define __JMATH__JPOLYNOME__
19 namespace JPP {
using namespace JMATH; }
30 public JMath<JPolynome_t>,
48 const double eps = std::numeric_limits<double>::min())
const
50 if (this->size() == P.size()) {
52 for (const_iterator p = this->begin(), q = P.begin(); p != this->end(); ++p, ++q) {
53 if (fabs(*p - *q) > eps) {
75 while (this->size() < polynome.size()) {
79 for (
size_t i = 0; i != this->size(); ++i) {
80 (*this)[i] += polynome[i];
95 while (this->size() < polynome.size()) {
99 for (
size_t i = 0; i != this->size(); ++i) {
100 (*this)[i] -= polynome[i];
115 for (iterator i = begin(); i != end(); ++i) {
132 for (
double x; in >>
x; ) {
149 for (JPolynome_t::const_iterator i =
object.begin(); i !=
object.end(); ++i) {
150 out <<
' ' <<
FIXED(9,3) << *i;
193 for (T i = __begin; i != __end; ++i) {
204 template<
class ...Args>
216 template<
class ...Args>
238 for (const_iterator i = begin(); i != end(); ++i, z *=
x) {
261 for (const_iterator i = begin(); ++i != end(); ++
n, z *=
x) {
282 for (const_iterator i = begin(); i != end(); ++i, ++
n, z *=
x) {
312 }
else if (size() == 1u) {
314 buffer.push_back(0.0);
320 for (const_iterator i = begin(); ++i != end(); ++
n) {
321 buffer.push_back(
n * (*i));
340 for (const_iterator i = begin(); i != end(); ++i, ++
n) {
341 buffer.push_back((*i) / (double)
n);
360 for (const_iterator i = begin(); i != end(); ++i, z *=
x) {
374 template<
class ...Args>
Base class for data structures with artithmetic capabilities.
Auxiliary classes and methods for mathematical operations.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
Template definition of auxiliary base class for comparison of data structures.
Auxiliary base class for aritmetic operations of derived class types.
JPolynome_t & add(const JPolynome_t &polynome)
Add polynome.
friend std::istream & operator>>(std::istream &in, JPolynome_t &object)
Read polynome from input.
JPolynome_t & sub(const JPolynome_t &polynome)
Subtract polynome.
JPolynome_t()
Default constructor.
bool equals(const JPolynome_t &P, const double eps=std::numeric_limits< double >::min()) const
Equality.
friend std::ostream & operator<<(std::ostream &out, const JPolynome_t &object)
Write polynome to output.
JPolynome_t & mul(const double factor)
Scale polynome.
Recursive template class for polynomial function.
void set(const double *pA)
Set parameter values.
double getIntegral(const double x) const
Integral value.
JPolynome()
Default constructor.
JPolynome(T __begin, T __end)
Constructor.
double operator()(const double x) const
Function value.
JPolynome(const Args &...args)
Initialise constructor.
double getValue(const double x) const
Function value.
JPolynome & set(const Args &...args)
Set values.
JPolynome getDerivative() const
Get derivative function.
JPolynome(const JPolynome_t &polynome)
Copy constructor.
JPolynome_t getGradient(const double x) const
Get gradient.
JPolynome getIntegral() const
get integral function.
double getDerivative(const double x) const
Derivative value.
void __set__() const
Termination method for setting values.
void __set__(const double x, const Args &...args)
Recursive method for setting values.