91 return bp->diff(s, nth);
98 return bp->match(pattern, repl_lst);
107 if (
match(pattern)) {
111 bool any_found =
false;
112 for (
size_t i=0; i<
nops(); i++)
113 if (
op(i).
find(pattern, found))
126 for (
auto its = ls.
begin(), itr =
lr.begin(); its != ls.
end(); ++its, ++itr) {
127 m.insert(std::make_pair(*its, *itr));
131 if (is_exactly_a<mul>(*its) || is_exactly_a<power>(*its))
150 const ex & s = e.
op(0);
151 m.insert(std::make_pair(s, e.
op(1)));
153 if (is_exactly_a<mul>(s) || is_exactly_a<power>(s))
165 for (
auto &
r : ex_to<lst>(e)) {
167 throw(std::invalid_argument(
"basic::subs(ex): argument must be a list of equations"));
168 const ex & s =
r.op(0);
169 m.insert(std::make_pair(s,
r.op(1)));
173 if (is_exactly_a<mul>(s) || is_exactly_a<power>(s))
182 throw(std::invalid_argument(
"ex::subs(ex): argument must be a relation_equal or a list"));
191 for (
size_t i = 0; i <
n; ++i)
199 for (
size_t i = 0; i <
n; ++i)
209 return bp->let_op(i);
227 if (!is_a<relational>(*
this))
228 throw std::runtime_error(
"ex::lhs(): not a relation");
235 if (!is_a<relational>(*
this))
236 throw std::runtime_error(
"ex::rhs(): not a relation");
243 if (is_a<lst>(vars)) {
244 const lst & varlst = ex_to<lst>(vars);
245 for (
auto & it : varlst)
246 if (!
bp->is_polynomial(it))
251 return bp->is_polynomial(vars);
261 return is_a<matrix>(e) && ex_to<matrix>(e).is_zero_matrix();
283 if (
bp->get_refcount() <= other.
bp->get_refcount())
309 const ex & tmpex = other.
eval();
404 return dynallocate<numeric>(i);
438 return dynallocate<numeric>(i);
496 return dynallocate<numeric>(i);
530 return dynallocate<numeric>(i);
536 if (i >= -12 && i <= 12) {
539 return dynallocate<numeric>(i);
548 return dynallocate<numeric>(i);
554 return dynallocate<numeric>(d);
Interface to GiNaC's symbolic exponentiation (basis^exponent).
static ptr< basic > construct_from_basic(const basic &other)
Helper function for the ex-from-basic constructor.
ex subs(const exmap &m, unsigned options=0) const
static basic & construct_from_long(long i)
don't share instances of this object between different expressions unless explicitly asked to (used b...
void traverse_preorder(visitor &v) const
Traverse expression tree with given visitor, preorder traversal.
ex expand(unsigned options=0) const
virtual ex eval() const
Perform automatic non-interruptive term rewriting rules.
const numeric * _num_11_p
static basic & construct_from_uint(unsigned int i)
void dbgprint() const
Little wrapper arount print to be called within a debugger.
Interface to GiNaC's sums of expressions.
This class is the ABC (abstract base class) of GiNaC's class hierarchy.
used internally by expairseq::subschildren()
Interface to GiNaC's products of expressions.
Degenerate base class for visitors.
bool info(unsigned inf) const
Interface to several small and furry utilities needed within GiNaC but not of any interest to the use...
void dbgprinttree() const
Little wrapper arount printtree to be called within a debugger.
static basic & construct_from_double(double d)
void traverse_postorder(visitor &v) const
Traverse expression tree with given visitor, postorder traversal.
This class is a wrapper around CLN-numbers within the GiNaC class hierarchy.
static basic & construct_from_int(int i)
ex operator[](const ex &index) const
bool find(const ex &pattern, exset &found) const
Find all occurrences of a pattern.
bool match(const ex &pattern) const
Check whether expression matches a specified pattern.
ex rhs() const
Right hand side of relational expression.
size_t nops() const override
Number of operands/members.
#define GINAC_ASSERT(X)
Assertion macro for checking invariances.
static basic & construct_from_ulonglong(unsigned long long i)
virtual basic * duplicate() const
Create a clone of this object on the heap.
void accept(visitor &v) const
std::set< ex, ex_is_less > exset
void makewriteable()
Make this ex writable (if more than one ex handle the same basic) by unlinking the object and creatin...
const_iterator end() const
Interface to symbolic matrices.
ex diff(const symbol &s, unsigned nth=1) const
Compute partial derivative of an expression.
std::map< ex, ex, ex_is_less > exmap
bool is_zero_matrix() const
Check whether expression is zero or zero matrix.
static basic & construct_from_ulong(unsigned long i)
Interface to GiNaC's light-weight expression handles.
Base class for print_contexts.
Definition of GiNaC's lst.
const numeric * _num_12_p
static basic & construct_from_longlong(long long i)
void print(const print_context &c, unsigned level=0) const
Print expression to stream.
const_iterator begin() const
Lightweight wrapper for GiNaC's symbolic objects.
Interface to GiNaC's non-commutative products of expressions.
used internally by expairseq::subschildren()
const numeric * _num_10_p
unsigned int get_refcount() const noexcept
Wrapper template for making GiNaC classes out of STL containers.
.expand(0) has already done its job (other expand() options ignore this flag)
Interface to relations between expressions.
Makes the interface to the underlying bignum package available.
ptr< basic > bp
pointer to basic object managed by this
ex & let_op(size_t i)
Return modifiable operand/member at position i.
heap-allocated (i.e. created by new if we want to be clever and bypass the stack, ...
ex lhs() const
Left hand side of relational expression.
.eval() has already done its job
void share(const ex &other) const
Share equal objects between expressions.
bool is_polynomial(const ex &vars) const
Check whether expression is a polynomial.
Class of (intrusively) reference-counted pointers that support copy-on-write semantics.
unsigned flags
of type status_flags