3 * Interface to GiNaC's sums of expressions. */
6 * GiNaC Copyright (C) 1999-2018 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26 #include "expairseq.h"
30 /** Sum of expressions. */
31 class add : public expairseq
33 GINAC_DECLARE_REGISTERED_CLASS(add, expairseq)
40 add(const ex & lh, const ex & rh);
41 add(const exvector & v);
42 add(const epvector & v);
43 add(const epvector & v, const ex & oc);
45 add(epvector && v, const ex & oc);
47 // functions overriding virtual functions from base classes
49 unsigned precedence() const override {return 40;}
50 bool info(unsigned inf) const override;
51 bool is_polynomial(const ex & var) const override;
52 int degree(const ex & s) const override;
53 int ldegree(const ex & s) const override;
54 ex coeff(const ex & s, int n=1) const override;
55 ex eval() const override;
56 ex evalm() const override;
57 ex series(const relational & r, int order, unsigned options = 0) const override;
58 ex normal(exmap & repl, exmap & rev_lookup) const override;
59 numeric integer_content() const override;
60 ex smod(const numeric &xi) const override;
61 numeric max_coefficient() const override;
62 ex conjugate() const override;
63 ex real_part() const override;
64 ex imag_part() const override;
65 exvector get_free_indices() const override;
66 ex eval_ncmul(const exvector & v) const override;
68 ex derivative(const symbol & s) const override;
69 unsigned return_type() const override;
70 return_type_t return_type_tinfo() const override;
71 ex thisexpairseq(const epvector & v, const ex & oc, bool do_index_renaming = false) const override;
72 ex thisexpairseq(epvector && vp, const ex & oc, bool do_index_renaming = false) const override;
73 expair split_ex_to_pair(const ex & e) const override;
74 expair combine_ex_with_coeff_to_pair(const ex & e,
75 const ex & c) const override;
76 expair combine_pair_with_coeff_to_pair(const expair & p,
77 const ex & c) const override;
78 ex recombine_pair_to_ex(const expair & p) const override;
79 ex expand(unsigned options=0) const override;
81 // non-virtual functions in this class
83 void print_add(const print_context & c, const char *openbrace, const char *closebrace, const char *mul_sym, unsigned level) const;
84 void do_print(const print_context & c, unsigned level) const;
85 void do_print_latex(const print_latex & c, unsigned level) const;
86 void do_print_csrc(const print_csrc & c, unsigned level) const;
87 void do_print_python_repr(const print_python_repr & c, unsigned level) const;
89 GINAC_DECLARE_UNARCHIVER(add);
93 #endif // ndef GINAC_ADD_H