X-Git-Url: https://ginac.de/ginac.git//ginac.git?a=blobdiff_plain;ds=sidebyside;f=ginac%2Fbasic.cpp;h=2dd853d9f76f09d05842406919cce0a90d97ba0f;hb=695f6ae955ec530cded8f21efd5569df39447f76;hp=3a2768418c5705aa0e7cb8078e88fc70834c7254;hpb=815b86159af5d3b013b720e14ab7348f462e2db6;p=ginac.git diff --git a/ginac/basic.cpp b/ginac/basic.cpp index 3a276841..2dd853d9 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 @@ -207,7 +207,7 @@ void basic::do_print_python_repr(const print_python_repr & c, unsigned level) co * @see basic::dbgprinttree */ void basic::dbgprint() const { - this->print(std::cerr); + this->print(print_dflt(std::cerr)); std::cerr << std::endl; } @@ -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;