xc
Macaulay.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // xc utils library; general purpose classes and functions.
4 //
5 // Copyright (C) Luis C. PĂ©rez Tato
6 //
7 // XC utils is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // This software is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program.
19 // If not, see <http://www.gnu.org/licenses/>.
20 //----------------------------------------------------------------------------
21 //Macaulay.h
22 #ifndef MACAULAY_H
23 #define MACAULAY_H
24 
25 #include "../polynomials/function.h"
26 
28 
29 class Macaulay : public Function
30  {
31  protected:
32  int n;
33  double a;
34  double coef;
35  public:
36  Macaulay(void): Function()
37  { n= 0; a= 0.0; coef= 1.0;}
38  Macaulay(const NmbVars &vars, const int n= 0, const double a= 0.0): Function(vars)
39  { this->n= n; this->a= a; coef= 1; }
40  Macaulay(const char *vars, const int n= 0, const double a= 0.0): Function(vars)
41  { this->n= n; this->a= a; coef= 1; }
42  Macaulay(const Macaulay &otro): Function(otro)
43  { n= otro.n; a= otro.a; coef= otro.coef; }
44  Macaulay &operator=(const Macaulay &m)
45  {
46  Function::operator=(m);
47  n= m.n; a= m.a; coef= m.coef;
48  return *this;
49  }
50  int Grado(void) const
51  { return n; }
52  double GetA(void) const
53  { return a; }
54  double Eval(const double &x) const;
55  double operator()(const double &x) const
56  //Evalua el Macaulay en el punto x.
57  { return Eval(x); }
58  Macaulay &operator*=(const Macaulay &m);
59  friend Macaulay operator *(const Macaulay &m1,const Macaulay &m2);
60  friend bool operator ==(const Macaulay &p1,const Macaulay &p2);
61  friend std::ostream &operator <<(std::ostream &stream,const Macaulay &p);
62  Macaulay Primitiva(void) const;
63  Macaulay Diferencial(void) const;
64  double Integral(const double &a, const double &b) const;
65  double Derivada(const double &x) const;
66  friend double dot(const Macaulay &m1,const Macaulay &m2, const double &a, const double &b);
67  };
68 
69 #endif
70 
71 
72 
73 
74 
75 
76 
77 
Stores the names of the function variables.
Definition: NmbVars.h:36
Definition: function.h:30
Definition: Macaulay.h:29