GiNaC 1.8.8
|
This class represents the (abstract) derivative of a symbolic function. More...
#include <fderivative.h>
Public Member Functions | |
fderivative (unsigned ser, unsigned param, const exvector &args) | |
Construct derivative with respect to one parameter. | |
fderivative (unsigned ser, const paramset ¶ms, const exvector &args) | |
Construct derivative with respect to multiple parameters. | |
fderivative (unsigned ser, const paramset ¶ms, exvector &&v) | |
void | print (const print_context &c, unsigned level=0) const override |
Output to stream. | |
ex | eval () const override |
Perform automatic non-interruptive term rewriting rules. | |
ex | series (const relational &r, int order, unsigned options=0) const override |
The series expansion of derivatives falls back to Taylor expansion. | |
ex | thiscontainer (const exvector &v) const override |
ex | thiscontainer (exvector &&v) const override |
void | archive (archive_node &n) const override |
Archive the object. | |
void | read_archive (const archive_node &n, lst &syms) override |
Load (deserialize) the object from an archive node. | |
const paramset & | derivatives () const |
Expose this object's derivative structure. | |
Public Member Functions inherited from GiNaC::function | |
function (unsigned ser) | |
function (unsigned ser, const ex ¶m1) | |
function (unsigned ser, const ex ¶m1, const ex ¶m2) | |
function (unsigned ser, const ex ¶m1, const ex ¶m2, const ex ¶m3) | |
function (unsigned ser, const ex ¶m1, const ex ¶m2, const ex ¶m3, const ex ¶m4) | |
function (unsigned ser, const ex ¶m1, const ex ¶m2, const ex ¶m3, const ex ¶m4, const ex ¶m5) | |
function (unsigned ser, const ex ¶m1, const ex ¶m2, const ex ¶m3, const ex ¶m4, const ex ¶m5, const ex ¶m6) | |
function (unsigned ser, const ex ¶m1, const ex ¶m2, const ex ¶m3, const ex ¶m4, const ex ¶m5, const ex ¶m6, const ex ¶m7) | |
function (unsigned ser, const ex ¶m1, const ex ¶m2, const ex ¶m3, const ex ¶m4, const ex ¶m5, const ex ¶m6, const ex ¶m7, const ex ¶m8) | |
function (unsigned ser, const ex ¶m1, const ex ¶m2, const ex ¶m3, const ex ¶m4, const ex ¶m5, const ex ¶m6, const ex ¶m7, const ex ¶m8, const ex ¶m9) | |
function (unsigned ser, const ex ¶m1, const ex ¶m2, const ex ¶m3, const ex ¶m4, const ex ¶m5, const ex ¶m6, const ex ¶m7, const ex ¶m8, const ex ¶m9, const ex ¶m10) | |
function (unsigned ser, const ex ¶m1, const ex ¶m2, const ex ¶m3, const ex ¶m4, const ex ¶m5, const ex ¶m6, const ex ¶m7, const ex ¶m8, const ex ¶m9, const ex ¶m10, const ex ¶m11) | |
function (unsigned ser, const ex ¶m1, const ex ¶m2, const ex ¶m3, const ex ¶m4, const ex ¶m5, const ex ¶m6, const ex ¶m7, const ex ¶m8, const ex ¶m9, const ex ¶m10, const ex ¶m11, const ex ¶m12) | |
function (unsigned ser, const ex ¶m1, const ex ¶m2, const ex ¶m3, const ex ¶m4, const ex ¶m5, const ex ¶m6, const ex ¶m7, const ex ¶m8, const ex ¶m9, const ex ¶m10, const ex ¶m11, const ex ¶m12, const ex ¶m13) | |
function (unsigned ser, const ex ¶m1, const ex ¶m2, const ex ¶m3, const ex ¶m4, const ex ¶m5, const ex ¶m6, const ex ¶m7, const ex ¶m8, const ex ¶m9, const ex ¶m10, const ex ¶m11, const ex ¶m12, const ex ¶m13, const ex ¶m14) | |
function (unsigned ser, const exprseq &es) | |
function (unsigned ser, const exvector &v) | |
function (unsigned ser, exvector &&v) | |
void | print (const print_context &c, unsigned level=0) const override |
Output to stream. | |
unsigned | precedence () const override |
Return relative operator precedence (for parenthezing output). | |
ex | expand (unsigned options=0) const override |
Expand expression, i.e. | |
ex | eval () const override |
Perform automatic non-interruptive term rewriting rules. | |
ex | evalf () const override |
Evaluate object numerically. | |
ex | eval_ncmul (const exvector &v) const override |
This method is defined to be in line with behavior of function::return_type() | |
unsigned | calchash () const override |
Compute the hash value of an object and if it makes sense to store it in the objects status_flags, do so. | |
ex | series (const relational &r, int order, unsigned options=0) const override |
Implementation of ex::series for functions. | |
ex | thiscontainer (const exvector &v) const override |
ex | thiscontainer (exvector &&v) const override |
ex | conjugate () const override |
Implementation of ex::conjugate for functions. | |
ex | real_part () const override |
Implementation of ex::real_part for functions. | |
ex | imag_part () const override |
Implementation of ex::imag_part for functions. | |
void | archive (archive_node &n) const override |
Archive the object. | |
void | read_archive (const archive_node &n, lst &syms) override |
Construct object from archive_node. | |
bool | info (unsigned inf) const override |
Implementation of ex::info for functions. | |
ex | power (const ex &exp) const |
unsigned | get_serial () const |
std::string | get_name () const |
Return the print name of the function. | |
Public Member Functions inherited from GiNaC::container< C > | |
container (STLT const &s) | |
container (STLT &&v) | |
container (exvector::const_iterator b, exvector::const_iterator e) | |
container (std::initializer_list< ex > il) | |
size_t | nops () const override |
Number of operands/members. | |
ex | op (size_t i) const override |
Return operand/member at position i. | |
ex & | let_op (size_t i) override |
Return modifiable operand/member at position i. | |
ex | subs (const exmap &m, unsigned options=0) const override |
Substitute a set of objects by arbitrary expressions. | |
container & | prepend (const ex &b) |
Add element at front. | |
container & | append (const ex &b) |
Add element at back. | |
container & | remove_first () |
Remove first element. | |
container & | remove_last () |
Remove last element. | |
container & | remove_all () |
Remove all elements. | |
container & | sort () |
Sort elements. | |
container & | unique () |
Remove adjacent duplicate elements. | |
const_iterator | begin () const |
const_iterator | end () const |
const_reverse_iterator | rbegin () const |
const_reverse_iterator | rend () const |
Public Member Functions inherited from GiNaC::basic | |
virtual | ~basic () |
basic destructor, virtual because class ex will delete objects of derived classes via a basic*. | |
basic (const basic &other) | |
const basic & | operator= (const basic &other) |
basic assignment operator: the other object might be of a derived class. | |
virtual basic * | duplicate () const |
Create a clone of this object on the heap. | |
virtual ex | evalm () const |
Evaluate sums, products and integer powers of matrices. | |
virtual ex | eval_integ () const |
Evaluate integrals, if result is known. | |
virtual ex | eval_indexed (const basic &i) const |
Perform automatic symbolic evaluations on indexed expression that contains this object as the base expression. | |
virtual void | dbgprint () const |
Little wrapper around print to be called within a debugger. | |
virtual void | dbgprinttree () const |
Little wrapper around printtree to be called within a debugger. | |
virtual ex | operator[] (const ex &index) const |
virtual ex | operator[] (size_t i) const |
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. | |
virtual bool | match (const ex &pattern, exmap &repls) const |
Check whether the expression matches a given pattern. | |
virtual ex | map (map_function &f) const |
Construct new expression by applying the specified function to all sub-expressions (one level only, not recursively). | |
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. | |
virtual int | degree (const ex &s) const |
Return degree of highest power in object s. | |
virtual int | ldegree (const ex &s) const |
Return degree of lowest power in object s. | |
virtual ex | coeff (const ex &s, int n=1) const |
Return coefficient of degree n in object s. | |
virtual ex | collect (const ex &s, bool distributed=false) const |
Sort expanded expression in terms of powers of some object(s). | |
virtual ex | normal (exmap &repl, exmap &rev_lookup, lst &modifier) const |
Default implementation of ex::normal(). | |
virtual ex | to_rational (exmap &repl) const |
Default implementation of ex::to_rational(). | |
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. | |
virtual numeric | max_coefficient () const |
Implementation ex::max_coefficient(). | |
virtual exvector | get_free_indices () const |
Return a vector containing the free indices of an expression. | |
virtual ex | add_indexed (const ex &self, const ex &other) const |
Add two indexed expressions. | |
virtual ex | scalar_mul_indexed (const ex &self, const numeric &other) const |
Multiply an indexed expression with a scalar. | |
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. | |
template<class T > | |
void | print_dispatch (const print_context &c, unsigned level) const |
Like print(), but dispatch to the specified class. | |
void | print_dispatch (const registered_class_info &ri, const print_context &c, unsigned level) const |
Like print(), but dispatch to the specified class. | |
ex | subs_one_level (const exmap &m, unsigned options) const |
Helper function for subs(). | |
ex | diff (const symbol &s, unsigned nth=1) const |
Default interface of nth derivative ex::diff(s, n). | |
int | compare (const basic &other) const |
Compare objects syntactically to establish canonical ordering. | |
bool | is_equal (const basic &other) const |
Test for syntactic equality. | |
const basic & | hold () const |
Stop further evaluation. | |
unsigned | gethash () const |
const basic & | setflag (unsigned f) const |
Set some status_flags. | |
const basic & | clearflag (unsigned f) const |
Clear some status_flags. | |
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 derivatives. | |
bool | is_equal_same_type (const basic &other) const override |
Returns true if two objects of same type are equal. | |
bool | match_same_type (const basic &other) const override |
Returns true if the attributes of two objects are similar enough for a match. | |
void | do_print (const print_context &c, unsigned level) const |
void | do_print_latex (const print_context &c, unsigned level) const |
void | do_print_csrc (const print_csrc &c, unsigned level) const |
void | do_print_tree (const print_tree &c, unsigned level) const |
Protected Member Functions inherited from GiNaC::function | |
ex | derivative (const symbol &s) const override |
Implementation of ex::diff() for functions. | |
bool | is_equal_same_type (const basic &other) const override |
Returns true if two objects of same type are equal. | |
bool | match_same_type (const basic &other) const override |
Returns true if the attributes of two objects are similar enough for a match. | |
unsigned | return_type () const override |
return_type_t | return_type_tinfo () const override |
ex | pderivative (unsigned diff_param) const |
ex | expl_derivative (const symbol &s) const |
bool | lookup_remember_table (ex &result) const |
void | store_remember_table (ex const &result) const |
Protected Member Functions inherited from GiNaC::container< C > | |
virtual ex | thiscontainer (const STLT &v) const |
Similar to duplicate(), but with a preset sequence. | |
virtual ex | thiscontainer (STLT &&v) const |
Similar to duplicate(), but with a preset sequence (which gets pilfered). | |
virtual void | printseq (const print_context &c, char openbracket, char delim, char closebracket, unsigned this_precedence, unsigned upper_precedence=0) const |
Print sequence of contained elements. | |
void | do_print (const print_context &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 |
STLT | subschildren (const exmap &m, unsigned options=0) const |
Protected Member Functions inherited from GiNaC::basic | |
basic () | |
virtual int | compare_same_type (const basic &other) const |
Returns order relation between two objects of same type. | |
void | ensure_if_modifiable () const |
Ensure the object may be modified without hurting others, throws if this is not the case. | |
void | do_print (const print_context &c, unsigned level) const |
Default output to stream. | |
void | do_print_tree (const print_tree &c, unsigned level) const |
Tree output to stream. | |
void | do_print_python_repr (const print_python_repr &c, unsigned level) const |
Python parsable output to stream. | |
Protected Member Functions inherited from GiNaC::container_storage< C > | |
container_storage () | |
container_storage (size_t n, const ex &e) | |
container_storage (std::initializer_list< ex > il) | |
template<class In > | |
container_storage (In b, In e) | |
void | reserve (size_t) |
~container_storage () | |
void | reserve (size_t n) |
void | reserve (std::vector< ex > &v, size_t n) |
Protected Attributes | |
paramset | parameter_set |
Set of parameter numbers with respect to which to take the derivative. | |
Protected Attributes inherited from GiNaC::function | |
unsigned | serial |
Protected Attributes inherited from GiNaC::basic | |
unsigned | flags |
of type status_flags | |
unsigned | hashvalue |
hash value | |
Protected Attributes inherited from GiNaC::container_storage< C > | |
STLT | seq |
Additional Inherited Members | |
Public Types inherited from GiNaC::container< C > | |
typedef STLT::const_iterator | const_iterator |
typedef STLT::const_reverse_iterator | const_reverse_iterator |
Static Public Member Functions inherited from GiNaC::function | |
static unsigned | register_new (function_options const &opt) |
static unsigned | find_function (const std::string &name, unsigned nparams) |
Find serial number of function by name and number of parameters. | |
static std::vector< function_options > | get_registered_functions () |
Static Public Attributes inherited from GiNaC::function | |
static unsigned | current_serial = 0 |
This can be used as a hook for external applications. | |
Protected Types inherited from GiNaC::container< C > | |
typedef container_storage< C >::STLT | STLT |
Protected Types inherited from GiNaC::container_storage< C > | |
typedef C< ex > | STLT |
Static Protected Member Functions inherited from GiNaC::function | |
static std::vector< function_options > & | registered_functions () |
Static Protected Member Functions inherited from GiNaC::container< C > | |
static unsigned | get_default_flags () |
Specialization of container::get_default_flags() for lst. | |
static char | get_open_delim () |
Specialization of container::get_open_delim() for lst. | |
static char | get_close_delim () |
Specialization of container::get_close_delim() for lst. | |
Static Protected Member Functions inherited from GiNaC::container_storage< C > | |
static void | reserve (STLT &, size_t) |
This class represents the (abstract) derivative of a symbolic function.
It is used to represent the derivatives of functions that do not have a derivative or series expansion procedure defined.
Definition at line 37 of file fderivative.h.
GiNaC::fderivative::fderivative | ( | unsigned | ser, |
unsigned | param, | ||
const exvector & | args | ||
) |
Construct derivative with respect to one parameter.
ser | Serial number of function |
param | Number of parameter with respect to which to take the derivative |
args | Arguments of derivative function |
Definition at line 48 of file fderivative.cpp.
References parameter_set.
Construct derivative with respect to multiple parameters.
ser | Serial number of function |
params | Set of numbers of parameters with respect to which to take the derivative |
args | Arguments of derivative function |
Definition at line 53 of file fderivative.cpp.
Definition at line 57 of file fderivative.cpp.
|
overridevirtual |
Output to stream.
This performs double dispatch on the dynamic type of *this and the dynamic type of the supplied print context.
c | print context object that describes the output formatting |
level | value that is used to identify the precedence or indentation level for placing parentheses and formatting |
Reimplemented from GiNaC::basic.
Definition at line 95 of file fderivative.cpp.
References c, and GiNaC::basic::print().
|
overridevirtual |
Perform automatic non-interruptive term rewriting rules.
Reimplemented from GiNaC::basic.
Definition at line 158 of file fderivative.cpp.
References GiNaC::basic::hold(), parameter_set, GiNaC::function::pderivative(), GiNaC::function::registered_functions(), GiNaC::container_storage< C >::seq, and GiNaC::function::serial.
|
overridevirtual |
The series expansion of derivatives falls back to Taylor expansion.
Reimplemented from GiNaC::basic.
Definition at line 173 of file fderivative.cpp.
References options, order, r, and GiNaC::basic::series().
Definition at line 178 of file fderivative.cpp.
References parameter_set, and GiNaC::function::serial.
Definition at line 183 of file fderivative.cpp.
References parameter_set, and GiNaC::function::serial.
|
overridevirtual |
Archive the object.
Reimplemented from GiNaC::container< C >.
Definition at line 80 of file fderivative.cpp.
References GiNaC::container< C >::end(), n, and parameter_set.
|
overridevirtual |
Load (deserialize) the object from an archive node.
Construct object from archive_node.
Reimplemented from GiNaC::container< C >.
Definition at line 65 of file fderivative.cpp.
References n, and parameter_set.
Implementation of ex::diff() for derivatives.
It applies the chain rule.
Reimplemented from GiNaC::basic.
Definition at line 190 of file fderivative.cpp.
References GiNaC::ex::diff(), GiNaC::ex::is_zero(), parameter_set, GiNaC::container_storage< C >::seq, and GiNaC::function::serial.
|
overrideprotectedvirtual |
Returns true if two objects of same type are equal.
Normally needs not be reimplemented as long as it wasn't overwritten by some parent class, since it just calls compare_same_type(). The reason why this function exists is that sometimes it is easier to determine equality than an order relation and then it can be overridden.
Reimplemented from GiNaC::container< C >.
Definition at line 215 of file fderivative.cpp.
References GINAC_ASSERT, and parameter_set.
|
overrideprotectedvirtual |
Returns true if the attributes of two objects are similar enough for a match.
This function must not match subexpressions (this is already done by basic::match()). Only attributes not accessible by op() should be compared. This is also the reason why this function doesn't take the wildcard replacement list from match() as an argument: only subexpressions are subject to wildcard matches. Also, this function only needs to be implemented for container classes because is_equal_same_type() is automatically used instead of match_same_type() if nops() == 0.
Reimplemented from GiNaC::basic.
Definition at line 226 of file fderivative.cpp.
References GINAC_ASSERT, and parameter_set.
const paramset & GiNaC::fderivative::derivatives | ( | ) | const |
Expose this object's derivative structure.
Parameter numbers occurring more than once stand for repeated differentiation with respect to that parameter. If a symbolic function f(x,y) is differentiated with respect to x, this method will return {0}. If f(x,y) is differentiated twice with respect to y, it will return {1,1}. (This corresponds to the way this object is printed.)
Definition at line 244 of file fderivative.cpp.
References parameter_set.
|
protected |
Definition at line 101 of file fderivative.cpp.
References c, GiNaC::container< C >::end(), parameter_set, GiNaC::container< C >::precedence(), GiNaC::function::precedence(), GiNaC::container< C >::printseq(), GiNaC::function::registered_functions(), and GiNaC::function::serial.
|
protected |
Definition at line 113 of file fderivative.cpp.
References c, GiNaC::container< C >::end(), order, parameter_set, GiNaC::container< C >::precedence(), GiNaC::function::precedence(), GiNaC::container< C >::printseq(), GiNaC::function::registered_functions(), and GiNaC::function::serial.
|
protected |
Definition at line 130 of file fderivative.cpp.
References c, GiNaC::container< C >::end(), parameter_set, GiNaC::container< C >::precedence(), GiNaC::function::precedence(), GiNaC::container< C >::printseq(), GiNaC::function::registered_functions(), and GiNaC::function::serial.
|
protected |
Definition at line 141 of file fderivative.cpp.
References c, GiNaC::container< C >::end(), GiNaC::basic::flags, GiNaC::basic::hashvalue, GiNaC::container< C >::nops(), parameter_set, GiNaC::function::registered_functions(), GiNaC::container_storage< C >::seq, and GiNaC::function::serial.
|
protected |
Set of parameter numbers with respect to which to take the derivative.
Definition at line 85 of file fderivative.h.
Referenced by archive(), derivative(), derivatives(), do_print(), do_print_csrc(), do_print_latex(), do_print_tree(), eval(), fderivative(), is_equal_same_type(), match_same_type(), read_archive(), thiscontainer(), and thiscontainer().