|
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_ADD_H 00024 #define GINAC_ADD_H 00025 00026 #include "expairseq.h" 00027 00028 namespace GiNaC { 00029 00031 class add : public expairseq 00032 { 00033 GINAC_DECLARE_REGISTERED_CLASS(add, expairseq) 00034 00035 friend class mul; 00036 friend class power; 00037 00038 // other constructors 00039 public: 00040 add(const ex & lh, const ex & rh); 00041 add(const exvector & v); 00042 add(const epvector & v); 00043 add(const epvector & v, const ex & oc); 00044 add(std::auto_ptr<epvector> vp, const ex & oc); 00045 00046 // functions overriding virtual functions from base classes 00047 public: 00048 unsigned precedence() const {return 40;} 00049 bool info(unsigned inf) const; 00050 bool is_polynomial(const ex & var) const; 00051 int degree(const ex & s) const; 00052 int ldegree(const ex & s) const; 00053 ex coeff(const ex & s, int n=1) const; 00054 ex eval(int level=0) const; 00055 ex evalm() const; 00056 ex series(const relational & r, int order, unsigned options = 0) const; 00057 ex normal(exmap & repl, exmap & rev_lookup, int level=0) const; 00058 numeric integer_content() const; 00059 ex smod(const numeric &xi) const; 00060 numeric max_coefficient() const; 00061 ex conjugate() const; 00062 ex real_part() const; 00063 ex imag_part() const; 00064 exvector get_free_indices() const; 00065 ex eval_ncmul(const exvector & v) const; 00066 protected: 00067 ex derivative(const symbol & s) const; 00068 unsigned return_type() const; 00069 return_type_t return_type_tinfo() const; 00070 ex thisexpairseq(const epvector & v, const ex & oc, bool do_index_renaming = false) const; 00071 ex thisexpairseq(std::auto_ptr<epvector> vp, const ex & oc, bool do_index_renaming = false) const; 00072 expair split_ex_to_pair(const ex & e) const; 00073 expair combine_ex_with_coeff_to_pair(const ex & e, 00074 const ex & c) const; 00075 expair combine_pair_with_coeff_to_pair(const expair & p, 00076 const ex & c) const; 00077 ex recombine_pair_to_ex(const expair & p) const; 00078 ex expand(unsigned options=0) const; 00079 00080 // non-virtual functions in this class 00081 protected: 00082 void print_add(const print_context & c, const char *openbrace, const char *closebrace, const char *mul_sym, unsigned level) const; 00083 void do_print(const print_context & c, unsigned level) const; 00084 void do_print_latex(const print_latex & c, unsigned level) const; 00085 void do_print_csrc(const print_csrc & c, unsigned level) const; 00086 void do_print_python_repr(const print_python_repr & c, unsigned level) const; 00087 }; 00088 GINAC_DECLARE_UNARCHIVER(add); 00089 00090 } // namespace GiNaC 00091 00092 #endif // ndef GINAC_ADD_H