3 * Interface to class for extended truncated power series. */
10 #include "expairseq.h"
14 /** This class holds a extended truncated power series (positive and negative
15 * integer powers). It consists of expression coefficients (only non-zero
16 * coefficients are stored), an expansion variable and an expansion point.
17 * Other classes must provide members to convert into this type. */
18 class series : public basic
20 typedef basic inherited;
22 // default constructor, destructor, copy constructor, assignment operator and helpers
26 series(series const &other);
27 series const &operator=(series const &other);
29 void copy(series const &other);
30 void destroy(bool call_parent);
34 series(ex const &var_, ex const &point_, epvector const &ops_);
36 // functions overriding virtual functions from base classes
38 basic *duplicate() const;
39 void printraw(ostream &os) const;
40 void print(ostream &os, unsigned upper_precedence=0) const;
41 int degree(symbol const &s) const;
42 int ldegree(symbol const &s) const;
43 ex coeff(symbol const &s, int const n=1) const;
44 ex eval(int level=0) const;
45 ex evalf(int level=0) const;
46 ex diff(symbol const & s) const;
47 ex normal(lst &sym_lst, lst &repl_lst, int level=0) const;
49 // non-virtual functions in this class
51 ex convert_to_poly(bool no_order = false) const;
52 bool is_compatible_to(const series &other) const {return var.compare(other.var) == 0 && point.compare(other.point) == 0;}
53 bool is_zero(void) const {return seq.size() == 0;}
54 ex add_series(const series &other) const;
55 ex mul_const(const numeric &other) const;
56 ex mul_series(const series &other) const;
57 ex power_const(const numeric &p, int deg) const;
60 /** Vector of {coefficient, power} pairs */
63 /** Series variable (holds a symbol) */
66 /** Expansion point */
71 extern const series some_series;
72 extern type_info const & typeid_series;
74 #define ex_to_series(X) (static_cast<class series const &>(*(X).bp))
75 #define series_to_poly(X) (static_cast<series const &>(*(X).bp).convert_to_poly(true))