]> www.ginac.de Git - ginac.git/blob - ginac/mul.h
* Deleted bogus try -- catch block in the ex::series() [Sheplyakov].
[ginac.git] / ginac / mul.h
1 /** @file mul.h
2  *
3  *  Interface to GiNaC's products of expressions. */
4
5 /*
6  *  GiNaC Copyright (C) 1999-2007 Johannes Gutenberg University Mainz, Germany
7  *
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.
12  *
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.
17  *
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
21  */
22
23 #ifndef __GINAC_MUL_H__
24 #define __GINAC_MUL_H__
25
26 #include "expairseq.h"
27
28 namespace GiNaC {
29
30 /** Product of expressions. */
31 class mul : public expairseq
32 {
33         GINAC_DECLARE_REGISTERED_CLASS(mul, expairseq)
34         
35         friend class add;
36         friend class ncmul;
37         friend class power;
38         
39         // other constructors
40 public:
41         mul(const ex & lh, const ex & rh);
42         mul(const exvector & v);
43         mul(const epvector & v);
44         mul(const epvector & v, const ex & oc, bool do_index_renaming = false);
45         mul(std::auto_ptr<epvector> vp, const ex & oc, bool do_index_renaming = false);
46         mul(const ex & lh, const ex & mh, const ex & rh);
47         
48         // functions overriding virtual functions from base classes
49 public:
50         unsigned precedence() const {return 50;}
51         bool info(unsigned inf) const;
52         int degree(const ex & s) const;
53         int ldegree(const ex & s) const;
54         ex coeff(const ex & s, int n = 1) const;
55         bool has(const ex & other, unsigned options = 0) const;
56         ex eval(int level=0) const;
57         ex evalf(int level=0) const;
58         ex real_part() const;
59         ex imag_part() const;
60         ex evalm() const;
61         ex series(const relational & s, int order, unsigned options = 0) const;
62         ex normal(exmap & repl, exmap & rev_lookup, int level = 0) const;
63         numeric integer_content() const;
64         ex smod(const numeric &xi) const;
65         numeric max_coefficient() const;
66         exvector get_free_indices() const;
67 protected:
68         ex derivative(const symbol & s) const;
69         ex eval_ncmul(const exvector & v) const;
70         unsigned return_type() const;
71         tinfo_t return_type_tinfo() const;
72         ex thisexpairseq(const epvector & v, const ex & oc, bool do_index_renaming = false) const;
73         ex thisexpairseq(std::auto_ptr<epvector> vp, const ex & oc, bool do_index_renaming = false) const;
74         expair split_ex_to_pair(const ex & e) const;
75         expair combine_ex_with_coeff_to_pair(const ex & e, const ex & c) const;
76         expair combine_pair_with_coeff_to_pair(const expair & p, const ex & c) const;
77         ex recombine_pair_to_ex(const expair & p) const;
78         bool expair_needs_further_processing(epp it);
79         ex default_overall_coeff() const;
80         void combine_overall_coeff(const ex & c);
81         void combine_overall_coeff(const ex & c1, const ex & c2);
82         bool can_make_flat(const expair & p) const;
83         ex expand(unsigned options=0) const;
84         void find_real_imag(ex&, ex&) const;
85         
86         // new virtual functions which can be overridden by derived classes
87         // none
88         
89         // non-virtual functions in this class
90 public:
91         ex algebraic_subs_mul(const exmap & m, unsigned options) const;
92 protected:
93         void print_overall_coeff(const print_context & c, const char *mul_sym) const;
94         void do_print(const print_context & c, unsigned level) const;
95         void do_print_latex(const print_latex & c, unsigned level) const;
96         void do_print_csrc(const print_csrc & c, unsigned level) const;
97         void do_print_python_repr(const print_python_repr & c, unsigned level) const;
98         static bool can_be_further_expanded(const ex & e);
99         std::auto_ptr<epvector> expandchildren(unsigned options) const;
100 };
101
102 } // namespace GiNaC
103
104 #endif // ndef __GINAC_MUL_H__