GiNaC 1.8.7
Go to the documentation of this file.
6 * GiNaC Copyright (C) 1999-2023 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
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 */
23#ifndef GINAC_SERIES_H
24#define GINAC_SERIES_H
26#include "basic.h"
27#include "expairseq.h"
29namespace GiNaC {
35class pseries : public basic
39 // other constructors
41 pseries(const ex &rel_, const epvector &ops_);
42 pseries(const ex &rel_, epvector &&ops_);
44 // functions overriding virtual functions from base classes
46 unsigned precedence() const override {return 38;} // for clarity just below add::precedence
47 size_t nops() const override;
48 ex op(size_t i) const override;
49 int degree(const ex &s) const override;
50 int ldegree(const ex &s) const override;
51 ex coeff(const ex &s, int n = 1) const override;
52 ex collect(const ex &s, bool distributed = false) const override;
53 ex eval() const override;
54 ex evalf() const override;
55 ex series(const relational & r, int order, unsigned options = 0) const override;
56 ex subs(const exmap & m, unsigned options = 0) const override;
57 ex normal(exmap & repl, exmap & rev_lookup, lst & modifier) const override;
58 ex expand(unsigned options = 0) const override;
59 ex conjugate() const override;
60 ex real_part() const override;
61 ex imag_part() const override;
62 ex eval_integ() const override;
63 ex evalm() const override;
65 void archive(archive_node& n) const override;
67 void read_archive(const archive_node& n, lst& syms) override;
69 ex derivative(const symbol & s) const override;
71 // non-virtual functions in this class
74 ex get_var() const {return var;}
77 ex get_point() const {return point;}
82 ex convert_to_poly(bool no_order = false) const;
86 bool is_compatible_to(const pseries &other) const {return var.is_equal(other.var) && point.is_equal(other.point);}
89 bool is_zero() const {return seq.size() == 0;}
93 bool is_terminating() const;
96 ex coeffop(size_t i) const;
97 ex exponop(size_t i) const;
99 ex add_series(const pseries &other) const;
100 ex mul_const(const numeric &other) const;
101 ex mul_series(const pseries &other) const;
102 ex power_const(const numeric &p, int deg) const;
103 pseries shift_exponents(int deg) const;
106 void print_series(const print_context & c, const char *openbrace, const char *closebrace, const char *mul_sym, const char *pow_sym, unsigned level) const;
107 void do_print(const print_context & c, unsigned level) const;
108 void do_print_latex(const print_latex & c, unsigned level) const;
109 void do_print_tree(const print_tree & c, unsigned level) const;
110 void do_print_python(const print_python & c, unsigned level) const;
111 void do_print_python_repr(const print_python_repr & c, unsigned level) const;
126// utility functions
136inline ex series_to_poly(const ex &e)
138 return (ex_to<pseries>(e).convert_to_poly(true));
141inline bool is_terminating(const pseries & s)
143 return s.is_terminating();
146} // namespace GiNaC
148#endif // ndef GINAC_SERIES_H
Interface to GiNaC's ABC.
This class stores all properties needed to record/retrieve the state of one object of class basic (or...
Definition: archive.h:49
This class is the ABC (abstract base class) of GiNaC's class hierarchy.
Definition: basic.h:105
Wrapper template for making GiNaC classes out of STL containers.
Definition: container.h:73
Lightweight wrapper for GiNaC's symbolic objects.
Definition: ex.h:72
bool is_equal(const ex &other) const
Definition: ex.h:345
This class is a wrapper around CLN-numbers within the GiNaC class hierarchy.
Definition: numeric.h:82
Base class for print_contexts.
Definition: print.h:103
Context for latex-parsable output.
Definition: print.h:123
Context for python-parsable output.
Definition: print.h:139
Context for python pretty-print output.
Definition: print.h:131
Context for tree-like output for debugging.
Definition: print.h:147
This class holds a extended truncated power series (positive and negative integer powers).
Definition: pseries.h:36
int ldegree(const ex &s) const override
Return degree of lowest power of the series.
Definition: pseries.cpp:334
ex evalf() const override
Evaluate coefficients numerically.
Definition: pseries.cpp:400
ex var
Series variable (holds a symbol)
Definition: pseries.h:118
bool is_zero() const
Check whether series has the value zero.
Definition: pseries.h:89
pseries shift_exponents(int deg) const
Return a new pseries object with the powers shifted by deg.
Definition: pseries.cpp:1073
void do_print(const print_context &c, unsigned level) const
Definition: pseries.cpp:211
ex op(size_t i) const override
Return the ith term in the series when represented as a sum.
Definition: pseries.cpp:301
unsigned precedence() const override
Return relative operator precedence (for parenthezing output).
Definition: pseries.h:46
void do_print_latex(const print_latex &c, unsigned level) const
Definition: pseries.cpp:216
ex mul_const(const numeric &other) const
Multiply a pseries object with a numeric constant, producing a pseries object that represents the pro...
Definition: pseries.cpp:778
ex coeff(const ex &s, int n=1) const override
Return coefficient of degree n in power series if s is the expansion variable.
Definition: pseries.cpp:356
ex get_point() const
Get the expansion point.
Definition: pseries.h:77
void do_print_tree(const print_tree &c, unsigned level) const
Definition: pseries.cpp:226
ex convert_to_poly(bool no_order=false) const
Convert the pseries object to an ordinary polynomial.
Definition: pseries.cpp:572
size_t nops() const override
Return the number of operands including a possible order term.
Definition: pseries.cpp:295
void read_archive(const archive_node &n, lst &syms) override
Read (a.k.a.
Definition: pseries.cpp:118
ex subs(const exmap &m, unsigned options=0) const override
Substitute a set of objects by arbitrary expressions.
Definition: pseries.cpp:507
pseries(const ex &rel_, const epvector &ops_)
Construct pseries from a vector of coefficients and powers.
Definition: pseries.cpp:70
ex eval_integ() const override
Evaluate integrals, if result is known.
Definition: pseries.cpp:456
ex expand(unsigned options=0) const override
Implementation of ex::expand() for a power series.
Definition: pseries.cpp:526
ex derivative(const symbol &s) const override
Implementation of ex::diff() for a power series.
Definition: pseries.cpp:539
ex real_part() const override
Definition: pseries.cpp:426
ex evalm() const override
Evaluate sums, products and integer powers of matrices.
Definition: pseries.cpp:480
epvector seq
Vector of {coefficient, power} pairs.
Definition: pseries.h:115
ex point
Expansion point.
Definition: pseries.h:121
bool is_compatible_to(const pseries &other) const
Check whether series is compatible to another series (expansion variable and point are the same.
Definition: pseries.h:86
ex exponop(size_t i) const
Definition: pseries.cpp:597
ex coeffop(size_t i) const
Get coefficients and exponents.
Definition: pseries.cpp:590
void archive(archive_node &n) const override
Save (a.k.a.
Definition: pseries.cpp:136
void print_series(const print_context &c, const char *openbrace, const char *closebrace, const char *mul_sym, const char *pow_sym, unsigned level) const
Definition: pseries.cpp:152
ex series(const relational &r, int order, unsigned options=0) const override
Re-expansion of a pseries object.
Definition: pseries.cpp:1182
void do_print_python(const print_python &c, unsigned level) const
Definition: pseries.cpp:221
ex normal(exmap &repl, exmap &rev_lookup, lst &modifier) const override
Implementation of ex::normal() for pseries.
Definition: normal.cpp:2495
ex get_var() const
Get the expansion variable.
Definition: pseries.h:74
ex imag_part() const override
Definition: pseries.cpp:441
void do_print_python_repr(const print_python_repr &c, unsigned level) const
Definition: pseries.cpp:241
bool is_terminating() const
Returns true if there is no order term, i.e.
Definition: pseries.cpp:585
ex conjugate() const override
Definition: pseries.cpp:411
ex mul_series(const pseries &other) const
Multiply one pseries object to another, producing a pseries object that represents the product.
Definition: pseries.cpp:798
ex power_const(const numeric &p, int deg) const
Compute the p-th power of a series.
Definition: pseries.cpp:975
int degree(const ex &s) const override
Return degree of highest power of the series.
Definition: pseries.cpp:314
ex add_series(const pseries &other) const
Add one series object to another, producing a pseries object that represents the sum.
Definition: pseries.cpp:680
ex collect(const ex &s, bool distributed=false) const override
Does nothing.
Definition: pseries.cpp:388
ex eval() const override
Perform coefficient-wise automatic term rewriting rules in this class.
Definition: pseries.cpp:394
This class holds a relation consisting of two expressions and a logical relation between them.
Definition: relational.h:35
Basic CAS symbol.
Definition: symbol.h:39
Interface to sequences of expression pairs.
unsigned options
Definition: factor.cpp:2475
size_t n
Definition: factor.cpp:1432
size_t c
Definition: factor.cpp:757
size_t r
Definition: factor.cpp:757
exset syms
Definition: factor.cpp:2429
mvec m
Definition: factor.cpp:758
int order
Definition: add.cpp:38
std::map< ex, ex, ex_is_less > exmap
Definition: basic.h:50
std::vector< expair > epvector
Definition: expairseq.h:33
ex series_to_poly(const ex &e)
Convert the pseries object embedded in an expression to an ordinary polynomial in the expansion varia...
Definition: pseries.h:136
bool is_terminating(const pseries &s)
Definition: pseries.h:141
#define GINAC_DECLARE_REGISTERED_CLASS(classname, supername)
Macro for inclusion in the declaration of each registered class.
Definition: registrar.h:153

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