X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fbasic.cpp;h=9cb480f9f56ba06c9e4486316593da6ad570ebe7;hp=98ba54d244cf19d12b143c4ae19d0f8d3d27fd0e;hb=54c1eca199508d821795ca08506f6e7788ebee91;hpb=6faa1dc08e887e3d9e0a2d0b1be6ccd50fc19422 diff --git a/ginac/basic.cpp b/ginac/basic.cpp index 98ba54d2..9cb480f9 100644 --- a/ginac/basic.cpp +++ b/ginac/basic.cpp @@ -3,7 +3,7 @@ * Implementation of GiNaC's ABC. */ /* - * GiNaC Copyright (C) 1999-2004 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include @@ -482,6 +482,20 @@ ex basic::evalm() const return map(map_evalm); } +/** Function object to be applied by basic::eval_integ(). */ +struct eval_integ_map_function : public map_function { + ex operator()(const ex & e) { return eval_integ(e); } +} map_eval_integ; + +/** Evaluate integrals, if result is known. */ +ex basic::eval_integ() const +{ + if (nops() == 0) + return *this; + else + return map(map_eval_integ); +} + /** Perform automatic symbolic evaluations on indexed expression that * contains this object as the base expression. */ ex basic::eval_indexed(const basic & i) const @@ -603,9 +617,11 @@ ex basic::subs_one_level(const exmap & m, unsigned options) const exmap::const_iterator it; if (options & subs_options::no_pattern) { - it = m.find(*this); + ex thisex = *this; + it = m.find(thisex); if (it != m.end()) return it->second; + return thisex; } else { for (it = m.begin(); it != m.end(); ++it) { lst repl_lst;