xc
num_integration.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 //num_integration.h
22 //Numerical integration routines.
23 
24 #ifndef NUM_INTEGRATION_H
25 #define NUM_INTEGRATION_H
26 
27 #include "ExprAlgebra.h"
28 #include <string>
29 #include <vector>
30 
33  {
34  std::string nmb_var;
35  int n;
36  ExprAlgebra x0;
37  ExprAlgebra x1;
38  public:
39  Intervalo1D(const std::string &palabra,const ExprAlgebra &a= ExprAlgebra(0.0),const ExprAlgebra &b=ExprAlgebra(1.0),const unsigned int &N=10)
40  : nmb_var(palabra), n(N),x0(a),x1(b) {}
41  const std::string &NmbVar(void) const
42  { return nmb_var; }
43  const int &N(void) const
44  { return n; }
45  const ExprAlgebra &LimInf(void) const
46  { return x0; }
47  const ExprAlgebra &LimSup(void) const
48  { return x1; }
49  };
50 
51 ExprAlgebra integ_trapecio(const ExprAlgebra &f,const Intervalo1D &i);
52 ExprAlgebra integ_simpson(const ExprAlgebra &f,const Intervalo1D &i);
53 std::vector<ExprAlgebra> integ_simpson(const ExprAlgebra &f,const std::string &nmb_var,const std::vector<ExprAlgebra> &intervalos,const int &n= 10);
54 
55 
56 #endif
57 
Integration interval in one dimension.
Definition: num_integration.h:32
Expresión algebraica.
Definition: ExprAlgebra.h:32