3 * Interface to GiNaC's sums of expressions.
5 * GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #ifndef __GINAC_ADD_H__
23 #define __GINAC_ADD_H__
25 #include <ginac/expairseq.h>
27 /** Sum of expressions. */
28 class add : public expairseq
36 // default constructor, destructor, copy constructor assignment operator and helpers
40 add(add const & other);
41 add const & operator=(add const & other);
43 void copy(add const & other);
44 void destroy(bool call_parent);
48 add(ex const & lh, ex const & rh);
49 add(exvector const & v);
50 add(epvector const & v);
51 //add(epvector const & v, bool do_not_canonicalize=0);
52 add(epvector const & v, ex const & oc);
53 add(epvector * vp, ex const & oc);
55 // functions overriding virtual functions from bases classes
57 basic * duplicate() const;
58 void printraw(ostream & os) const;
59 void print(ostream & os, unsigned upper_precedence=0) const;
60 void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
61 bool info(unsigned inf) const;
62 int degree(symbol const & s) const;
63 int ldegree(symbol const & s) const;
64 ex coeff(symbol const & s, int const n=1) const;
65 ex eval(int level=0) const;
66 ex diff(symbol const & s) const;
67 ex series(symbol const & s, ex const & point, int order) const;
68 ex normal(lst &sym_lst, lst &repl_lst, int level=0) const;
69 numeric integer_content(void) const;
70 ex smod(numeric const &xi) const;
71 numeric max_coefficient(void) const;
72 exvector get_indices(void) const;
73 ex simplify_ncmul(exvector const & v) const;
75 int compare_same_type(basic const & other) const;
76 bool is_equal_same_type(basic const & other) const;
77 unsigned return_type(void) const;
78 unsigned return_type_tinfo(void) const;
79 ex thisexpairseq(epvector const & v, ex const & oc) const;
80 ex thisexpairseq(epvector * vp, ex const & oc) const;
81 void printpair(ostream & os, expair const & p,
82 unsigned upper_precedence) const;
83 expair split_ex_to_pair(ex const & e) const;
84 expair combine_ex_with_coeff_to_pair(ex const & e,
86 expair combine_pair_with_coeff_to_pair(expair const & p,
88 ex recombine_pair_to_ex(expair const & p) const;
89 ex expand(unsigned options=0) const;
91 // new virtual functions which can be overridden by derived classes
94 // non-virtual functions in this class
100 static unsigned precedence;
105 extern const add some_add;
106 extern type_info const & typeid_add;
108 #define ex_to_add(X) static_cast<add const &>(*(X).bp)
110 #endif // ndef __GINAC_ADD_H__