]> www.ginac.de Git - ginac.git/blob - ginac/integral.h
Added code for distinct degree factorization.
[ginac.git] / ginac / integral.h
1 /** @file integral.h
2  *
3  *  Interface to GiNaC's symbolic  integral. */
4
5 /*
6  *  GiNaC Copyright (C) 1999-2008 Johannes Gutenberg University Mainz, Germany
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21  */
22
23 #ifndef __GINAC_INTEGRAL_H__
24 #define __GINAC_INTEGRAL_H__
25
26 #include "basic.h"
27 #include "ex.h"
28 #include "archive.h"
29
30 namespace GiNaC {
31
32 /** Symbolic integral. */
33 class integral : public basic
34 {
35         GINAC_DECLARE_REGISTERED_CLASS(integral, basic)
36         
37         // other constructors
38 public:
39         integral(const ex & x_, const ex & a_, const ex & b_, const ex & f_);
40         
41         // functions overriding virtual functions from base classes
42 public:
43         unsigned precedence() const {return 45;}
44         ex eval(int level=0) const;
45         ex evalf(int level=0) const;
46         int degree(const ex & s) const;
47         int ldegree(const ex & s) const;
48         ex eval_ncmul(const exvector & v) const;
49         size_t nops() const;
50         ex op(size_t i) const;
51         ex & let_op(size_t i);
52         ex expand(unsigned options = 0) const;
53         exvector get_free_indices() const;
54         unsigned return_type() const;
55         return_type_t return_type_tinfo() const;
56         ex conjugate() const;
57         ex eval_integ() const;
58         /** Save (a.k.a. serialize) object into archive. */
59         void archive(archive_node& n) const;
60         /** Read (a.k.a. deserialize) object from archive. */
61         void read_archive(const archive_node& n, lst& syms);
62 protected:
63         ex derivative(const symbol & s) const;
64         ex series(const relational & r, int order, unsigned options = 0) const;
65
66         // new virtual functions which can be overridden by derived classes
67         // none
68         
69         // non-virtual functions in this class
70 protected:
71         void do_print(const print_context & c, unsigned level) const;
72         void do_print_latex(const print_latex & c, unsigned level) const;
73 public:
74         static int max_integration_level;
75         static ex relative_integration_error;
76 private:
77         ex x;
78         ex a;
79         ex b;
80         ex f;
81 };
82 GINAC_DECLARE_UNARCHIVER(integral); 
83
84 // utility functions
85
86 GiNaC::ex adaptivesimpson(
87         const GiNaC::ex &x,
88         const GiNaC::ex &a,
89         const GiNaC::ex &b,
90         const GiNaC::ex &f,
91         const GiNaC::ex &error = integral::relative_integration_error
92 );
93
94 } // namespace GiNaC
95
96 #endif // ndef __GINAC_INTEGRAL_H__