|
GiNaC
1.6.2
|
The class function is used to implement builtin functions like sin, cos... More...
#include <function.h>
Public Member Functions | |
| 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, bool discardable=false) | |
| function (unsigned ser, std::auto_ptr< exvector > vp) | |
| void | print (const print_context &c, unsigned level=0) const |
| Output to stream. | |
| unsigned | precedence () const |
| Return relative operator precedence (for parenthezing output). | |
| ex | expand (unsigned options=0) const |
| Expand expression, i.e. | |
| ex | eval (int level=0) const |
| Perform automatic non-interruptive term rewriting rules. | |
| ex | evalf (int level=0) const |
| Evaluate object numerically. | |
| ex | eval_ncmul (const exvector &v) const |
| This method is defined to be in line with behaviour of function::return_type() | |
| 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. | |
| ex | series (const relational &r, int order, unsigned options=0) const |
| Implementation of ex::series for functions. | |
| ex | thiscontainer (const exvector &v) const |
| ex | thiscontainer (std::auto_ptr< exvector > vp) const |
| ex | conjugate () const |
| Implementation of ex::conjugate for functions. | |
| ex | real_part () const |
| Implementation of ex::real_part for functions. | |
| ex | imag_part () const |
| Implementation of ex::imag_part for functions. | |
| void | archive (archive_node &n) const |
| Archive the object. | |
| void | read_archive (const archive_node &n, lst &syms) |
| Construct object from archive_node. | |
| ex | power (const ex &exp) const |
| unsigned | get_serial () const |
| std::string | get_name () const |
| Return the print name of the function. | |
Static Public Member Functions | |
| 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 Public Attributes | |
| static unsigned | current_serial = 0 |
| This can be used as a hook for external applications. | |
Protected Member Functions | |
| ex | derivative (const symbol &s) const |
| Implementation of ex::diff() for functions. | |
| bool | is_equal_same_type (const basic &other) const |
| Returns true if two objects of same type are equal. | |
| bool | match_same_type (const basic &other) const |
| Returns true if the attributes of two objects are similar enough for a match. | |
| unsigned | return_type () const |
| return_type_t | return_type_tinfo () const |
| ex | pderivative (unsigned diff_param) const |
| bool | lookup_remember_table (ex &result) const |
| void | store_remember_table (ex const &result) const |
Static Protected Member Functions | |
| static std::vector < function_options > & | registered_functions () |
Protected Attributes | |
| unsigned | serial |
Friends | |
| class | remember_table_entry |
| void | ginsh_get_ginac_functions () |
The class function is used to implement builtin functions like sin, cos...
and user defined functions
Definition at line 611 of file function.h.
| GiNaC::function::function | ( | unsigned | ser | ) |
Definition at line 932 of file function.cpp.
| GiNaC::function::function | ( | unsigned | ser, |
| const ex & | param1 | ||
| ) |
Definition at line 937 of file function.cpp.
Definition at line 941 of file function.cpp.
Definition at line 945 of file function.cpp.
| GiNaC::function::function | ( | unsigned | ser, |
| const ex & | param1, | ||
| const ex & | param2, | ||
| const ex & | param3, | ||
| const ex & | param4 | ||
| ) |
Definition at line 949 of file function.cpp.
| GiNaC::function::function | ( | unsigned | ser, |
| const ex & | param1, | ||
| const ex & | param2, | ||
| const ex & | param3, | ||
| const ex & | param4, | ||
| const ex & | param5 | ||
| ) |
Definition at line 953 of file function.cpp.
| GiNaC::function::function | ( | unsigned | ser, |
| const ex & | param1, | ||
| const ex & | param2, | ||
| const ex & | param3, | ||
| const ex & | param4, | ||
| const ex & | param5, | ||
| const ex & | param6 | ||
| ) |
Definition at line 957 of file function.cpp.
| GiNaC::function::function | ( | unsigned | ser, |
| const ex & | param1, | ||
| const ex & | param2, | ||
| const ex & | param3, | ||
| const ex & | param4, | ||
| const ex & | param5, | ||
| const ex & | param6, | ||
| const ex & | param7 | ||
| ) |
Definition at line 961 of file function.cpp.
| GiNaC::function::function | ( | unsigned | ser, |
| const ex & | param1, | ||
| const ex & | param2, | ||
| const ex & | param3, | ||
| const ex & | param4, | ||
| const ex & | param5, | ||
| const ex & | param6, | ||
| const ex & | param7, | ||
| const ex & | param8 | ||
| ) |
Definition at line 965 of file function.cpp.
| GiNaC::function::function | ( | unsigned | ser, |
| const ex & | param1, | ||
| const ex & | param2, | ||
| const ex & | param3, | ||
| const ex & | param4, | ||
| const ex & | param5, | ||
| const ex & | param6, | ||
| const ex & | param7, | ||
| const ex & | param8, | ||
| const ex & | param9 | ||
| ) |
Definition at line 969 of file function.cpp.
| GiNaC::function::function | ( | unsigned | ser, |
| const ex & | param1, | ||
| const ex & | param2, | ||
| const ex & | param3, | ||
| const ex & | param4, | ||
| const ex & | param5, | ||
| const ex & | param6, | ||
| const ex & | param7, | ||
| const ex & | param8, | ||
| const ex & | param9, | ||
| const ex & | param10 | ||
| ) |
Definition at line 973 of file function.cpp.
| GiNaC::function::function | ( | unsigned | ser, |
| const ex & | param1, | ||
| const ex & | param2, | ||
| const ex & | param3, | ||
| const ex & | param4, | ||
| const ex & | param5, | ||
| const ex & | param6, | ||
| const ex & | param7, | ||
| const ex & | param8, | ||
| const ex & | param9, | ||
| const ex & | param10, | ||
| const ex & | param11 | ||
| ) |
Definition at line 977 of file function.cpp.
| GiNaC::function::function | ( | unsigned | ser, |
| const ex & | param1, | ||
| const ex & | param2, | ||
| const ex & | param3, | ||
| const ex & | param4, | ||
| const ex & | param5, | ||
| const ex & | param6, | ||
| const ex & | param7, | ||
| const ex & | param8, | ||
| const ex & | param9, | ||
| const ex & | param10, | ||
| const ex & | param11, | ||
| const ex & | param12 | ||
| ) |
Definition at line 981 of file function.cpp.
| GiNaC::function::function | ( | unsigned | ser, |
| const ex & | param1, | ||
| const ex & | param2, | ||
| const ex & | param3, | ||
| const ex & | param4, | ||
| const ex & | param5, | ||
| const ex & | param6, | ||
| const ex & | param7, | ||
| const ex & | param8, | ||
| const ex & | param9, | ||
| const ex & | param10, | ||
| const ex & | param11, | ||
| const ex & | param12, | ||
| const ex & | param13 | ||
| ) |
Definition at line 985 of file function.cpp.
| GiNaC::function::function | ( | unsigned | ser, |
| const ex & | param1, | ||
| const ex & | param2, | ||
| const ex & | param3, | ||
| const ex & | param4, | ||
| const ex & | param5, | ||
| const ex & | param6, | ||
| const ex & | param7, | ||
| const ex & | param8, | ||
| const ex & | param9, | ||
| const ex & | param10, | ||
| const ex & | param11, | ||
| const ex & | param12, | ||
| const ex & | param13, | ||
| const ex & | param14 | ||
| ) |
Definition at line 989 of file function.cpp.
| GiNaC::function::function | ( | unsigned | ser, |
| const exprseq & | es | ||
| ) |
Definition at line 996 of file function.cpp.
References GiNaC::basic::clearflag(), and GiNaC::status_flags::evaluated.
| GiNaC::function::function | ( | unsigned | ser, |
| const exvector & | v, | ||
| bool | discardable = false |
||
| ) |
Definition at line 1004 of file function.cpp.
References registered_functions().
| GiNaC::function::function | ( | unsigned | ser, |
| std::auto_ptr< exvector > | vp | ||
| ) |
Definition at line 1012 of file function.cpp.
| void GiNaC::function::print | ( | const print_context & | c, |
| unsigned | level = 0 |
||
| ) | const [virtual] |
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.
Reimplemented in GiNaC::fderivative.
Definition at line 1058 of file function.cpp.
References c, current_serial, GiNaC::basic::flags, GiNaC::class_info< OPT >::get_parent(), GINAC_ASSERT, GiNaC::basic::hashvalue, GiNaC::function_options::name, GiNaC::container< C >::nops(), GiNaC::function_options::nparams, GiNaC::class_info< OPT >::options, GiNaC::container< C >::precedence(), precedence(), GiNaC::function_options::print_dispatch_table, GiNaC::function_options::print_use_exvector_args, GiNaC::container< C >::printseq(), registered_functions(), GiNaC::print_context::s, GiNaC::container_storage< C >::seq, serial, and GiNaC::function_options::TeX_name.
| unsigned GiNaC::function::precedence | ( | ) | const [inline, virtual] |
Return relative operator precedence (for parenthezing output).
Reimplemented from GiNaC::container< C >.
Definition at line 653 of file function.h.
Referenced by GiNaC::fderivative::do_print(), GiNaC::fderivative::do_print_csrc(), and print().
| ex GiNaC::function::expand | ( | unsigned | options = 0 | ) | const [virtual] |
Expand expression, i.e.
multiply it out and return the result as a new expression.
Reimplemented from GiNaC::basic.
Definition at line 1167 of file function.cpp.
References GiNaC::expand_options::expand_function_args, GiNaC::status_flags::expanded, and GiNaC::basic::setflag().
| ex GiNaC::function::eval | ( | int | level = 0 | ) | const [virtual] |
Perform automatic non-interruptive term rewriting rules.
Reimplemented from GiNaC::container< C >.
Reimplemented in GiNaC::fderivative.
Definition at line 1176 of file function.cpp.
References GiNaC::_ex0, GiNaC::canonicalize(), current_serial, GiNaC::function_options::eval_f, GiNaC::function_options::eval_use_exvector_args, GiNaC::container< C >::evalchildren(), GiNaC::basic::ex, GINAC_ASSERT, GiNaC::basic::hold(), GiNaC::ex::is_zero(), lookup_remember_table(), GiNaC::function_options::nparams, registered_functions(), GiNaC::container_storage< C >::seq, serial, store_remember_table(), GiNaC::function_options::symtree, thiscontainer(), and GiNaC::function_options::use_remember.
| ex GiNaC::function::evalf | ( | int | level = 0 | ) | const [virtual] |
Evaluate object numerically.
Reimplemented from GiNaC::basic.
Reimplemented in GiNaC::fderivative.
Definition at line 1267 of file function.cpp.
References current_serial, GiNaC::function_options::evalf_f, GiNaC::function_options::evalf_params_first, GiNaC::function_options::evalf_use_exvector_args, GINAC_ASSERT, GiNaC::basic::hold(), GiNaC::max_recursion_level, GiNaC::function_options::nparams, registered_functions(), GiNaC::container_storage< C >::seq, and serial.
This method is defined to be in line with behaviour of function::return_type()
Reimplemented from GiNaC::basic.
Definition at line 1333 of file function.cpp.
References GiNaC::container_storage< C >::seq.
| unsigned GiNaC::function::calchash | ( | ) | const [virtual] |
Compute the hash value of an object and if it makes sense to store it in the objects status_flags, do so.
The method inherited from class basic computes a hash value based on the type and hash values of possible members. For this reason it is well suited for container classes but atomic classes should override this implementation because otherwise they would all end up with the same hashvalue.
Reimplemented from GiNaC::basic.
Definition at line 1340 of file function.cpp.
References GiNaC::status_flags::evaluated, GiNaC::basic::flags, GiNaC::ex::gethash(), GiNaC::golden_ratio_hash(), GiNaC::status_flags::hash_calculated, GiNaC::basic::hashvalue, GiNaC::make_hash_seed(), GiNaC::container< C >::nops(), GiNaC::container< C >::op(), GiNaC::rotate_left(), serial, and GiNaC::basic::setflag().
| ex GiNaC::function::series | ( | const relational & | r, |
| int | order, | ||
| unsigned | options = 0 |
||
| ) | const [virtual] |
Implementation of ex::series for functions.
Reimplemented from GiNaC::basic.
Reimplemented in GiNaC::fderivative.
Definition at line 1367 of file function.cpp.
References current_serial, GINAC_ASSERT, GiNaC::function_options::nparams, registered_functions(), GiNaC::container_storage< C >::seq, serial, GiNaC::function_options::series_f, and GiNaC::function_options::series_use_exvector_args.
Reimplemented in GiNaC::fderivative.
Definition at line 1355 of file function.cpp.
References serial.
Referenced by eval().
Reimplemented in GiNaC::fderivative.
Definition at line 1360 of file function.cpp.
References serial.
| ex GiNaC::function::conjugate | ( | ) | const [virtual] |
Implementation of ex::conjugate for functions.
Reimplemented from GiNaC::container< C >.
Definition at line 1492 of file function.cpp.
References GiNaC::function_options::conjugate_f, GiNaC::function_options::conjugate_use_exvector_args, GINAC_ASSERT, GiNaC::function_options::nparams, registered_functions(), GiNaC::container_storage< C >::seq, and serial.
| ex GiNaC::function::real_part | ( | ) | const [virtual] |
Implementation of ex::real_part for functions.
Reimplemented from GiNaC::container< C >.
Definition at line 1542 of file function.cpp.
References GINAC_ASSERT, GiNaC::function_options::nparams, GiNaC::function_options::real_part_f, GiNaC::function_options::real_part_use_exvector_args, registered_functions(), GiNaC::container_storage< C >::seq, and serial.
| ex GiNaC::function::imag_part | ( | ) | const [virtual] |
Implementation of ex::imag_part for functions.
Reimplemented from GiNaC::container< C >.
Definition at line 1590 of file function.cpp.
References GINAC_ASSERT, GiNaC::function_options::imag_part_f, GiNaC::function_options::imag_part_use_exvector_args, GiNaC::function_options::nparams, registered_functions(), GiNaC::container_storage< C >::seq, and serial.
| void GiNaC::function::archive | ( | archive_node & | n | ) | const [virtual] |
Archive the object.
Reimplemented from GiNaC::container< C >.
Reimplemented in GiNaC::fderivative.
Definition at line 1043 of file function.cpp.
References GiNaC::archive_node::add_string(), GINAC_ASSERT, registered_functions(), and serial.
| void GiNaC::function::read_archive | ( | const archive_node & | n, |
| lst & | sym_lst | ||
| ) | [virtual] |
Construct object from archive_node.
Reimplemented from GiNaC::container< C >.
Reimplemented in GiNaC::fderivative.
Definition at line 1022 of file function.cpp.
References GiNaC::archive_node::find_string(), registered_functions(), and serial.
Implementation of ex::diff() for functions.
It applies the chain rule, except for the Order term function.
Reimplemented from GiNaC::basic.
Reimplemented in GiNaC::fderivative.
Definition at line 1642 of file function.cpp.
References GiNaC::basic::diff(), GiNaC::ex::is_zero(), pderivative(), GiNaC::container_storage< C >::seq, and serial.
| bool GiNaC::function::is_equal_same_type | ( | const basic & | other | ) | const [protected, virtual] |
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 >.
Reimplemented in GiNaC::fderivative.
Definition at line 1678 of file function.cpp.
References GINAC_ASSERT, and serial.
| bool GiNaC::function::match_same_type | ( | const basic & | other | ) | const [protected, virtual] |
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.
Reimplemented in GiNaC::fderivative.
Definition at line 1689 of file function.cpp.
References GINAC_ASSERT, and serial.
| unsigned GiNaC::function::return_type | ( | ) | const [protected, virtual] |
Reimplemented from GiNaC::basic.
Definition at line 1697 of file function.cpp.
References GiNaC::return_types::commutative, GINAC_ASSERT, registered_functions(), GiNaC::function_options::return_type, GiNaC::container_storage< C >::seq, serial, and GiNaC::function_options::use_return_type.
| return_type_t GiNaC::function::return_type_tinfo | ( | ) | const [protected, virtual] |
Reimplemented from GiNaC::basic.
Definition at line 1715 of file function.cpp.
References GINAC_ASSERT, registered_functions(), GiNaC::function_options::return_type_tinfo, GiNaC::container_storage< C >::seq, serial, and GiNaC::function_options::use_return_type.
| ex GiNaC::function::pderivative | ( | unsigned | diff_param | ) | const [protected] |
Definition at line 1745 of file function.cpp.
References GiNaC::function_options::derivative_f, GiNaC::function_options::derivative_use_exvector_args, GINAC_ASSERT, and GiNaC::function_options::nparams.
Referenced by derivative(), and GiNaC::fderivative::eval().
| std::vector< function_options > & GiNaC::function::registered_functions | ( | ) | [static, protected] |
Definition at line 1842 of file function.cpp.
Referenced by archive(), conjugate(), GiNaC::fderivative::do_print(), GiNaC::fderivative::do_print_csrc(), GiNaC::fderivative::do_print_tree(), GiNaC::fderivative::eval(), eval(), evalf(), find_function(), function(), get_name(), imag_part(), print(), read_archive(), real_part(), register_new(), return_type(), return_type_tinfo(), and series().
| bool GiNaC::function::lookup_remember_table | ( | ex & | result | ) | const [protected] |
Definition at line 1848 of file function.cpp.
References GiNaC::remember_table::remember_tables(), and serial.
Referenced by eval().
| void GiNaC::function::store_remember_table | ( | ex const & | result | ) | const [protected] |
Definition at line 1853 of file function.cpp.
References GiNaC::remember_table::remember_tables(), and serial.
Referenced by eval().
Definition at line 1793 of file function.cpp.
References GiNaC::status_flags::dynallocated, GiNaC::status_flags::evaluated, GINAC_ASSERT, GiNaC::function_options::nparams, GiNaC::function_options::power_f, and GiNaC::function_options::power_use_exvector_args.
| unsigned GiNaC::function::register_new | ( | function_options const & | opt | ) | [static] |
Definition at line 1860 of file function.cpp.
References GiNaC::function_options::functions_with_same_name, GiNaC::function_options::name, registered_functions(), GiNaC::function_options::remember_assoc_size, GiNaC::function_options::remember_size, GiNaC::function_options::remember_strategy, GiNaC::remember_table::remember_tables(), and GiNaC::function_options::use_remember.
| unsigned GiNaC::function::find_function | ( | const std::string & | name, |
| unsigned | nparams | ||
| ) | [static] |
Find serial number of function by name and number of parameters.
Throws exception if function was not found.
Definition at line 1889 of file function.cpp.
References GiNaC::container< C >::end(), registered_functions(), serial, and GiNaC::ToString().
| unsigned GiNaC::function::get_serial | ( | ) | const [inline] |
Definition at line 688 of file function.h.
References serial.
| std::string GiNaC::function::get_name | ( | ) | const |
Return the print name of the function.
Definition at line 1903 of file function.cpp.
References registered_functions(), and serial.
friend class remember_table_entry [friend] |
Definition at line 620 of file function.h.
| void ginsh_get_ginac_functions | ( | ) | [friend] |
unsigned GiNaC::function::current_serial = 0 [static] |
unsigned GiNaC::function::serial [protected] |
Definition at line 694 of file function.h.
Referenced by archive(), calchash(), conjugate(), GiNaC::fderivative::derivative(), derivative(), GiNaC::fderivative::do_print(), GiNaC::fderivative::do_print_csrc(), GiNaC::fderivative::do_print_tree(), GiNaC::fderivative::eval(), eval(), evalf(), find_function(), get_name(), get_serial(), imag_part(), is_equal_same_type(), lookup_remember_table(), match_same_type(), print(), read_archive(), real_part(), return_type(), return_type_tinfo(), series(), store_remember_table(), GiNaC::fderivative::thiscontainer(), and thiscontainer().