11 : name_{name} {SYMENGINE_ASSIGN_TYPEID()}
15 hash_t seed = SYMENGINE_CONSTANT;
16 hash_combine<std::string>(seed,
name_);
22 if (is_a<Constant>(o))
23 return name_ == down_cast<const Constant &>(o).name_;
29 SYMENGINE_ASSERT(is_a<Constant>(o))
30 const Constant &s = down_cast<const Constant &>(o);
36 #define DEFINE_CONSTANT(t, n, d) \
37 RCP<const t> n = []() { \
38 static const RCP<const t> c = d; \
59 DEFINE_CONSTANT(
NaN, Nan, make_rcp<NaN>());
68 RCP<const Basic> sqrt_(
const RCP<const Basic> &arg)
70 return pow(arg,
div(one, i2));
74 DEFINE_CONSTANT(Basic, i3,
integer(3));
75 DEFINE_CONSTANT(Basic, i5,
integer(5));
76 DEFINE_CONSTANT(Basic, im2,
integer(-2));
77 DEFINE_CONSTANT(Basic, im3,
integer(-3));
78 DEFINE_CONSTANT(Basic, im5,
integer(-5));
80 DEFINE_CONSTANT(Basic, sq3, sqrt_(i3));
81 DEFINE_CONSTANT(Basic, sq2, sqrt_(i2));
82 DEFINE_CONSTANT(Basic, sq5, sqrt_(i5));
84 DEFINE_CONSTANT(Basic, C0,
div(
sub(sq3, one),
mul(i2, sq2)));
85 DEFINE_CONSTANT(Basic, C1,
div(one, i2));
86 DEFINE_CONSTANT(Basic, C2,
div(sq2, i2));
87 DEFINE_CONSTANT(Basic, C3,
div(sq3, i2));
88 DEFINE_CONSTANT(Basic, C4,
div(
add(sq3, one),
mul(i2, sq2)));
89 DEFINE_CONSTANT(Basic, C5,
div(sqrt_(
sub(i5, sqrt_(i5))),
integer(8)));
90 DEFINE_CONSTANT(Basic, C6,
div(
sub(sqrt_(i5), one),
integer(4)));
92 DEFINE_CONSTANT(Basic, mC0,
mul(minus_one, C0));
93 DEFINE_CONSTANT(Basic, mC1,
mul(minus_one, C1));
94 DEFINE_CONSTANT(Basic, mC2,
mul(minus_one, C2));
95 DEFINE_CONSTANT(Basic, mC3,
mul(minus_one, C3));
96 DEFINE_CONSTANT(Basic, mC4,
mul(minus_one, C4));
97 DEFINE_CONSTANT(Basic, mC5,
mul(minus_one, C5));
98 DEFINE_CONSTANT(Basic, mC6,
mul(minus_one, C6));
100 #undef DEFINE_CONSTANT
Classes and functions relating to the binary operation of addition.
The lowest unit of symbolic representation.
static RCP< const Number > from_two_nums(const Number &re, const Number &im)
hash_t __hash__() const override
std::string name_
name of Constant
Constant(const std::string &name)
Constant Constructor.
int compare(const Basic &o) const override
bool __eq__(const Basic &o) const override
static RCP< const Infty > from_int(const int val)
Constructs Infty using sign of val
Main namespace for SymEngine package.
RCP< const Basic > div(const RCP< const Basic > &a, const RCP< const Basic > &b)
Division.
std::enable_if< std::is_integral< T >::value, RCP< const Integer > >::type integer(T i)
RCP< const Basic > sub(const RCP< const Basic > &a, const RCP< const Basic > &b)
Substracts b from a.
RCP< const Basic > mul(const RCP< const Basic > &a, const RCP< const Basic > &b)
Multiplication.
RCP< const Basic > add(const RCP< const Basic > &a, const RCP< const Basic > &b)
Adds two objects (safely).
RCP< const Constant > constant(const std::string &name)
inline version to return Constant