GiNaC 1.8.7
|
This class holds a extended truncated power series (positive and negative integer powers). More...
#include <pseries.h>
Public Member Functions | |
pseries (const ex &rel_, const epvector &ops_) | |
Construct pseries from a vector of coefficients and powers. More... | |
pseries (const ex &rel_, epvector &&ops_) | |
unsigned | precedence () const override |
Return relative operator precedence (for parenthezing output). More... | |
size_t | nops () const override |
Return the number of operands including a possible order term. More... | |
ex | op (size_t i) const override |
Return the ith term in the series when represented as a sum. More... | |
int | degree (const ex &s) const override |
Return degree of highest power of the series. More... | |
int | ldegree (const ex &s) const override |
Return degree of lowest power of the series. More... | |
ex | coeff (const ex &s, int n=1) const override |
Return coefficient of degree n in power series if s is the expansion variable. More... | |
ex | collect (const ex &s, bool distributed=false) const override |
Does nothing. More... | |
ex | eval () const override |
Perform coefficient-wise automatic term rewriting rules in this class. More... | |
ex | evalf () const override |
Evaluate coefficients numerically. More... | |
ex | series (const relational &r, int order, unsigned options=0) const override |
Re-expansion of a pseries object. More... | |
ex | subs (const exmap &m, unsigned options=0) const override |
Substitute a set of objects by arbitrary expressions. More... | |
ex | normal (exmap &repl, exmap &rev_lookup, lst &modifier) const override |
Implementation of ex::normal() for pseries. More... | |
ex | expand (unsigned options=0) const override |
Implementation of ex::expand() for a power series. More... | |
ex | conjugate () const override |
ex | real_part () const override |
ex | imag_part () const override |
ex | eval_integ () const override |
Evaluate integrals, if result is known. More... | |
ex | evalm () const override |
Evaluate sums, products and integer powers of matrices. More... | |
void | archive (archive_node &n) const override |
Save (a.k.a. More... | |
void | read_archive (const archive_node &n, lst &syms) override |
Read (a.k.a. More... | |
ex | get_var () const |
Get the expansion variable. More... | |
ex | get_point () const |
Get the expansion point. More... | |
ex | convert_to_poly (bool no_order=false) const |
Convert the pseries object to an ordinary polynomial. More... | |
bool | is_compatible_to (const pseries &other) const |
Check whether series is compatible to another series (expansion variable and point are the same. More... | |
bool | is_zero () const |
Check whether series has the value zero. More... | |
bool | is_terminating () const |
Returns true if there is no order term, i.e. More... | |
ex | coeffop (size_t i) const |
Get coefficients and exponents. More... | |
ex | exponop (size_t i) const |
ex | add_series (const pseries &other) const |
Add one series object to another, producing a pseries object that represents the sum. More... | |
ex | mul_const (const numeric &other) const |
Multiply a pseries object with a numeric constant, producing a pseries object that represents the product. More... | |
ex | mul_series (const pseries &other) const |
Multiply one pseries object to another, producing a pseries object that represents the product. More... | |
ex | power_const (const numeric &p, int deg) const |
Compute the p-th power of a series. More... | |
pseries | shift_exponents (int deg) const |
Return a new pseries object with the powers shifted by deg. More... | |
Public Member Functions inherited from GiNaC::basic | |
virtual | ~basic () |
basic destructor, virtual because class ex will delete objects of derived classes via a basic*. More... | |
basic (const basic &other) | |
const basic & | operator= (const basic &other) |
basic assignment operator: the other object might be of a derived class. More... | |
virtual basic * | duplicate () const |
Create a clone of this object on the heap. More... | |
virtual ex | eval () const |
Perform automatic non-interruptive term rewriting rules. More... | |
virtual ex | evalf () const |
Evaluate object numerically. More... | |
virtual ex | evalm () const |
Evaluate sums, products and integer powers of matrices. More... | |
virtual ex | eval_integ () const |
Evaluate integrals, if result is known. More... | |
virtual ex | eval_indexed (const basic &i) const |
Perform automatic symbolic evaluations on indexed expression that contains this object as the base expression. More... | |
virtual void | print (const print_context &c, unsigned level=0) const |
Output to stream. More... | |
virtual void | dbgprint () const |
Little wrapper around print to be called within a debugger. More... | |
virtual void | dbgprinttree () const |
Little wrapper around printtree to be called within a debugger. More... | |
virtual unsigned | precedence () const |
Return relative operator precedence (for parenthezing output). More... | |
virtual bool | info (unsigned inf) const |
Information about the object. More... | |
virtual size_t | nops () const |
Number of operands/members. More... | |
virtual ex | op (size_t i) const |
Return operand/member at position i. More... | |
virtual ex | operator[] (const ex &index) const |
virtual ex | operator[] (size_t i) const |
virtual ex & | let_op (size_t i) |
Return modifiable operand/member at position i. More... | |
virtual ex & | operator[] (const ex &index) |
virtual ex & | operator[] (size_t i) |
virtual bool | has (const ex &other, unsigned options=0) const |
Test for occurrence of a pattern. More... | |
virtual bool | match (const ex &pattern, exmap &repls) const |
Check whether the expression matches a given pattern. More... | |
virtual ex | subs (const exmap &m, unsigned options=0) const |
Substitute a set of objects by arbitrary expressions. More... | |
virtual ex | map (map_function &f) const |
Construct new expression by applying the specified function to all sub-expressions (one level only, not recursively). More... | |
virtual void | accept (GiNaC::visitor &v) const |
virtual bool | is_polynomial (const ex &var) const |
Check whether this is a polynomial in the given variables. More... | |
virtual int | degree (const ex &s) const |
Return degree of highest power in object s. More... | |
virtual int | ldegree (const ex &s) const |
Return degree of lowest power in object s. More... | |
virtual ex | coeff (const ex &s, int n=1) const |
Return coefficient of degree n in object s. More... | |
virtual ex | expand (unsigned options=0) const |
Expand expression, i.e. More... | |
virtual ex | collect (const ex &s, bool distributed=false) const |
Sort expanded expression in terms of powers of some object(s). More... | |
virtual ex | series (const relational &r, int order, unsigned options=0) const |
Default implementation of ex::series(). More... | |
virtual ex | normal (exmap &repl, exmap &rev_lookup, lst &modifier) const |
Default implementation of ex::normal(). More... | |
virtual ex | to_rational (exmap &repl) const |
Default implementation of ex::to_rational(). More... | |
virtual ex | to_polynomial (exmap &repl) const |
virtual numeric | integer_content () const |
virtual ex | smod (const numeric &xi) const |
Apply symmetric modular homomorphism to an expanded multivariate polynomial. More... | |
virtual numeric | max_coefficient () const |
Implementation ex::max_coefficient(). More... | |
virtual exvector | get_free_indices () const |
Return a vector containing the free indices of an expression. More... | |
virtual ex | add_indexed (const ex &self, const ex &other) const |
Add two indexed expressions. More... | |
virtual ex | scalar_mul_indexed (const ex &self, const numeric &other) const |
Multiply an indexed expression with a scalar. More... | |
virtual bool | contract_with (exvector::iterator self, exvector::iterator other, exvector &v) const |
Try to contract two indexed expressions that appear in the same product. More... | |
virtual unsigned | return_type () const |
virtual return_type_t | return_type_tinfo () const |
virtual ex | conjugate () const |
virtual ex | real_part () const |
virtual ex | imag_part () const |
template<class T > | |
void | print_dispatch (const print_context &c, unsigned level) const |
Like print(), but dispatch to the specified class. More... | |
void | print_dispatch (const registered_class_info &ri, const print_context &c, unsigned level) const |
Like print(), but dispatch to the specified class. More... | |
virtual void | archive (archive_node &n) const |
Save (serialize) the object into archive node. More... | |
virtual void | read_archive (const archive_node &n, lst &syms) |
Load (deserialize) the object from an archive node. More... | |
ex | subs_one_level (const exmap &m, unsigned options) const |
Helper function for subs(). More... | |
ex | diff (const symbol &s, unsigned nth=1) const |
Default interface of nth derivative ex::diff(s, n). More... | |
int | compare (const basic &other) const |
Compare objects syntactically to establish canonical ordering. More... | |
bool | is_equal (const basic &other) const |
Test for syntactic equality. More... | |
const basic & | hold () const |
Stop further evaluation. More... | |
unsigned | gethash () const |
const basic & | setflag (unsigned f) const |
Set some status_flags. More... | |
const basic & | clearflag (unsigned f) const |
Clear some status_flags. More... | |
Public Member Functions inherited from GiNaC::refcounted | |
refcounted () noexcept | |
unsigned int | add_reference () noexcept |
unsigned int | remove_reference () noexcept |
unsigned int | get_refcount () const noexcept |
void | set_refcount (unsigned int r) noexcept |
Protected Member Functions | |
ex | derivative (const symbol &s) const override |
Implementation of ex::diff() for a power series. More... | |
void | print_series (const print_context &c, const char *openbrace, const char *closebrace, const char *mul_sym, const char *pow_sym, unsigned level) const |
void | do_print (const print_context &c, unsigned level) const |
void | do_print_latex (const print_latex &c, unsigned level) const |
void | do_print_tree (const print_tree &c, unsigned level) const |
void | do_print_python (const print_python &c, unsigned level) const |
void | do_print_python_repr (const print_python_repr &c, unsigned level) const |
Protected Member Functions inherited from GiNaC::basic | |
basic () | |
virtual ex | eval_ncmul (const exvector &v) const |
virtual bool | match_same_type (const basic &other) const |
Returns true if the attributes of two objects are similar enough for a match. More... | |
virtual ex | derivative (const symbol &s) const |
Default implementation of ex::diff(). More... | |
virtual int | compare_same_type (const basic &other) const |
Returns order relation between two objects of same type. More... | |
virtual bool | is_equal_same_type (const basic &other) const |
Returns true if two objects of same type are equal. More... | |
virtual unsigned | calchash () const |
Compute the hash value of an object and if it makes sense to store it in the objects status_flags, do so. More... | |
void | ensure_if_modifiable () const |
Ensure the object may be modified without hurting others, throws if this is not the case. More... | |
void | do_print (const print_context &c, unsigned level) const |
Default output to stream. More... | |
void | do_print_tree (const print_tree &c, unsigned level) const |
Tree output to stream. More... | |
void | do_print_python_repr (const print_python_repr &c, unsigned level) const |
Python parsable output to stream. More... | |
Protected Attributes | |
epvector | seq |
Vector of {coefficient, power} pairs. More... | |
ex | var |
Series variable (holds a symbol) More... | |
ex | point |
Expansion point. More... | |
Protected Attributes inherited from GiNaC::basic | |
unsigned | flags |
of type status_flags More... | |
unsigned | hashvalue |
hash value More... | |
This class holds a extended truncated power series (positive and negative integer powers).
It consists of expression coefficients (only non-zero coefficients are stored), an expansion variable and an expansion point. Other classes must provide members to convert into this type.
Construct pseries from a vector of coefficients and powers.
expair.rest holds the coefficient, expair.coeff holds the power. The powers must be integers (positive or negative) and in ascending order; the last coefficient can be Order(_ex1) to represent a truncated, non-terminating series.
rel_ | expansion variable and point (must hold a relational) |
ops_ | vector of {coefficient, power} pairs (coefficient must not be zero) |
Definition at line 70 of file pseries.cpp.
References GINAC_ASSERT, GiNaC::is_order_function(), GiNaC::ex::lhs(), point, GiNaC::ex::rhs(), seq, and var.
Referenced by add_series(), derivative(), mul_const(), mul_series(), normal(), power_const(), series(), and shift_exponents().
Definition at line 91 of file pseries.cpp.
References GINAC_ASSERT, GiNaC::is_order_function(), GiNaC::ex::lhs(), point, GiNaC::ex::rhs(), seq, and var.
|
inlineoverridevirtual |
Return relative operator precedence (for parenthezing output).
Reimplemented from GiNaC::basic.
Definition at line 46 of file pseries.h.
Referenced by print_series().
|
overridevirtual |
Return the number of operands including a possible order term.
Reimplemented from GiNaC::basic.
Definition at line 295 of file pseries.cpp.
References seq.
Referenced by coeffop(), exponop(), and GiNaC::log_series().
|
overridevirtual |
Return the ith term in the series when represented as a sum.
Reimplemented from GiNaC::basic.
Definition at line 301 of file pseries.cpp.
References coeff(), GiNaC::is_order_function(), point, GiNaC::pow(), seq, and var.
|
overridevirtual |
Return degree of highest power of the series.
This is usually the exponent of the Order term. If s is not the expansion variable of the series, the series is examined termwise.
Reimplemented from GiNaC::basic.
Definition at line 314 of file pseries.cpp.
References GiNaC::ex::is_equal(), seq, and var.
Referenced by mul_series(), power_const(), and series().
|
overridevirtual |
Return degree of lowest power of the series.
This is usually the exponent of the leading term. If s is not the expansion variable of the series, the series is examined termwise. If s is the expansion variable but the expansion point is not zero the series is not expanded to find the degree. I.e.: (1-x) + (1-x)^2 + Order((1-x)^3) has ldegree(x) 1, not 0.
Reimplemented from GiNaC::basic.
Definition at line 334 of file pseries.cpp.
References GiNaC::ex::is_equal(), seq, and var.
Referenced by GiNaC::log_series(), mul_series(), and power_const().
Return coefficient of degree n in power series if s is the expansion variable.
If the expansion point is nonzero, by definition the n=1 coefficient in s of a+b*(s-z)+c*(s-z)^2+Order((s-z)^3) is b (assuming the expansion took place in the s in the first place). If s is not the expansion variable, an attempt is made to convert the series to a polynomial and return the corresponding coefficient from there.
Reimplemented from GiNaC::basic.
Definition at line 356 of file pseries.cpp.
References GiNaC::_ex0, GiNaC::ex::coeff(), coeff(), convert_to_poly(), GINAC_ASSERT, GiNaC::ex::is_equal(), n, seq, and var.
Referenced by coeff(), GiNaC::log_series(), mul_series(), op(), power_const(), and read_archive().
|
overridevirtual |
Perform coefficient-wise automatic term rewriting rules in this class.
Reimplemented from GiNaC::basic.
Definition at line 394 of file pseries.cpp.
References GiNaC::basic::hold().
|
overridevirtual |
Evaluate coefficients numerically.
Reimplemented from GiNaC::basic.
Definition at line 400 of file pseries.cpp.
References GiNaC::status_flags::evaluated, point, seq, and var.
|
overridevirtual |
Re-expansion of a pseries object.
Reimplemented from GiNaC::basic.
Definition at line 1182 of file pseries.cpp.
References GiNaC::_ex1, convert_to_poly(), degree(), GINAC_ASSERT, GiNaC::ex::is_equal(), options, order, point, pseries(), r, seq, GiNaC::ex::series(), and var.
Substitute a set of objects by arbitrary expressions.
The ex returned will already be evaluated.
Reimplemented from GiNaC::basic.
Definition at line 507 of file pseries.cpp.
References convert_to_poly(), m, options, point, seq, GiNaC::ex::subs(), and var.
|
overridevirtual |
Implementation of ex::normal() for pseries.
It normalizes each coefficient and replaces the series by a temporary symbol.
Reimplemented from GiNaC::basic.
Definition at line 2495 of file normal.cpp.
References GiNaC::_ex1, GiNaC::ex::coeff(), GiNaC::ex::is_zero(), n, GiNaC::ex::normal(), point, pseries(), GiNaC::replace_with_symbol(), seq, and var.
|
overridevirtual |
Implementation of ex::expand() for a power series.
It expands all the terms individually and returns the resulting series as a new pseries.
Reimplemented from GiNaC::basic.
Definition at line 526 of file pseries.cpp.
References GiNaC::ex::coeff(), GiNaC::ex::expand(), GiNaC::status_flags::expanded, GiNaC::ex::is_zero(), options, point, seq, and var.
|
overridevirtual |
Reimplemented from GiNaC::basic.
Definition at line 411 of file pseries.cpp.
References GiNaC::are_ex_trivially_equal(), GiNaC::ex::conjugate(), GiNaC::conjugateepvector(), GiNaC::ex::info(), point, GiNaC::info_flags::real, seq, and var.
|
overridevirtual |
Reimplemented from GiNaC::basic.
Definition at line 426 of file pseries.cpp.
References GiNaC::ex::info(), point, GiNaC::info_flags::real, GiNaC::ex::real_part(), seq, and var.
|
overridevirtual |
Reimplemented from GiNaC::basic.
Definition at line 441 of file pseries.cpp.
References GiNaC::ex::info(), point, GiNaC::info_flags::real, GiNaC::ex::real_part(), seq, and var.
|
overridevirtual |
Evaluate integrals, if result is known.
Reimplemented from GiNaC::basic.
Definition at line 456 of file pseries.cpp.
References GiNaC::are_ex_trivially_equal(), GiNaC::ex::coeff(), GiNaC::ex::eval_integ(), point, seq, and var.
|
overridevirtual |
Evaluate sums, products and integer powers of matrices.
Reimplemented from GiNaC::basic.
Definition at line 480 of file pseries.cpp.
References GiNaC::are_ex_trivially_equal(), GiNaC::ex::coeff(), GiNaC::ex::evalm(), GiNaC::ex::is_zero(), point, seq, and var.
|
overridevirtual |
Save (a.k.a.
serialize) object into archive.
Reimplemented from GiNaC::basic.
Definition at line 136 of file pseries.cpp.
|
overridevirtual |
Read (a.k.a.
deserialize) object from archive.
Reimplemented from GiNaC::basic.
Definition at line 118 of file pseries.cpp.
Implementation of ex::diff() for a power series.
Reimplemented from GiNaC::basic.
Definition at line 539 of file pseries.cpp.
References c, GiNaC::is_order_function(), point, pseries(), seq, and var.
|
inline |
|
inline |
ex GiNaC::pseries::convert_to_poly | ( | bool | no_order = false | ) | const |
Convert the pseries object to an ordinary polynomial.
no_order | flag: discard higher order terms |
Definition at line 572 of file pseries.cpp.
References GiNaC::ex::coeff(), GiNaC::is_order_function(), point, GiNaC::pow(), seq, and var.
|
inline |
Check whether series is compatible to another series (expansion variable and point are the same.
Definition at line 86 of file pseries.h.
References GiNaC::ex::is_equal(), point, and var.
Referenced by add_series(), and mul_series().
|
inline |
Check whether series has the value zero.
Definition at line 89 of file pseries.h.
References seq.
Referenced by power_const().
bool GiNaC::pseries::is_terminating | ( | ) | const |
Returns true if there is no order term, i.e.
the series terminates and false otherwise.
Definition at line 585 of file pseries.cpp.
References GiNaC::is_order_function(), and seq.
Referenced by GiNaC::is_terminating(), and GiNaC::log_series().
ex GiNaC::pseries::coeffop | ( | size_t | i | ) | const |
Get coefficients and exponents.
Definition at line 590 of file pseries.cpp.
ex GiNaC::pseries::exponop | ( | size_t | i | ) | const |
Definition at line 597 of file pseries.cpp.
Add one series object to another, producing a pseries object that represents the sum.
other | pseries object to add with |
Definition at line 680 of file pseries.cpp.
References GiNaC::_ex0, GiNaC::_ex1, is_compatible_to(), GiNaC::is_order_function(), GiNaC::ex::is_zero(), point, pseries(), seq, and var.
Referenced by GiNaC::log_series().
Multiply a pseries object with a numeric constant, producing a pseries object that represents the product.
other | constant to multiply with |
Definition at line 778 of file pseries.cpp.
References GiNaC::numeric::coeff(), GiNaC::is_order_function(), point, pseries(), seq, and var.
Referenced by GiNaC::mul::series().
Multiply one pseries object to another, producing a pseries object that represents the product.
other | pseries object to multiply with |
Definition at line 798 of file pseries.cpp.
References GiNaC::_ex0, GiNaC::_ex1, coeff(), degree(), GiNaC::ex::find(), is_compatible_to(), GiNaC::ex::is_equal(), GiNaC::is_order_function(), GiNaC::ex::is_zero(), ldegree(), point, pseries(), seq, and var.
Referenced by GiNaC::mul::series().
Compute the p-th power of a series.
p | power to compute |
deg | truncation order of series calculation |
Definition at line 975 of file pseries.cpp.
References GiNaC::_ex0, GiNaC::_ex1, c, coeff(), degree(), GiNaC::is_integer(), GiNaC::numeric::is_negative(), GiNaC::is_order_function(), GiNaC::numeric::is_pos_integer(), GiNaC::numeric::is_zero(), is_zero(), ldegree(), point, GiNaC::pow(), pseries(), GiNaC::numeric::real(), seq, GiNaC::to_int(), and var.
pseries GiNaC::pseries::shift_exponents | ( | int | deg | ) | const |
|
protected |
Definition at line 152 of file pseries.cpp.
References GiNaC::_ex1, c, GiNaC::ex::coeff(), GiNaC::is_order_function(), GiNaC::ex::is_zero(), GiNaC::info_flags::negative, GiNaC::info_flags::numeric, point, GiNaC::info_flags::positive, GiNaC::pow(), precedence(), GiNaC::basic::print(), GiNaC::ex::print(), seq, and var.
Referenced by do_print(), do_print_latex(), and do_print_python().
|
protected |
Definition at line 211 of file pseries.cpp.
References c, and print_series().
|
protected |
Definition at line 216 of file pseries.cpp.
References c, and print_series().
|
protected |
Definition at line 226 of file pseries.cpp.
References c, GiNaC::basic::flags, GiNaC::basic::hashvalue, point, GiNaC::ex::print(), seq, and var.
|
protected |
Definition at line 221 of file pseries.cpp.
References c, and print_series().
|
protected |
Definition at line 241 of file pseries.cpp.
References c, point, GiNaC::ex::print(), seq, and var.
|
protected |
Vector of {coefficient, power} pairs.
Definition at line 115 of file pseries.h.
Referenced by add_series(), archive(), coeff(), coeffop(), conjugate(), convert_to_poly(), degree(), derivative(), do_print_python_repr(), do_print_tree(), eval_integ(), evalf(), evalm(), expand(), exponop(), imag_part(), is_terminating(), is_zero(), ldegree(), mul_const(), mul_series(), nops(), normal(), op(), power_const(), print_series(), pseries(), read_archive(), real_part(), series(), shift_exponents(), and subs().
|
protected |
Series variable (holds a symbol)
Definition at line 118 of file pseries.h.
Referenced by add_series(), archive(), coeff(), conjugate(), convert_to_poly(), degree(), derivative(), do_print_python_repr(), do_print_tree(), eval_integ(), evalf(), evalm(), expand(), get_var(), imag_part(), is_compatible_to(), ldegree(), mul_const(), mul_series(), normal(), op(), power_const(), print_series(), pseries(), read_archive(), real_part(), series(), shift_exponents(), and subs().
|
protected |
Expansion point.
Definition at line 121 of file pseries.h.
Referenced by add_series(), archive(), conjugate(), convert_to_poly(), derivative(), do_print_python_repr(), do_print_tree(), eval_integ(), evalf(), evalm(), expand(), get_point(), imag_part(), is_compatible_to(), mul_const(), mul_series(), normal(), op(), power_const(), print_series(), pseries(), read_archive(), real_part(), series(), shift_exponents(), and subs().