The mathematical set of rational numbers, defined as the set of numbers that can be written as a fraction of two integers. i.e. $$\\{\frac{p}{q} \ : \ p,q \ \in \ Z, \ q \ne 0 \\}$$ where \(Z\) is the set of integers.
The $contains
method does not work for the set of Rationals as it is notoriously
difficult/impossible to find an algorithm for determining if any given number is rational or not.
Furthermore, computers must truncate all irrational numbers to rational numbers.
Other special sets:
Complex
,
ExtendedReals
,
Integers
,
Logicals
,
Naturals
,
NegIntegers
,
NegRationals
,
NegReals
,
PosIntegers
,
PosNaturals
,
PosRationals
,
PosReals
,
Reals
,
Universal
set6::Set
-> set6::Interval
-> set6::SpecialSet
-> Rationals
new()
Create a new Rationals
object.
Rationals$new(lower = -Inf, upper = Inf, type = "()")
lower
numeric. Where to start the set. Advised to ignore, used by child-classes.
upper
numeric. Where to end the set. Advised to ignore, used by child-classes.
type
character Set closure type. Advised to ignore, used by child-classes.
A new Rationals
object.
contains()
Method not possible for Rationals.
Rationals$contains(...)
...
Ignored
isSubset()
Method not possible for Rationals.
Rationals$isSubset(...)
...
Ignored
equals()
Method not possible for Rationals.
Rationals$equals(...)
...
Ignored
clone()
The objects of this class are cloneable with this method.
Rationals$clone(deep = FALSE)
deep
Whether to make a deep clone.