|
GiNaC
1.6.2
|
This class holds a two-component object, a basis and and exponent representing exponentiation. More...
#include <power.h>
Public Member Functions | |
| power (const ex &lh, const ex &rh) | |
| template<typename T > | |
| power (const ex &lh, const T &rh) | |
| unsigned | precedence () const |
| Return relative operator precedence (for parenthezing output). | |
| bool | info (unsigned inf) const |
| Information about the object. | |
| size_t | nops () const |
| Number of operands/members. | |
| ex | op (size_t i) const |
| Return operand/member at position i. | |
| ex | map (map_function &f) const |
| Construct new expression by applying the specified function to all sub-expressions (one level only, not recursively). | |
| bool | is_polynomial (const ex &var) const |
| Check whether this is a polynomial in the given variables. | |
| int | degree (const ex &s) const |
| Return degree of highest power in object s. | |
| int | ldegree (const ex &s) const |
| Return degree of lowest power in object s. | |
| ex | coeff (const ex &s, int n=1) const |
| Return coefficient of degree n in object s. | |
| ex | eval (int level=0) const |
| Perform automatic term rewriting rules in this class. | |
| ex | evalf (int level=0) const |
| Evaluate object numerically. | |
| ex | evalm () const |
| Evaluate sums, products and integer powers of matrices. | |
| ex | series (const relational &s, int order, unsigned options=0) const |
| Implementation of ex::series() for powers. | |
| ex | subs (const exmap &m, unsigned options=0) const |
| Substitute a set of objects by arbitrary expressions. | |
| bool | has (const ex &other, unsigned options=0) const |
| Test for occurrence of a pattern. | |
| ex | normal (exmap &repl, exmap &rev_lookup, int level=0) const |
| Implementation of ex::normal([B) for powers. | |
| ex | to_rational (exmap &repl) const |
| Implementation of ex::to_rational() for powers. | |
| ex | to_polynomial (exmap &repl) const |
| Implementation of ex::to_polynomial() for powers. | |
| ex | conjugate () const |
| ex | real_part () const |
| ex | imag_part () const |
| void | archive (archive_node &n) const |
| Save (a.k.a. | |
| void | read_archive (const archive_node &n, lst &syms) |
| Read (a.k.a. | |
Protected Member Functions | |
| ex | derivative (const symbol &s) const |
| Implementation of ex::diff() for a power. | |
| ex | eval_ncmul (const exvector &v) const |
| unsigned | return_type () const |
| return_type_t | return_type_tinfo () const |
| ex | expand (unsigned options=0) const |
| Expand expression, i.e. | |
| void | print_power (const print_context &c, const char *powersymbol, const char *openbrace, const char *closebrace, unsigned level) const |
| void | do_print_dflt (const print_dflt &c, unsigned level) const |
| void | do_print_latex (const print_latex &c, unsigned level) const |
| void | do_print_csrc (const print_csrc &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 |
| Python parsable output to stream. | |
| void | do_print_csrc_cl_N (const print_csrc_cl_N &c, unsigned level) const |
| ex | expand_add (const add &a, int n, unsigned options) const |
| expand a^n where a is an add and n is a positive integer. | |
| ex | expand_add_2 (const add &a, unsigned options) const |
| Special case of power::expand_add. | |
| ex | expand_mul (const mul &m, const numeric &n, unsigned options, bool from_expand=false) const |
| Expand factors of m in m^n where m is a mul and n is an integer. | |
Protected Attributes | |
| ex | basis |
| ex | exponent |
Friends | |
| class | mul |
This class holds a two-component object, a basis and and exponent representing exponentiation.
Definition at line 48 of file power.h.
Referenced by conjugate(), derivative(), do_print_latex(), eval(), evalf(), evalm(), expand(), expand_add(), expand_add_2(), imag_part(), map(), normal(), real_part(), subs(), to_polynomial(), and to_rational().
| GiNaC::power::power | ( | const ex & | lh, |
| const T & | rh | ||
| ) | [inline] |
| unsigned GiNaC::power::precedence | ( | ) | const [inline, virtual] |
Return relative operator precedence (for parenthezing output).
Reimplemented from GiNaC::basic.
Definition at line 53 of file power.h.
Referenced by print_power().
| bool GiNaC::power::info | ( | unsigned | inf | ) | const [virtual] |
Information about the object.
Reimplemented from GiNaC::basic.
Definition at line 225 of file power.cpp.
References GiNaC::info_flags::algebraic, basis, GiNaC::info_flags::cinteger_polynomial, GiNaC::basic::clearflag(), GiNaC::info_flags::crational_polynomial, GiNaC::status_flags::expanded, GiNaC::info_flags::expanded, exponent, GiNaC::basic::flags, GiNaC::status_flags::has_indices, GiNaC::info_flags::has_indices, GiNaC::status_flags::has_no_indices, GiNaC::ex::info(), GiNaC::info_flags::integer, GiNaC::info_flags::integer_polynomial, GiNaC::info_flags::nonnegint, GiNaC::info_flags::polynomial, GiNaC::info_flags::positive, GiNaC::info_flags::rational_function, GiNaC::info_flags::rational_polynomial, GiNaC::info_flags::real, and GiNaC::basic::setflag().
| size_t GiNaC::power::nops | ( | ) | const [virtual] |
Number of operands/members.
Reimplemented from GiNaC::basic.
| ex GiNaC::power::op | ( | size_t | i | ) | const [virtual] |
Return operand/member at position i.
Reimplemented from GiNaC::basic.
Definition at line 269 of file power.cpp.
References basis, exponent, and GINAC_ASSERT.
| ex GiNaC::power::map | ( | map_function & | f | ) | const [virtual] |
Construct new expression by applying the specified function to all sub-expressions (one level only, not recursively).
Reimplemented from GiNaC::basic.
Definition at line 276 of file power.cpp.
References GiNaC::are_ex_trivially_equal(), basis, GiNaC::status_flags::dynallocated, exponent, and power().
| bool GiNaC::power::is_polynomial | ( | const ex & | var | ) | const [virtual] |
Check whether this is a polynomial in the given variables.
Reimplemented from GiNaC::basic.
Definition at line 288 of file power.cpp.
References basis, exponent, GiNaC::ex::has(), GiNaC::ex::info(), GiNaC::ex::is_polynomial(), and GiNaC::info_flags::nonnegint.
| int GiNaC::power::degree | ( | const ex & | s | ) | const [virtual] |
Return degree of highest power in object s.
Reimplemented from GiNaC::basic.
Definition at line 297 of file power.cpp.
References basis, GiNaC::ex::degree(), exponent, GiNaC::ex::has(), GiNaC::ex::is_equal(), GiNaC::basic::is_equal(), GiNaC::is_integer(), and GiNaC::to_int().
| int GiNaC::power::ldegree | ( | const ex & | s | ) | const [virtual] |
Return degree of lowest power in object s.
Reimplemented from GiNaC::basic.
Definition at line 312 of file power.cpp.
References basis, exponent, GiNaC::ex::has(), GiNaC::ex::is_equal(), GiNaC::basic::is_equal(), GiNaC::is_integer(), GiNaC::ex::ldegree(), and GiNaC::to_int().
Return coefficient of degree n in object s.
Reimplemented from GiNaC::basic.
Definition at line 327 of file power.cpp.
References GiNaC::_ex0, GiNaC::_ex1, basis, exponent, GiNaC::ex::is_equal(), GiNaC::basic::is_equal(), GiNaC::is_integer(), and GiNaC::to_int().
| ex GiNaC::power::eval | ( | int | level = 0 | ) | const [virtual] |
Perform automatic term rewriting rules in this class.
In the following x, x1, x2,... stand for a symbolic variables of type ex and c, c1, c2... stand for such expressions that contain a plain number.
| level | cut-off in recursive evaluation |
Reimplemented from GiNaC::basic.
Definition at line 371 of file power.cpp.
References GiNaC::_ex0, GiNaC::_ex1, GiNaC::_ex_1, GiNaC::_num0_p, GiNaC::_num1_p, GiNaC::_num_1_p, GiNaC::abs(), GiNaC::are_ex_trivially_equal(), basis, c, GiNaC::basic::clearflag(), GiNaC::return_types::commutative, GiNaC::numeric::compare(), GiNaC::numeric::denom(), GiNaC::numeric::div(), GiNaC::status_flags::dynallocated, GiNaC::ex::eval(), GiNaC::status_flags::evaluated, expand_mul(), GiNaC::status_flags::expanded, exponent, GiNaC::basic::flags, GINAC_ASSERT, GiNaC::status_flags::hash_calculated, GiNaC::basic::hold(), GiNaC::ex::info(), GiNaC::ex::integer_content(), GiNaC::numeric::inverse(), GiNaC::iquo(), GiNaC::numeric::is_crational(), GiNaC::numeric::is_equal(), GiNaC::ex::is_equal(), GiNaC::numeric::is_integer(), GiNaC::numeric::is_negative(), GiNaC::is_negative(), GiNaC::numeric::is_pos_integer(), GiNaC::numeric::is_positive(), GiNaC::numeric::is_rational(), GiNaC::numeric::is_real(), GiNaC::numeric::is_zero(), GiNaC::ex::is_zero(), GiNaC::is_zero(), likely, m, GiNaC::max_recursion_level, mul, GiNaC::numeric::mul(), n, GiNaC::numeric::numer(), GiNaC::ex::op(), GiNaC::expairseq::overall_coeff, GiNaC::info_flags::positive, power(), GiNaC::numeric::power(), r, GiNaC::numeric::real(), GiNaC::info_flags::real, GiNaC::ex::return_type(), GiNaC::basic::setflag(), and GiNaC::numeric::to_int().
| ex GiNaC::power::evalf | ( | int | level = 0 | ) | const [virtual] |
Evaluate object numerically.
Reimplemented from GiNaC::basic.
Definition at line 579 of file power.cpp.
References basis, GiNaC::ex::evalf(), exponent, GiNaC::max_recursion_level, and power().
| ex GiNaC::power::evalm | ( | ) | const [virtual] |
Evaluate sums, products and integer powers of matrices.
Reimplemented from GiNaC::basic.
Definition at line 600 of file power.cpp.
References basis, GiNaC::status_flags::dynallocated, GiNaC::ex::evalm(), exponent, GiNaC::pow(), and power().
| ex GiNaC::power::series | ( | const relational & | r, |
| int | order, | ||
| unsigned | options = 0 |
||
| ) | const [virtual] |
Implementation of ex::series() for powers.
This performs Laurent expansion of reciprocals of series at singularities.
Reimplemented from GiNaC::basic.
Definition at line 1103 of file pseries.cpp.
References GiNaC::_ex1, basis, GiNaC::exp(), GiNaC::ex::expand(), exponent, GiNaC::ex::info(), GiNaC::ex::is_equal(), GiNaC::is_integer(), GiNaC::ex::is_zero(), GiNaC::ex::ldegree(), GiNaC::relational::lhs(), GiNaC::log(), GiNaC::info_flags::negint, GiNaC::subs_options::no_pattern, GiNaC::info_flags::rational_function, GiNaC::relational::rhs(), GiNaC::ex::series(), GiNaC::basic::series(), GiNaC::ex::subs(), and GiNaC::to_int().
Substitute a set of objects by arbitrary expressions.
The ex returned will already be evaluated.
Reimplemented from GiNaC::basic.
Definition at line 639 of file power.cpp.
References GiNaC::subs_options::algebraic, GiNaC::are_ex_trivially_equal(), basis, exponent, GiNaC::subs_options::no_pattern, power(), GiNaC::ex::subs(), GiNaC::basic::subs_one_level(), and GiNaC::tryfactsubs().
| bool GiNaC::power::has | ( | const ex & | pattern, |
| unsigned | options = 0 |
||
| ) | const [virtual] |
Test for occurrence of a pattern.
An object 'has' a pattern if it matches the pattern itself or one of the children 'has' it. As a consequence (according to the definition of children) given e=x+y+z, e.has(x) is true but e.has(x+y) is false.
Reimplemented from GiNaC::basic.
Definition at line 612 of file power.cpp.
References GiNaC::has_options::algebraic, basis, exponent, GiNaC::basic::has(), GiNaC::ex::info(), GiNaC::info_flags::integer, GiNaC::ex::match(), GiNaC::info_flags::negint, GiNaC::ex::op(), GiNaC::info_flags::posint, and GiNaC::to_int().
Implementation of ex::normal([B) for powers.
It normalizes the basis, distributes integer exponents to numerator and denominator, and replaces non-integer powers by temporary symbols.
Reimplemented from GiNaC::basic.
Definition at line 2260 of file normal.cpp.
References GiNaC::_ex1, basis, GiNaC::status_flags::dynallocated, exponent, GiNaC::ex::info(), GiNaC::info_flags::integer, GiNaC::ex::is_equal(), GiNaC::max_recursion_level, GiNaC::info_flags::negative, GiNaC::ex::op(), GiNaC::info_flags::positive, power(), GiNaC::replace_with_symbol(), and GiNaC::basic::setflag().
Implementation of ex::to_rational() for powers.
It replaces non-integer powers by temporary symbols.
Reimplemented from GiNaC::basic.
Definition at line 2544 of file normal.cpp.
References basis, exponent, GiNaC::ex::info(), GiNaC::info_flags::integer, power(), GiNaC::replace_with_symbol(), and GiNaC::ex::to_rational().
Implementation of ex::to_polynomial() for powers.
It replaces non-posint powers by temporary symbols.
Reimplemented from GiNaC::basic.
Definition at line 2554 of file normal.cpp.
References GiNaC::_ex_1, basis, GiNaC::collect_common_factors(), exponent, GiNaC::ex::info(), GiNaC::info_flags::negint, GiNaC::info_flags::posint, power(), GiNaC::replace_with_symbol(), GiNaC::ex::to_polynomial(), and GiNaC::ex::to_rational().
| ex GiNaC::power::conjugate | ( | ) | const [virtual] |
Reimplemented from GiNaC::basic.
Definition at line 670 of file power.cpp.
References GiNaC::are_ex_trivially_equal(), basis, GiNaC::ex::conjugate(), GiNaC::status_flags::dynallocated, exponent, GiNaC::ex::info(), GiNaC::info_flags::integer, GiNaC::info_flags::positive, and power().
| ex GiNaC::power::real_part | ( | ) | const [virtual] |
Reimplemented from GiNaC::basic.
Definition at line 691 of file power.cpp.
References GiNaC::abs(), basis, c, GiNaC::cos(), GiNaC::exp(), GiNaC::ex::expand(), exponent, GiNaC::I, GiNaC::ex::imag_part(), GiNaC::ex::info(), GiNaC::info_flags::integer, GiNaC::log(), GiNaC::info_flags::posint, power(), GiNaC::ex::real_part(), and GiNaC::ex::subs().
| ex GiNaC::power::imag_part | ( | ) | const [virtual] |
Reimplemented from GiNaC::basic.
Definition at line 716 of file power.cpp.
References GiNaC::abs(), basis, c, GiNaC::exp(), GiNaC::ex::expand(), exponent, GiNaC::I, GiNaC::ex::imag_part(), GiNaC::ex::info(), GiNaC::info_flags::integer, GiNaC::log(), GiNaC::info_flags::posint, power(), GiNaC::ex::real_part(), GiNaC::sin(), and GiNaC::ex::subs().
| void GiNaC::power::archive | ( | archive_node & | n | ) | const [virtual] |
Save (a.k.a.
serialize) object into archive.
Reimplemented from GiNaC::basic.
Definition at line 81 of file power.cpp.
References GiNaC::archive_node::add_ex(), basis, and exponent.
| void GiNaC::power::read_archive | ( | const archive_node & | n, |
| lst & | syms | ||
| ) | [virtual] |
Read (a.k.a.
deserialize) object from archive.
Reimplemented from GiNaC::basic.
Definition at line 74 of file power.cpp.
References basis, exponent, and GiNaC::archive_node::find_ex().
Implementation of ex::diff() for a power.
Reimplemented from GiNaC::basic.
Definition at line 747 of file power.cpp.
References GiNaC::_ex1, GiNaC::_ex_1, basis, GiNaC::ex::diff(), exponent, GiNaC::log(), mul, and power().
Reimplemented from GiNaC::basic.
| unsigned GiNaC::power::return_type | ( | ) | const [protected, virtual] |
Reimplemented from GiNaC::basic.
Definition at line 776 of file power.cpp.
References basis, and GiNaC::ex::return_type().
| return_type_t GiNaC::power::return_type_tinfo | ( | ) | const [protected, virtual] |
Reimplemented from GiNaC::basic.
Definition at line 781 of file power.cpp.
References basis, and GiNaC::ex::return_type_tinfo().
| ex GiNaC::power::expand | ( | unsigned | options = 0 | ) | const [protected, virtual] |
Expand expression, i.e.
multiply it out and return the result as a new expression.
Reimplemented from GiNaC::basic.
Definition at line 786 of file power.cpp.
References GiNaC::are_ex_trivially_equal(), basis, GiNaC::status_flags::dynallocated, GiNaC::ex::expand(), expand_add(), expand_mul(), GiNaC::status_flags::expanded, exponent, GiNaC::basic::hold(), GiNaC::ex::info(), GiNaC::info_flags::integer, GiNaC::is_integer(), last, mul, GiNaC::expairseq::overall_coeff, power(), r, GiNaC::add::recombine_pair_to_ex(), GiNaC::expairseq::seq, GiNaC::basic::setflag(), and GiNaC::numeric::to_int().
Referenced by expand_add().
| void GiNaC::power::print_power | ( | const print_context & | c, |
| const char * | powersymbol, | ||
| const char * | openbrace, | ||
| const char * | closebrace, | ||
| unsigned | level | ||
| ) | const [protected] |
Definition at line 94 of file power.cpp.
References basis, exponent, precedence(), GiNaC::ex::print(), and GiNaC::print_context::s.
Referenced by do_print_dflt(), do_print_latex(), and do_print_python().
| void GiNaC::power::do_print_dflt | ( | const print_dflt & | c, |
| unsigned | level | ||
| ) | const [protected] |
Definition at line 108 of file power.cpp.
References GiNaC::_ex1_2, basis, exponent, GiNaC::ex::is_equal(), GiNaC::ex::print(), print_power(), and GiNaC::print_context::s.
| void GiNaC::power::do_print_latex | ( | const print_latex & | c, |
| unsigned | level | ||
| ) | const [protected] |
Definition at line 121 of file power.cpp.
References GiNaC::_ex1_2, basis, exponent, GiNaC::ex::is_equal(), GiNaC::is_negative(), power(), GiNaC::ex::print(), print_power(), and GiNaC::print_context::s.
| void GiNaC::power::do_print_csrc | ( | const print_csrc & | c, |
| unsigned | level | ||
| ) | const [protected] |
Definition at line 180 of file power.cpp.
References GiNaC::_ex_1, basis, GiNaC::exp(), exponent, GiNaC::ex::info(), GiNaC::info_flags::integer, GiNaC::ex::is_equal(), GiNaC::ex::print(), GiNaC::print_sym_pow(), GiNaC::print_context::s, and GiNaC::to_int().
| void GiNaC::power::do_print_python | ( | const print_python & | c, |
| unsigned | level | ||
| ) | const [protected] |
Definition at line 211 of file power.cpp.
References print_power().
| void GiNaC::power::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 216 of file power.cpp.
References basis, exponent, GiNaC::ex::print(), and GiNaC::print_context::s.
| void GiNaC::power::do_print_csrc_cl_N | ( | const print_csrc_cl_N & | c, |
| unsigned | level | ||
| ) | const [protected] |
Definition at line 165 of file power.cpp.
References GiNaC::_ex_1, basis, exponent, GiNaC::ex::is_equal(), GiNaC::ex::print(), and GiNaC::print_context::s.
expand a^n where a is an add and n is a positive integer.
Definition at line 865 of file power.cpp.
References basis, GiNaC::binomial(), GiNaC::status_flags::dynallocated, GiNaC::basic::ex, expand(), expand_add_2(), expand_mul(), GiNaC::status_flags::expanded, exponent, GINAC_ASSERT, GiNaC::is_pos_integer(), k, m, mul, n, GiNaC::expairseq::nops(), GiNaC::expairseq::op(), power(), GiNaC::basic::setflag(), and GiNaC::to_int().
Referenced by expand().
Special case of power::expand_add.
Expands a^2 where a is an add.
Definition at line 958 of file power.cpp.
References GiNaC::_ex1, GiNaC::_ex2, GiNaC::_num2_p, basis, c, GiNaC::ex::coeff(), GiNaC::add::combine_ex_with_coeff_to_pair(), GiNaC::add::combine_pair_with_coeff_to_pair(), GiNaC::status_flags::dynallocated, expand_mul(), GiNaC::status_flags::expanded, exponent, GINAC_ASSERT, GiNaC::ex::is_equal(), GiNaC::is_pos_integer(), GiNaC::ex::is_zero(), last, GiNaC::numeric::mul(), GiNaC::numeric::mul_dyn(), GiNaC::expairseq::nops(), GiNaC::expairseq::overall_coeff, power(), r, GiNaC::expairseq::seq, and GiNaC::basic::setflag().
Referenced by expand_add().
| ex GiNaC::power::expand_mul | ( | const mul & | m, |
| const numeric & | n, | ||
| unsigned | options, | ||
| bool | from_expand = false |
||
| ) | const [protected] |
Expand factors of m in m^n where m is a mul and n is an integer.
Definition at line 1024 of file power.cpp.
References GiNaC::_ex1, GiNaC::expair::coeff, GiNaC::mul::combine_pair_with_coeff_to_pair(), GiNaC::status_flags::dynallocated, GiNaC::basic::ex, GiNaC::expand_options::expand_rename_idx, GiNaC::status_flags::expanded, GiNaC::get_all_dummy_indices(), GINAC_ASSERT, GiNaC::info_flags::has_indices, GiNaC::mul::info(), GiNaC::numeric::is_integer(), GiNaC::numeric::is_positive(), GiNaC::numeric::is_zero(), last, m, mul, GiNaC::expairseq::overall_coeff, GiNaC::rename_dummy_indices_uniquely(), GiNaC::expairseq::seq, GiNaC::basic::setflag(), and GiNaC::numeric::to_int().
Referenced by eval(), expand(), expand_add(), and expand_add_2().
friend class mul [friend] |
Definition at line 42 of file power.h.
Referenced by derivative(), eval(), expand(), expand_add(), and expand_mul().
ex GiNaC::power::basis [protected] |
Definition at line 105 of file power.h.
Referenced by archive(), coeff(), conjugate(), degree(), derivative(), do_print_csrc(), do_print_csrc_cl_N(), do_print_dflt(), do_print_latex(), do_print_python_repr(), eval(), evalf(), evalm(), expand(), expand_add(), expand_add_2(), has(), imag_part(), info(), is_polynomial(), ldegree(), map(), normal(), op(), print_power(), read_archive(), real_part(), return_type(), return_type_tinfo(), series(), GiNaC::mul::split_ex_to_pair(), subs(), to_polynomial(), and to_rational().
ex GiNaC::power::exponent [protected] |
Definition at line 106 of file power.h.
Referenced by archive(), coeff(), conjugate(), degree(), derivative(), do_print_csrc(), do_print_csrc_cl_N(), do_print_dflt(), do_print_latex(), do_print_python_repr(), eval(), evalf(), evalm(), expand(), expand_add(), expand_add_2(), has(), imag_part(), info(), is_polynomial(), ldegree(), map(), normal(), op(), print_power(), read_archive(), real_part(), series(), GiNaC::mul::split_ex_to_pair(), subs(), to_polynomial(), and to_rational().