3 * Interface to GiNaC's sums of expressions. */
6 * GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany
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.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #ifndef __GINAC_ADD_H__
24 #define __GINAC_ADD_H__
26 #include <ginac/expairseq.h>
28 #ifndef NO_GINAC_NAMESPACE
30 #endif // ndef NO_GINAC_NAMESPACE
32 /** Sum of expressions. */
33 class add : public expairseq
41 // default constructor, destructor, copy constructor assignment operator and helpers
45 add(add const & other);
46 add const & operator=(add const & other);
48 void copy(add const & other);
49 void destroy(bool call_parent);
53 add(ex const & lh, ex const & rh);
54 add(exvector const & v);
55 add(epvector const & v);
56 //add(epvector const & v, bool do_not_canonicalize=0);
57 add(epvector const & v, ex const & oc);
58 add(epvector * vp, ex const & oc);
60 // functions overriding virtual functions from bases classes
62 basic * duplicate() const;
63 void print(ostream & os, unsigned upper_precedence=0) const;
64 void printraw(ostream & os) const;
65 void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
66 bool info(unsigned inf) const;
67 int degree(symbol const & s) const;
68 int ldegree(symbol const & s) const;
69 ex coeff(symbol const & s, int const n=1) const;
70 ex eval(int level=0) const;
71 ex diff(symbol const & s) const;
72 ex series(symbol const & s, ex const & point, int order) const;
73 ex normal(lst &sym_lst, lst &repl_lst, int level=0) const;
74 numeric integer_content(void) const;
75 ex smod(const numeric &xi) const;
76 numeric max_coefficient(void) const;
77 exvector get_indices(void) const;
78 ex simplify_ncmul(exvector const & v) const;
80 int compare_same_type(basic const & other) const;
81 bool is_equal_same_type(basic const & other) const;
82 unsigned return_type(void) const;
83 unsigned return_type_tinfo(void) const;
84 ex thisexpairseq(epvector const & v, ex const & oc) const;
85 ex thisexpairseq(epvector * vp, ex const & oc) const;
86 expair split_ex_to_pair(ex const & e) const;
87 expair combine_ex_with_coeff_to_pair(ex const & e,
89 expair combine_pair_with_coeff_to_pair(expair const & p,
91 ex recombine_pair_to_ex(expair const & p) const;
92 ex expand(unsigned options=0) const;
94 // new virtual functions which can be overridden by derived classes
97 // non-virtual functions in this class
103 static unsigned precedence;
108 extern const add some_add;
109 extern type_info const & typeid_add;
112 inline const add &ex_to_add(const ex &e)
114 return static_cast<const add &>(*e.bp);
117 #ifndef NO_GINAC_NAMESPACE
119 #endif // ndef NO_GINAC_NAMESPACE
121 #endif // ndef __GINAC_ADD_H__