GiNaC  1.6.2
pseries.h
Go to the documentation of this file.
00001 
00005 /*
00006  *  GiNaC Copyright (C) 1999-2011 Johannes Gutenberg University Mainz, Germany
00007  *
00008  *  This program is free software; you can redistribute it and/or modify
00009  *  it under the terms of the GNU General Public License as published by
00010  *  the Free Software Foundation; either version 2 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  This program is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  *  GNU General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU General Public License
00019  *  along with this program; if not, write to the Free Software
00020  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00021  */
00022 
00023 #ifndef GINAC_SERIES_H
00024 #define GINAC_SERIES_H
00025 
00026 #include "basic.h"
00027 #include "expairseq.h"
00028 
00029 namespace GiNaC {
00030 
00035 class pseries : public basic
00036 {
00037     GINAC_DECLARE_REGISTERED_CLASS(pseries, basic)
00038 
00039     // other constructors
00040 public:
00041     pseries(const ex &rel_, const epvector &ops_);
00042 
00043     // functions overriding virtual functions from base classes
00044 public:
00045     unsigned precedence() const {return 38;} // for clarity just below add::precedence
00046     size_t nops() const;
00047     ex op(size_t i) const;
00048     int degree(const ex &s) const;
00049     int ldegree(const ex &s) const;
00050     ex coeff(const ex &s, int n = 1) const;
00051     ex collect(const ex &s, bool distributed = false) const;
00052     ex eval(int level=0) const;
00053     ex evalf(int level=0) const;
00054     ex series(const relational & r, int order, unsigned options = 0) const;
00055     ex subs(const exmap & m, unsigned options = 0) const;
00056     ex normal(exmap & repl, exmap & rev_lookup, int level = 0) const;
00057     ex expand(unsigned options = 0) const;
00058     ex conjugate() const;
00059     ex real_part() const;
00060     ex imag_part() const;
00061     ex eval_integ() const;
00062     ex evalm() const;
00064     void archive(archive_node& n) const;
00066     void read_archive(const archive_node& n, lst& syms);
00067 protected:
00068     ex derivative(const symbol & s) const;
00069 
00070     // non-virtual functions in this class
00071 public:
00073     ex get_var() const {return var;}
00074 
00076     ex get_point() const {return point;}
00077 
00081     ex convert_to_poly(bool no_order = false) const;
00082 
00085     bool is_compatible_to(const pseries &other) const {return var.is_equal(other.var) && point.is_equal(other.point);}
00086 
00088     bool is_zero() const {return seq.size() == 0;}
00089 
00092     bool is_terminating() const;
00093 
00095     ex coeffop(size_t i) const;
00096     ex exponop(size_t i) const;
00097 
00098     ex add_series(const pseries &other) const;
00099     ex mul_const(const numeric &other) const;
00100     ex mul_series(const pseries &other) const;
00101     ex power_const(const numeric &p, int deg) const;
00102     pseries shift_exponents(int deg) const;
00103 
00104 protected:
00105     void print_series(const print_context & c, const char *openbrace, const char *closebrace, const char *mul_sym, const char *pow_sym, unsigned level) const;
00106     void do_print(const print_context & c, unsigned level) const;
00107     void do_print_latex(const print_latex & c, unsigned level) const;
00108     void do_print_tree(const print_tree & c, unsigned level) const;
00109     void do_print_python(const print_python & c, unsigned level) const;
00110     void do_print_python_repr(const print_python_repr & c, unsigned level) const;
00111 
00112 protected:
00114     epvector seq;
00115 
00117     ex var;
00118 
00120     ex point;
00121 };
00122 GINAC_DECLARE_UNARCHIVER(pseries); 
00123 
00124 
00125 // utility functions
00126 
00135 inline ex series_to_poly(const ex &e)
00136 {
00137     return (ex_to<pseries>(e).convert_to_poly(true));
00138 }
00139 
00140 inline bool is_terminating(const pseries & s)
00141 {
00142     return s.is_terminating();
00143 }
00144 
00145 } // namespace GiNaC
00146 
00147 #endif // ndef GINAC_SERIES_H

This page is part of the GiNaC developer's reference. It was generated automatically by doxygen. For an introduction, see the tutorial.