Class Rational¶
Defined in File rational.h
Inheritance Relationships¶
Base Type¶
public SymEngine::Number
(Class Number)
Class Documentation¶
-
class
SymEngine
::
Rational
: public SymEngine::Number¶ Rational Class.
Public Functions
-
Rational
(rational_class &&_i)¶ Constructor of Rational class.
-
bool
__eq__
(const Basic &o) const¶ Equality comparator
- Return
whether the 2 objects are equal
- Parameters
o
: - Object to be compared with
-
int
compare
(const Basic &o) const¶ Returns -1, 0, 1 for
this < o, this == o, this > o
. This method is used when you want to sort things likex+y+z
into canonical order. This function assumes thato
is the same type asthis
. Use__cmp__
if you want general comparison.
-
bool
is_canonical
(const rational_class &i) const¶ - Return
true if canonical
-
const rational_class &
as_rational_class
() const¶ Convert to
rational_class
.
-
bool
is_zero
() const¶ - Return
true
if0
-
bool
is_one
() const¶ - Return
true
if1
-
bool
is_minus_one
() const¶ - Return
true
if-1
-
bool
is_int
() const¶ - Return
true
if denominator is1
-
bool
is_positive
() const¶ - Return
true
if positive
-
bool
is_negative
() const¶ - Return
true
if negative
-
bool
is_complex
() const¶ - Return
false
-
bool
is_perfect_power
(bool is_expected = false) const¶
-
RCP<const Number>
addrat
(const Rational &other) const¶ Add Rationals
- Parameters
other
: of type Rational
-
RCP<const Number>
addrat
(const Integer &other) const¶ Add Rationals
- Parameters
other
: of type Integer
-
RCP<const Number>
subrat
(const Rational &other) const¶ Subtract Rationals
- Parameters
other
: of type Rational
-
RCP<const Number>
subrat
(const Integer &other) const¶ Subtract Rationals
- Parameters
other
: of type Integer
-
RCP<const Number>
mulrat
(const Rational &other) const¶ Multiply Rationals
- Parameters
other
: of type Rational
-
RCP<const Number>
mulrat
(const Integer &other) const¶ Multiply Rationals
- Parameters
other
: of type Integer
-
RCP<const Number>
divrat
(const Rational &other) const¶ Divide Rationals
- Parameters
other
: of type Rational
-
RCP<const Number>
divrat
(const Integer &other) const¶ Divide Rationals
- Parameters
other
: of type Integer
-
RCP<const Number>
powrat
(const Integer &other) const¶ Raise Rationals to power
other
- Parameters
other
: power to be raised
-
RCP<const Basic>
powrat
(const Rational &other) const¶ Raise *this to power
other
- Parameters
other
: exponent
-
RCP<const Basic>
rpowrat
(const Integer &other) const¶ Reverse powrat Raise ‘other’ to power *this
- Parameters
other
: base
-
RCP<const Number>
add
(const Number &other) const¶ Converts the param
other
appropriately and then callsaddrat
-
RCP<const Number>
sub
(const Number &other) const¶ Converts the param
other
appropriately and then callssubrat
-
RCP<const Number>
rsub
(const Number &other) const¶ Converts the param
other
appropriately and then callsrsubrat
-
RCP<const Number>
mul
(const Number &other) const¶ Converts the param
other
appropriately and then callsmulrat
-
RCP<const Number>
div
(const Number &other) const¶ Converts the param
other
appropriately and then callsdivrat
-
RCP<const Number>
rdiv
(const Number &other) const¶ Converts the param
other
appropriately and then callsrdivrat
Public Static Functions
-
RCP<const Number>
from_mpq
(const rational_class &i)¶
-
RCP<const Number>
from_mpq
(rational_class &&i)¶
-