|
GiNaC
1.6.2
|
00001 00005 /* 00006 * GiNaC Copyright (C) 1999-2011 Johannes Gutenberg University Mainz, Germany 00007 * 00008 * This program is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 00023 #ifndef GINAC_INTEGRAL_H 00024 #define GINAC_INTEGRAL_H 00025 00026 #include "basic.h" 00027 #include "ex.h" 00028 #include "archive.h" 00029 00030 namespace GiNaC { 00031 00033 class integral : public basic 00034 { 00035 GINAC_DECLARE_REGISTERED_CLASS(integral, basic) 00036 00037 // other constructors 00038 public: 00039 integral(const ex & x_, const ex & a_, const ex & b_, const ex & f_); 00040 00041 // functions overriding virtual functions from base classes 00042 public: 00043 unsigned precedence() const {return 45;} 00044 ex eval(int level=0) const; 00045 ex evalf(int level=0) const; 00046 int degree(const ex & s) const; 00047 int ldegree(const ex & s) const; 00048 ex eval_ncmul(const exvector & v) const; 00049 size_t nops() const; 00050 ex op(size_t i) const; 00051 ex & let_op(size_t i); 00052 ex expand(unsigned options = 0) const; 00053 exvector get_free_indices() const; 00054 unsigned return_type() const; 00055 return_type_t return_type_tinfo() const; 00056 ex conjugate() const; 00057 ex eval_integ() const; 00059 void archive(archive_node& n) const; 00061 void read_archive(const archive_node& n, lst& syms); 00062 protected: 00063 ex derivative(const symbol & s) const; 00064 ex series(const relational & r, int order, unsigned options = 0) const; 00065 00066 // new virtual functions which can be overridden by derived classes 00067 // none 00068 00069 // non-virtual functions in this class 00070 protected: 00071 void do_print(const print_context & c, unsigned level) const; 00072 void do_print_latex(const print_latex & c, unsigned level) const; 00073 public: 00074 static int max_integration_level; 00075 static ex relative_integration_error; 00076 private: 00077 ex x; 00078 ex a; 00079 ex b; 00080 ex f; 00081 }; 00082 GINAC_DECLARE_UNARCHIVER(integral); 00083 00084 // utility functions 00085 00086 GiNaC::ex adaptivesimpson( 00087 const GiNaC::ex &x, 00088 const GiNaC::ex &a, 00089 const GiNaC::ex &b, 00090 const GiNaC::ex &f, 00091 const GiNaC::ex &error = integral::relative_integration_error 00092 ); 00093 00094 } // namespace GiNaC 00095 00096 #endif // ndef GINAC_INTEGRAL_H