59constant::constant(
const std::string & initname,
evalffunctype efun,
const std::string & texname,
unsigned dm)
60 : name(initname), ef(efun), serial(next_serial++),
domain(dm)
70 : name(initname), ef(nullptr), number(initnumber), serial(next_serial++),
domain(dm)
88 if (
n.find_string(
"name", s)) {
96 throw (std::runtime_error(
"unknown constant '" + s +
"' in archive"));
98 throw (std::runtime_error(
"unnamed constant in archive"));
104 inherited::archive(
n);
105 n.add_string(
"name",
name);
121 c.s << std::string(level,
' ') <<
name <<
" (" << class_name() <<
")" <<
" @" <<
this
122 << std::hex <<
", hash=0x" <<
hashvalue <<
", flags=0x" <<
flags << std::dec
133 c.s << class_name() <<
"('" <<
name <<
"'";
148 return inherited::info(inf);
170 return conjugate_function(*this).hold();
177 return real_part_function(*this).hold();
184 return imag_part_function(*this).hold();
218 const void* typeid_this = (
const void*)
typeid(*this).name();
Archiving of GiNaC expressions.
#define GINAC_ASSERT(X)
Assertion macro for checking invariances.
This class stores all properties needed to record/retrieve the state of one object of class basic (or...
This class is the ABC (abstract base class) of GiNaC's class hierarchy.
const basic & setflag(unsigned f) const
Set some status_flags.
unsigned hashvalue
hash value
unsigned flags
of type status_flags
virtual int compare_same_type(const basic &other) const
Returns order relation between two objects of same type.
This class holds constants, symbols with specific numerical value.
ex number
numerical value this constant evalf()s to
ex evalf() const override
Evaluate object numerically.
std::string name
printname of this constant
void read_archive(const archive_node &n, lst &syms) override
Load (deserialize) the object from an archive node.
unsigned serial
unique serial number for comparison
void do_print_latex(const print_latex &c, unsigned level) const
bool is_equal_same_type(const basic &other) const override
Returns true if two objects of same type are equal.
void archive(archive_node &n) const override
Save (serialize) the object into archive node.
void do_print(const print_context &c, unsigned level) const
std::string TeX_name
LaTeX name.
bool info(unsigned inf) const override
Information about the object.
ex real_part() const override
static unsigned next_serial
ex derivative(const symbol &s) const override
Implementation of ex::diff() for a constant always returns 0.
void do_print_python_repr(const print_python_repr &c, unsigned level) const
void do_print_tree(const print_tree &c, unsigned level) const
unsigned calchash() const override
Compute the hash value of an object and if it makes sense to store it in the objects status_flags,...
constant(const std::string &initname, evalffunctype efun=nullptr, const std::string &texname=std::string(), unsigned domain=domain::complex)
bool is_polynomial(const ex &var) const override
Check whether this is a polynomial in the given variables.
ex conjugate() const override
ex imag_part() const override
Wrapper template for making GiNaC classes out of STL containers.
Lightweight wrapper for GiNaC's symbolic objects.
This class is a wrapper around CLN-numbers within the GiNaC class hierarchy.
Base class for print_contexts.
Context for latex-parsable output.
Context for python-parsable output.
Context for tree-like output for debugging.
@ expanded
.expand(0) has already done its job (other expand() options ignore this flag)
@ evaluated
.eval() has already done its job
@ hash_calculated
.calchash() has already done its job
Interface to GiNaC's constant types and some special constants.
Interface to GiNaC's light-weight expression handles.
Interface to GiNaC's initially known functions.
unsigned golden_ratio_hash(uintptr_t n)
Truncated multiplication with golden ratio, for computing hash values.
const constant Euler("Euler", EulerEvalf, "\\gamma_E", domain::positive)
Euler's constant.
ex EulerEvalf()
Floating point evaluation of Euler's constant gamma.
ex PiEvalf()
Floating point evaluation of Archimedes' constant Pi.
const constant Pi("Pi", PiEvalf, "\\pi", domain::positive)
Pi.
print_func< print_context >(&varidx::do_print). print_func< print_latex >(&varidx
GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(add, expairseq, print_func< print_context >(&add::do_print). print_func< print_latex >(&add::do_print_latex). print_func< print_csrc >(&add::do_print_csrc). print_func< print_tree >(&add::do_print_tree). print_func< print_python_repr >(&add::do_print_python_repr)) add
const constant Catalan("Catalan", CatalanEvalf, "G", domain::positive)
Catalan's constant.
ex CatalanEvalf()
Floating point evaluation of Catalan's constant.
GINAC_IMPLEMENT_REGISTERED_CLASS_OPT_T(lst, basic, print_func< print_context >(&lst::do_print). print_func< print_tree >(&lst::do_print_tree)) template<> bool lst GINAC_BIND_UNARCHIVER(lst)
Specialization of container::info() for lst.
Makes the interface to the underlying bignum package available.
Interface to several small and furry utilities needed within GiNaC but not of any interest to the use...