Learn R Programming

set6 (version 0.1.1)

PosRationals: Set of Positive Rational Numbers

Description

The mathematical set of positive rational numbers, defined as the set of numbers that can be written as a fraction of two integers and are non-negative. i.e. $$\\{\frac{p}{q} \ : \ p,q \ \in \ Z, \ p/q \ge 0, \ q \ne 0\\}$$ where \(Z\) is the set of integers.

Value

An R6 object of class PosRationals.

Constructor

PosRationals$new(zero = FALSE)

Constructor Arguments

Argument Type Details
zero = FALSE logical If TRUE, zero is included in the set.

Constructor Details

Generally the ... argument should be ignored, its primary use-case is for the child-classes.

Public Fields

Field Link

class class elements elements length length lower lower upper upper max max min min range range properties properties traits traits type type

Public Methods

Interval Methods Link
isSubinterval(x, proper = FALSE, all = FALSE) isSubinterval

Comparison Methods Link contains(x, all = FALSE, bound = NULL) contains equals(x, all = FALSE) equals isSubset(x, proper = FALSE, all = FALSE) isSubset Representation Methods Link strprint(n = 2) strprint print(n = 2) print summary(n = 2) summary

Details

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.

See Also

listSpecialSets

Other SpecialSets: Complex, ExtendedReals, Integers, Naturals, NegIntegers, NegRationals, NegReals, PosIntegers, PosNaturals, PosReals, Rationals, Reals

Examples

Run this code
# NOT RUN {
PosRationals$new()
# }

Run the code above in your browser using DataLab