GiNaC  1.6.2
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends
GiNaC::function Class Reference

The class function is used to implement builtin functions like sin, cos... More...

#include <function.h>

Inheritance diagram for GiNaC::function:
GiNaC::container< C > GiNaC::basic GiNaC::container_storage< C > GiNaC::refcounted GiNaC::fderivative

List of all members.

Public Member Functions

 function (unsigned ser)
 function (unsigned ser, const ex &param1)
 function (unsigned ser, const ex &param1, const ex &param2)
 function (unsigned ser, const ex &param1, const ex &param2, const ex &param3)
 function (unsigned ser, const ex &param1, const ex &param2, const ex &param3, const ex &param4)
 function (unsigned ser, const ex &param1, const ex &param2, const ex &param3, const ex &param4, const ex &param5)
 function (unsigned ser, const ex &param1, const ex &param2, const ex &param3, const ex &param4, const ex &param5, const ex &param6)
 function (unsigned ser, const ex &param1, const ex &param2, const ex &param3, const ex &param4, const ex &param5, const ex &param6, const ex &param7)
 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)
 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)
 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)
 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)
 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)
 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)
 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)
 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 ()

Detailed Description

The class function is used to implement builtin functions like sin, cos...

and user defined functions

Definition at line 611 of file function.h.


Constructor & Destructor Documentation

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.

GiNaC::function::function ( unsigned  ser,
const ex param1,
const ex param2 
)

Definition at line 941 of file function.cpp.

GiNaC::function::function ( unsigned  ser,
const ex param1,
const ex param2,
const ex param3 
)

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.


Member Function Documentation

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.

Parameters:
cprint context object that describes the output formatting
levelvalue 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]
ex GiNaC::function::evalf ( int  level = 0) const [virtual]
ex GiNaC::function::eval_ncmul ( const exvector v) const [virtual]

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]
ex GiNaC::function::thiscontainer ( const exvector v) const

Reimplemented in GiNaC::fderivative.

Definition at line 1355 of file function.cpp.

References serial.

Referenced by eval().

ex GiNaC::function::thiscontainer ( std::auto_ptr< exvector vp) const

Reimplemented in GiNaC::fderivative.

Definition at line 1360 of file function.cpp.

References serial.

ex GiNaC::function::conjugate ( ) const [virtual]
ex GiNaC::function::real_part ( ) const [virtual]
ex GiNaC::function::imag_part ( ) const [virtual]
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.

ex GiNaC::function::derivative ( const symbol s) const [protected, virtual]

Implementation of ex::diff() for functions.

It applies the chain rule, except for the Order term function.

See also:
ex::diff

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.

See also:
basic::match

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]
return_type_t GiNaC::function::return_type_tinfo ( ) const [protected, virtual]
ex GiNaC::function::pderivative ( unsigned  diff_param) const [protected]
std::vector< function_options > & GiNaC::function::registered_functions ( ) [static, protected]
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().

ex GiNaC::function::power ( const ex exp) const
unsigned GiNaC::function::register_new ( function_options const &  opt) [static]
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.


Friends And Related Function Documentation

friend class remember_table_entry [friend]

Definition at line 620 of file function.h.

void ginsh_get_ginac_functions ( ) [friend]

Member Data Documentation

unsigned GiNaC::function::current_serial = 0 [static]

This can be used as a hook for external applications.

Definition at line 686 of file function.h.

Referenced by eval(), evalf(), print(), and series().

unsigned GiNaC::function::serial [protected]

The documentation for this class was generated from the following files:

This page is part of the GiNaC developer's reference. It was generated automatically by doxygen. For an introduction, see the tutorial.