constants.h
Go to the documentation of this file.
1 
7 #ifndef SYMENGINE_CONSTANTS_H
8 #define SYMENGINE_CONSTANTS_H
9 
10 #include <symengine/integer.h>
11 #include <symengine/symbol.h>
12 #include <symengine/infinity.h>
13 #include <symengine/nan.h>
14 
15 namespace SymEngine
16 {
17 
18 class Constant : public Basic
19 {
20 private:
23 
24 public:
25  IMPLEMENT_TYPEID(SYMENGINE_CONSTANT)
27  Constant(const std::string &name);
29  hash_t __hash__() const override;
34  bool __eq__(const Basic &o) const override;
39  int compare(const Basic &o) const override;
41  inline std::string get_name() const
42  {
43  return name_;
44  }
45 
46  vec_basic get_args() const override
47  {
48  return {};
49  }
50 };
51 
53 inline RCP<const Constant> constant(const std::string &name)
54 {
55  return make_rcp<const Constant>(name);
56 }
57 
58 // Constant Numbers
59 extern SYMENGINE_EXPORT RCP<const Integer> &zero;
60 extern SYMENGINE_EXPORT RCP<const Integer> &one;
61 extern SYMENGINE_EXPORT RCP<const Integer> &minus_one;
62 extern SYMENGINE_EXPORT RCP<const Integer> &two;
63 extern SYMENGINE_EXPORT RCP<const Number> &I;
64 
65 // Symbolic Constants
66 extern SYMENGINE_EXPORT RCP<const Constant> &pi;
67 extern SYMENGINE_EXPORT RCP<const Constant> &E;
68 extern SYMENGINE_EXPORT RCP<const Constant> &EulerGamma;
69 extern SYMENGINE_EXPORT RCP<const Constant> &Catalan;
70 extern SYMENGINE_EXPORT RCP<const Constant> &GoldenRatio;
71 
72 // Infinity
73 extern SYMENGINE_EXPORT RCP<const Infty> &Inf;
74 extern SYMENGINE_EXPORT RCP<const Infty> &NegInf;
75 extern SYMENGINE_EXPORT RCP<const Infty> &ComplexInf;
76 
77 // Not a Number
78 extern SYMENGINE_EXPORT RCP<const NaN> &Nan;
79 } // namespace SymEngine
80 
81 #endif
#define IMPLEMENT_TYPEID(SYMENGINE_ID)
Inline members and functions.
Definition: basic.h:340
The lowest unit of symbolic representation.
Definition: basic.h:97
hash_t __hash__() const override
Definition: constants.cpp:18
std::string name_
name of Constant
Definition: constants.h:22
Constant(const std::string &name)
Constant Constructor.
Definition: constants.cpp:15
int compare(const Basic &o) const override
Definition: constants.cpp:32
bool __eq__(const Basic &o) const override
Definition: constants.cpp:25
std::string get_name() const
Definition: constants.h:41
vec_basic get_args() const override
Returns the list of arguments.
Definition: constants.h:46
Main namespace for SymEngine package.
Definition: add.cpp:19
RCP< const Constant > constant(const std::string &name)
inline version to return Constant
Definition: constants.h:53