7 #ifndef SYMENGINE_NUMBER_H
8 #define SYMENGINE_NUMBER_H
11 #include <symengine/assumptions.h>
34 virtual RCP<const Basic>
conjugate()
const;
49 throw NotImplementedError(
"Not Implemented.");
53 virtual RCP<const Number>
add(
const Number &other)
const = 0;
55 virtual RCP<const Number>
sub(
const Number &other)
const;
56 virtual RCP<const Number> rsub(
const Number &other)
const;
58 virtual RCP<const Number>
mul(
const Number &other)
const = 0;
60 virtual RCP<const Number>
div(
const Number &other)
const;
61 virtual RCP<const Number> rdiv(
const Number &other)
const;
63 virtual RCP<const Number>
pow(
const Number &other)
const = 0;
64 virtual RCP<const Number> rpow(
const Number &other)
const = 0;
71 virtual bool is_perfect_power(
bool is_expected =
false)
const
73 throw NotImplementedError(
"Not Implemented.");
75 virtual bool nth_root(
const Ptr<RCP<const Number>> &,
unsigned long n)
const
77 throw NotImplementedError(
"Not Implemented.");
81 inline RCP<const Number>
addnum(
const RCP<const Number> &
self,
82 const RCP<const Number> &other)
84 return self->add(*other);
87 inline RCP<const Number>
subnum(
const RCP<const Number> &
self,
88 const RCP<const Number> &other)
90 return self->sub(*other);
93 inline RCP<const Number>
mulnum(
const RCP<const Number> &
self,
94 const RCP<const Number> &other)
96 return self->mul(*other);
99 inline RCP<const Number>
divnum(
const RCP<const Number> &
self,
100 const RCP<const Number> &other)
102 return self->div(*other);
105 inline RCP<const Number>
pownum(
const RCP<const Number> &
self,
106 const RCP<const Number> &other)
108 return self->pow(*other);
111 inline void iaddnum(
const Ptr<RCP<const Number>> &
self,
112 const RCP<const Number> &other)
114 *
self =
addnum(*
self, other);
117 inline void imulnum(
const Ptr<RCP<const Number>> &
self,
118 const RCP<const Number> &other)
120 *
self =
mulnum(*
self, other);
123 inline void idivnum(
const Ptr<RCP<const Number>> &
self,
124 const RCP<const Number> &other)
126 *
self =
divnum(*
self, other);
135 return b.get_type_code() <= SYMENGINE_NUMBER_WRAPPER;
141 return is_a_Number(b) and down_cast<const Number &>(b).is_zero();
152 tribool is_zero(
const Basic &b,
const Assumptions *assumptions =
nullptr);
161 tribool
is_nonzero(
const Basic &b,
const Assumptions *assumptions =
nullptr);
162 tribool is_positive(
const Basic &b,
const Assumptions *assumptions =
nullptr);
163 tribool is_nonpositive(
const Basic &b,
164 const Assumptions *assumptions =
nullptr);
165 tribool is_negative(
const Basic &b,
const Assumptions *assumptions =
nullptr);
166 tribool is_nonnegative(
const Basic &b,
167 const Assumptions *assumptions =
nullptr);
168 tribool is_integer(
const Basic &b,
const Assumptions *assumptions =
nullptr);
169 tribool is_real(
const Basic &b,
const Assumptions *assumptions =
nullptr);
170 tribool is_complex(
const Basic &b,
const Assumptions *assumptions =
nullptr);
171 tribool is_rational(
const Basic &b);
172 tribool is_irrational(
const Basic &b);
173 tribool is_finite(
const Basic &b,
const Assumptions *assumptions =
nullptr);
174 tribool is_infinite(
const Basic &b,
const Assumptions *assumptions =
nullptr);
175 tribool is_even(
const Basic &b,
const Assumptions *assumptions =
nullptr);
176 tribool is_odd(
const Basic &b,
const Assumptions *assumptions =
nullptr);
177 tribool is_algebraic(
const Basic &b,
const Assumptions *assumptions =
nullptr);
178 tribool is_transcendental(
const Basic &b,
179 const Assumptions *assumptions =
nullptr);
190 throw NotImplementedError(
"Not Implemented.");
192 virtual RCP<const Number> eval(
long bits)
const
194 throw NotImplementedError(
"Not Implemented.");
202 virtual RCP<const Basic> sin(
const Basic &)
const = 0;
203 virtual RCP<const Basic> cos(
const Basic &)
const = 0;
204 virtual RCP<const Basic> tan(
const Basic &)
const = 0;
205 virtual RCP<const Basic> cot(
const Basic &)
const = 0;
206 virtual RCP<const Basic> sec(
const Basic &)
const = 0;
207 virtual RCP<const Basic> csc(
const Basic &)
const = 0;
208 virtual RCP<const Basic> asin(
const Basic &)
const = 0;
209 virtual RCP<const Basic> acos(
const Basic &)
const = 0;
210 virtual RCP<const Basic> atan(
const Basic &)
const = 0;
211 virtual RCP<const Basic> acot(
const Basic &)
const = 0;
212 virtual RCP<const Basic> asec(
const Basic &)
const = 0;
213 virtual RCP<const Basic> acsc(
const Basic &)
const = 0;
214 virtual RCP<const Basic> sinh(
const Basic &)
const = 0;
215 virtual RCP<const Basic> csch(
const Basic &)
const = 0;
216 virtual RCP<const Basic> cosh(
const Basic &)
const = 0;
217 virtual RCP<const Basic> sech(
const Basic &)
const = 0;
218 virtual RCP<const Basic> tanh(
const Basic &)
const = 0;
219 virtual RCP<const Basic> coth(
const Basic &)
const = 0;
220 virtual RCP<const Basic> asinh(
const Basic &)
const = 0;
221 virtual RCP<const Basic> acsch(
const Basic &)
const = 0;
222 virtual RCP<const Basic> acosh(
const Basic &)
const = 0;
223 virtual RCP<const Basic> atanh(
const Basic &)
const = 0;
224 virtual RCP<const Basic> acoth(
const Basic &)
const = 0;
225 virtual RCP<const Basic> asech(
const Basic &)
const = 0;
226 virtual RCP<const Basic> log(
const Basic &)
const = 0;
227 virtual RCP<const Basic> gamma(
const Basic &)
const = 0;
228 virtual RCP<const Basic> abs(
const Basic &)
const = 0;
229 virtual RCP<const Basic> exp(
const Basic &)
const = 0;
230 virtual RCP<const Basic> floor(
const Basic &)
const = 0;
231 virtual RCP<const Basic> ceiling(
const Basic &)
const = 0;
232 virtual RCP<const Basic> truncate(
const Basic &)
const = 0;
233 virtual RCP<const Basic> erf(
const Basic &)
const = 0;
234 virtual RCP<const Basic> erfc(
const Basic &)
const = 0;
The base class for SymEngine.
#define IMPLEMENT_TYPEID(SYMENGINE_ID)
Inline members and functions.
The lowest unit of symbolic representation.
A class that will evaluate functions numerically.
virtual Evaluate & get_eval() const
Get Evaluate singleton to evaluate numerically.
virtual RCP< const Number > mul(const Number &other) const =0
Multiplication.
virtual bool is_one() const =0
virtual bool is_complex() const =0
virtual bool is_exact() const
return true if the number is an exact representation
virtual RCP< const Number > add(const Number &other) const =0
Addition.
virtual RCP< const Number > pow(const Number &other) const =0
Power.
virtual bool is_negative() const =0
bool is_exact_zero() const
virtual RCP< const Basic > conjugate() const
virtual bool is_positive() const =0
virtual RCP< const Number > div(const Number &other) const
Division.
virtual RCP< const Number > sub(const Number &other) const
Subtraction.
virtual bool is_zero() const =0
virtual bool is_minus_one() const =0
vec_basic get_args() const override
Returns the list of arguments.
Main namespace for SymEngine package.
bool is_a_Number(const Basic &b)
bool is_number_and_zero(const Basic &b)
RCP< const Number > mulnum(const RCP< const Number > &self, const RCP< const Number > &other)
Multiply self and other
RCP< const Number > pownum(const RCP< const Number > &self, const RCP< const Number > &other)
Raise self to power other
RCP< const Number > divnum(const RCP< const Number > &self, const RCP< const Number > &other)
Divide self and other
RCP< const Number > subnum(const RCP< const Number > &self, const RCP< const Number > &other)
Subtract self and other
tribool is_nonzero(const Basic &b, const Assumptions *assumptions=nullptr)
Check if a number is non-zero.
RCP< const Number > addnum(const RCP< const Number > &self, const RCP< const Number > &other)
Add self and other