pow.h
Go to the documentation of this file.
1 
6 #ifndef SYMENGINE_POW_H
7 #define SYMENGINE_POW_H
8 
9 #include <symengine/functions.h>
10 #include <symengine/mul.h>
11 #include <symengine/ntheory.h>
12 #include <symengine/constants.h>
13 
14 namespace SymEngine
15 {
16 
17 class Pow : public Basic
18 {
19 private:
20  RCP<const Basic> base_, exp_;
21 
22 public:
23  IMPLEMENT_TYPEID(SYMENGINE_POW)
25  Pow(const RCP<const Basic> &base, const RCP<const Basic> &exp);
27  hash_t __hash__() const override;
32  bool __eq__(const Basic &o) const override;
33  int compare(const Basic &o) const override;
35  bool is_canonical(const Basic &base, const Basic &exp) const;
37  inline RCP<const Basic> get_base() const
38  {
39  return base_;
40  }
42  inline RCP<const Basic> get_exp() const
43  {
44  return exp_;
45  }
46 
47  vec_basic get_args() const override;
48 };
49 
51 RCP<const Basic> pow(const RCP<const Basic> &a, const RCP<const Basic> &b);
52 
54 RCP<const Basic> exp(const RCP<const Basic> &x);
55 
56 void multinomial_coefficients(unsigned m, unsigned n, map_vec_uint &r);
57 void multinomial_coefficients_mpz(unsigned m, unsigned n, map_vec_mpz &r);
59 RCP<const Basic> pow_expand(const RCP<const Pow> &self);
61 inline RCP<const Basic> sqrt(const RCP<const Basic> &x)
62 {
63  return pow(x, div(one, integer(2)));
64 }
66 inline RCP<const Basic> cbrt(const RCP<const Basic> &x)
67 {
68  return pow(x, div(one, integer(3)));
69 }
70 
71 } // namespace SymEngine
72 
73 #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: pow.cpp:64
Pow(const RCP< const Basic > &base, const RCP< const Basic > &exp)
Pow Constructor.
Definition: pow.cpp:10
bool __eq__(const Basic &o) const override
Definition: pow.cpp:72
vec_basic get_args() const override
Returns the list of arguments.
Definition: pow.cpp:266
RCP< const Basic > get_exp() const
Definition: pow.h:42
RCP< const Basic > get_base() const
Definition: pow.h:37
bool is_canonical(const Basic &base, const Basic &exp) const
Definition: pow.cpp:17
int compare(const Basic &o) const override
Definition: pow.cpp:81
Main namespace for SymEngine package.
Definition: add.cpp:19
RCP< const Basic > div(const RCP< const Basic > &a, const RCP< const Basic > &b)
Division.
Definition: mul.cpp:431
std::enable_if< std::is_integral< T >::value, RCP< const Integer > >::type integer(T i)
Definition: integer.h:197
RCP< const Basic > pow_expand(const RCP< const Pow > &self)
Expand the power expression.
RCP< const Basic > exp(const RCP< const Basic > &x)
Returns the natural exponential function E**x = pow(E, x)
Definition: pow.cpp:271