|
GiNaC
1.6.2
|
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. | |
| unsigned | precedence () const |
| Return relative operator precedence (for parenthezing output). | |
| size_t | nops () const |
| Return the number of operands including a possible order term. | |
| ex | op (size_t i) const |
| Return the ith term in the series when represented as a sum. | |
| int | degree (const ex &s) const |
| Return degree of highest power of the series. | |
| int | ldegree (const ex &s) const |
| Return degree of lowest power of the series. | |
| ex | coeff (const ex &s, int n=1) const |
| Return coefficient of degree n in power series if s is the expansion variable. | |
| ex | collect (const ex &s, bool distributed=false) const |
| Does nothing. | |
| ex | eval (int level=0) const |
| Perform coefficient-wise automatic term rewriting rules in this class. | |
| ex | evalf (int level=0) const |
| Evaluate coefficients numerically. | |
| ex | series (const relational &r, int order, unsigned options=0) const |
| Re-expansion of a pseries object. | |
| ex | subs (const exmap &m, unsigned options=0) const |
| Substitute a set of objects by arbitrary expressions. | |
| ex | normal (exmap &repl, exmap &rev_lookup, int level=0) const |
| Implementation of ex::normal() for pseries. | |
| ex | expand (unsigned options=0) const |
| Implementation of ex::expand() for a power series. | |
| ex | conjugate () const |
| ex | real_part () const |
| ex | imag_part () const |
| ex | eval_integ () const |
| Evaluate integrals, if result is known. | |
| ex | evalm () const |
| Evaluate sums, products and integer powers of matrices. | |
| void | archive (archive_node &n) const |
| Save (a.k.a. | |
| void | read_archive (const archive_node &n, lst &syms) |
| Read (a.k.a. | |
| ex | get_var () const |
| Get the expansion variable. | |
| ex | get_point () const |
| Get the expansion point. | |
| ex | convert_to_poly (bool no_order=false) const |
| Convert the pseries object to an ordinary polynomial. | |
| bool | is_compatible_to (const pseries &other) const |
| Check whether series is compatible to another series (expansion variable and point are the same. | |
| bool | is_zero () const |
| Check whether series has the value zero. | |
| bool | is_terminating () const |
| Returns true if there is no order term, i.e. | |
| ex | coeffop (size_t i) const |
| Get coefficients and exponents. | |
| 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. | |
| ex | mul_const (const numeric &other) const |
| Multiply a pseries object with a numeric constant, producing a pseries object that represents the product. | |
| ex | mul_series (const pseries &other) const |
| Multiply one pseries object to another, producing a pseries object that represents the product. | |
| ex | power_const (const numeric &p, int deg) const |
| Compute the p-th power of a series. | |
| pseries | shift_exponents (int deg) const |
| Return a new pseries object with the powers shifted by deg. | |
Protected Member Functions | |
| ex | derivative (const symbol &s) const |
| Implementation of ex::diff() for a power series. | |
| 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 |
| Default output to stream. | |
| void | do_print_latex (const print_latex &c, unsigned level) const |
| void | do_print_tree (const print_tree &c, unsigned level) const |
| Tree output to stream. | |
| void | do_print_python (const print_python &c, unsigned level) const |
| void | do_print_python_repr (const print_python_repr &c, unsigned level) const |
| Python parsable output to stream. | |
Protected Attributes | |
| epvector | seq |
| Vector of {coefficient, power} pairs. | |
| ex | var |
| Series variable (holds a symbol) | |
| ex | point |
| Expansion point. | |
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 71 of file pseries.cpp.
References GINAC_ASSERT, GiNaC::ex::lhs(), point, GiNaC::ex::rhs(), and var.
Referenced by add_series(), conjugate(), derivative(), eval(), eval_integ(), evalf(), evalm(), expand(), imag_part(), mul_const(), mul_series(), normal(), power_const(), real_part(), series(), shift_exponents(), and subs().
| unsigned GiNaC::pseries::precedence | ( | ) | const [inline, virtual] |
Return relative operator precedence (for parenthezing output).
Reimplemented from GiNaC::basic.
Definition at line 45 of file pseries.h.
Referenced by print_series().
| size_t GiNaC::pseries::nops | ( | ) | const [virtual] |
Return the number of operands including a possible order term.
Reimplemented from GiNaC::basic.
Definition at line 265 of file pseries.cpp.
References seq.
Referenced by coeffop(), exponop(), and GiNaC::log_series().
| ex GiNaC::pseries::op | ( | size_t | i | ) | const [virtual] |
Return the ith term in the series when represented as a sum.
Reimplemented from GiNaC::basic.
Definition at line 271 of file pseries.cpp.
References coeff(), GiNaC::is_order_function(), point, seq, and var.
| int GiNaC::pseries::degree | ( | const ex & | s | ) | const [virtual] |
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 284 of file pseries.cpp.
References coeff(), GiNaC::numeric::degree(), GiNaC::ex::is_equal(), GiNaC::pow(), seq, and var.
Referenced by mul_series(), and series().
| int GiNaC::pseries::ldegree | ( | const ex & | s | ) | const [virtual] |
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 312 of file pseries.cpp.
References coeff(), GiNaC::ex::is_equal(), GiNaC::numeric::ldegree(), GiNaC::pow(), 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 342 of file pseries.cpp.
References GiNaC::_ex0, GiNaC::ex::coeff(), GiNaC::basic::compare(), convert_to_poly(), GINAC_ASSERT, GiNaC::ex::is_equal(), seq, and var.
Referenced by degree(), ldegree(), GiNaC::log_series(), mul_series(), op(), power_const(), and read_archive().
| ex GiNaC::pseries::eval | ( | int | level = 0 | ) | const [virtual] |
Perform coefficient-wise automatic term rewriting rules in this class.
Reimplemented from GiNaC::basic.
Definition at line 380 of file pseries.cpp.
References GiNaC::status_flags::dynallocated, GiNaC::status_flags::evaluated, GiNaC::basic::hold(), GiNaC::max_recursion_level, point, pseries(), seq, and var.
| ex GiNaC::pseries::evalf | ( | int | level = 0 | ) | const [virtual] |
Evaluate coefficients numerically.
Reimplemented from GiNaC::basic.
Definition at line 400 of file pseries.cpp.
References GiNaC::status_flags::dynallocated, GiNaC::status_flags::evaluated, GiNaC::max_recursion_level, point, pseries(), seq, and var.
| ex GiNaC::pseries::series | ( | const relational & | r, |
| int | order, | ||
| unsigned | options = 0 |
||
| ) | const [virtual] |
Re-expansion of a pseries object.
Reimplemented from GiNaC::basic.
Definition at line 1200 of file pseries.cpp.
References GiNaC::_ex1, convert_to_poly(), degree(), GINAC_ASSERT, GiNaC::ex::is_equal(), GiNaC::relational::lhs(), point, pseries(), GiNaC::relational::rhs(), seq, GiNaC::ex::series(), GiNaC::to_int(), and var.
Substitute a set of objects by arbitrary expressions.
The ex returned will already be evaluated.
Reimplemented from GiNaC::basic.
Definition at line 519 of file pseries.cpp.
References convert_to_poly(), GiNaC::status_flags::dynallocated, point, pseries(), seq, GiNaC::basic::setflag(), GiNaC::ex::subs(), and var.
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 2315 of file normal.cpp.
References GiNaC::_ex1, GiNaC::ex::coeff(), GiNaC::status_flags::dynallocated, GiNaC::ex::is_zero(), n, GiNaC::ex::normal(), point, pseries(), GiNaC::replace_with_symbol(), seq, and var.
| ex GiNaC::pseries::expand | ( | unsigned | options = 0 | ) | const [virtual] |
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 541 of file pseries.cpp.
References GiNaC::ex::coeff(), GiNaC::status_flags::dynallocated, GiNaC::ex::expand(), GiNaC::status_flags::expanded, GiNaC::ex::is_zero(), point, pseries(), seq, and var.
| ex GiNaC::pseries::conjugate | ( | ) | const [virtual] |
Reimplemented from GiNaC::basic.
Definition at line 419 of file pseries.cpp.
References GiNaC::are_ex_trivially_equal(), GiNaC::ex::conjugate(), GiNaC::conjugateepvector(), GiNaC::status_flags::dynallocated, GiNaC::ex::info(), point, pseries(), GiNaC::info_flags::real, seq, GiNaC::basic::setflag(), and var.
| ex GiNaC::pseries::real_part | ( | ) | const [virtual] |
Reimplemented from GiNaC::basic.
Definition at line 436 of file pseries.cpp.
References GiNaC::status_flags::dynallocated, GiNaC::ex::info(), point, pseries(), GiNaC::info_flags::real, GiNaC::ex::real_part(), seq, GiNaC::basic::setflag(), and var.
| ex GiNaC::pseries::imag_part | ( | ) | const [virtual] |
Reimplemented from GiNaC::basic.
Definition at line 451 of file pseries.cpp.
References GiNaC::status_flags::dynallocated, GiNaC::ex::info(), point, pseries(), GiNaC::info_flags::real, GiNaC::ex::real_part(), seq, GiNaC::basic::setflag(), and var.
| ex GiNaC::pseries::eval_integ | ( | ) | const [virtual] |
Evaluate integrals, if result is known.
Reimplemented from GiNaC::basic.
Definition at line 466 of file pseries.cpp.
References GiNaC::are_ex_trivially_equal(), GiNaC::ex::coeff(), GiNaC::status_flags::dynallocated, GiNaC::ex::eval_integ(), point, pseries(), seq, and var.
| ex GiNaC::pseries::evalm | ( | ) | const [virtual] |
Evaluate sums, products and integer powers of matrices.
Reimplemented from GiNaC::basic.
Definition at line 491 of file pseries.cpp.
References GiNaC::are_ex_trivially_equal(), GiNaC::ex::coeff(), GiNaC::status_flags::dynallocated, GiNaC::ex::evalm(), GiNaC::ex::is_zero(), point, pseries(), seq, and var.
| void GiNaC::pseries::archive | ( | archive_node & | n | ) | const [virtual] |
Save (a.k.a.
serialize) object into archive.
Reimplemented from GiNaC::basic.
Definition at line 104 of file pseries.cpp.
References GiNaC::archive_node::add_ex(), point, seq, and var.
| void GiNaC::pseries::read_archive | ( | const archive_node & | n, |
| lst & | syms | ||
| ) | [virtual] |
Read (a.k.a.
deserialize) object from archive.
Reimplemented from GiNaC::basic.
Definition at line 84 of file pseries.cpp.
References coeff(), GiNaC::archive_node::find_ex(), GiNaC::archive_node::find_ex_by_loc(), GiNaC::archive_node::find_first(), GiNaC::archive_node::find_last(), last, point, seq, and var.
Implementation of ex::diff() for a power series.
Reimplemented from GiNaC::basic.
Definition at line 557 of file pseries.cpp.
References c, GiNaC::ex::coeff(), GiNaC::is_order_function(), GiNaC::ex::is_zero(), point, pseries(), seq, and var.
| ex GiNaC::pseries::get_var | ( | ) | const [inline] |
| ex GiNaC::pseries::get_point | ( | ) | const [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 593 of file pseries.cpp.
References GiNaC::ex::coeff(), GiNaC::is_order_function(), point, seq, and var.
| bool GiNaC::pseries::is_compatible_to | ( | const pseries & | other | ) | const [inline] |
Check whether series is compatible to another series (expansion variable and point are the same.
Definition at line 85 of file pseries.h.
References GiNaC::ex::is_equal(), point, and var.
Referenced by add_series(), and mul_series().
| bool GiNaC::pseries::is_zero | ( | ) | const [inline] |
Check whether series has the value zero.
Definition at line 88 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 609 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 614 of file pseries.cpp.
| ex GiNaC::pseries::exponop | ( | size_t | i | ) | const |
Definition at line 621 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 704 of file pseries.cpp.
References GiNaC::_ex0, GiNaC::_ex1, is_compatible_to(), GiNaC::is_order_function(), GiNaC::ex::is_zero(), point, pseries(), seq, GiNaC::to_int(), 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 807 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 829 of file pseries.cpp.
References GiNaC::_ex0, GiNaC::_ex1, coeff(), degree(), GiNaC::status_flags::dynallocated, is_compatible_to(), GiNaC::is_order_function(), GiNaC::ex::is_zero(), ldegree(), point, pseries(), seq, GiNaC::basic::setflag(), and var.
Compute the p-th power of a series.
| p | power to compute |
| deg | truncation order of series calculation |
Definition at line 1000 of file pseries.cpp.
References GiNaC::_ex0, GiNaC::_ex1, c, coeff(), GiNaC::status_flags::dynallocated, GiNaC::is_integer(), GiNaC::numeric::is_negative(), GiNaC::is_order_function(), is_zero(), GiNaC::numeric::is_zero(), ldegree(), point, pseries(), GiNaC::numeric::real(), seq, GiNaC::to_int(), and var.
| pseries GiNaC::pseries::shift_exponents | ( | int | deg | ) | const |
| void GiNaC::pseries::print_series | ( | const print_context & | c, |
| const char * | openbrace, | ||
| const char * | closebrace, | ||
| const char * | mul_sym, | ||
| const char * | pow_sym, | ||
| unsigned | level | ||
| ) | const [protected] |
Definition at line 122 of file pseries.cpp.
References GiNaC::_ex1, GiNaC::ex::coeff(), GiNaC::is_order_function(), GiNaC::ex::is_zero(), GiNaC::info_flags::negative, GiNaC::info_flags::numeric, point, GiNaC::info_flags::positive, precedence(), GiNaC::ex::print(), GiNaC::basic::print(), GiNaC::print_context::s, seq, and var.
Referenced by do_print(), do_print_latex(), and do_print_python().
| void GiNaC::pseries::do_print | ( | const print_context & | c, |
| unsigned | level | ||
| ) | const [protected] |
Default output to stream.
Reimplemented from GiNaC::basic.
Definition at line 181 of file pseries.cpp.
References print_series().
| void GiNaC::pseries::do_print_latex | ( | const print_latex & | c, |
| unsigned | level | ||
| ) | const [protected] |
Definition at line 186 of file pseries.cpp.
References print_series().
| void GiNaC::pseries::do_print_tree | ( | const print_tree & | c, |
| unsigned | level | ||
| ) | const [protected] |
Tree output to stream.
Reimplemented from GiNaC::basic.
Definition at line 196 of file pseries.cpp.
References GiNaC::print_tree::delta_indent, GiNaC::basic::flags, GiNaC::basic::hashvalue, point, GiNaC::ex::print(), GiNaC::print_context::s, seq, and var.
| void GiNaC::pseries::do_print_python | ( | const print_python & | c, |
| unsigned | level | ||
| ) | const [protected] |
Definition at line 191 of file pseries.cpp.
References print_series().
| void GiNaC::pseries::do_print_python_repr | ( | const print_python_repr & | c, |
| unsigned | level | ||
| ) | const [protected] |
Python parsable output to stream.
Reimplemented from GiNaC::basic.
Definition at line 211 of file pseries.cpp.
References point, GiNaC::ex::print(), GiNaC::print_context::s, seq, and var.
epvector GiNaC::pseries::seq [protected] |
Vector of {coefficient, power} pairs.
Definition at line 114 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(), eval_integ(), evalf(), evalm(), expand(), exponop(), imag_part(), is_terminating(), is_zero(), ldegree(), mul_const(), mul_series(), nops(), normal(), op(), power_const(), print_series(), read_archive(), real_part(), series(), shift_exponents(), and subs().
ex GiNaC::pseries::var [protected] |
Series variable (holds a symbol)
Definition at line 117 of file pseries.h.
Referenced by add_series(), archive(), coeff(), conjugate(), convert_to_poly(), degree(), derivative(), do_print_python_repr(), do_print_tree(), eval(), 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().
ex GiNaC::pseries::point [protected] |
Expansion point.
Definition at line 120 of file pseries.h.
Referenced by add_series(), archive(), conjugate(), convert_to_poly(), derivative(), do_print_python_repr(), do_print_tree(), eval(), 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().