R: Set of Rational Numbers

Rationals {set6} | R Documentation

## Set of Rational Numbers

### Description

The mathematical set of rational numbers, defined as the set of numbers that can be written as a fraction of two integers. i.e.

p/q : p,q ε Z, q != 0

where Z is the set of integers.

### 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.

### Super classes

`set6::Set` -> `set6::Interval` -> `set6::SpecialSet` -> `Rationals`

### Methods

#### Public methods

- `Rationals$new()`

- `Rationals$contains()`

- `Rationals$isSubset()`

- `Rationals$equals()`

- `Rationals$clone()`

Inherited methods

- `set6::Set$add()`

- `set6::Set$multiplicity()`

- `set6::Set$print()`

- `set6::Set$remove()`

- `set6::Set$summary()`

- `set6::Interval$isSubinterval()`

- `set6::SpecialSet$strprint()`

#### Method `new()`

Create a new `Rationals` object.

##### Usage

    Rationals$new(lower = -Inf, upper = Inf, type = "()")

##### Arguments

`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.

##### Returns

A new `Rationals` object.

#### Method `contains()`

Method not possible for Rationals.

##### Usage

    Rationals$contains(...)

##### Arguments

`...`

  Ignored

#### Method `isSubset()`

Method not possible for Rationals.

##### Usage

    Rationals$isSubset(...)

##### Arguments

`...`

  Ignored

#### Method `equals()`

Method not possible for Rationals.

##### Usage

    Rationals$equals(...)

##### Arguments

`...`

  Ignored

#### Method `clone()`

The objects of this class are cloneable with this method.

##### Usage

    Rationals$clone(deep = FALSE)

##### Arguments

`deep`

  Whether to make a deep clone.

### See Also

Other special sets: `Complex`, `ExtendedReals`, `Integers`, `Logicals`, `Naturals`, `NegIntegers`, `NegRationals`, `NegReals`, `PosIntegers`, `PosNaturals`, `PosRationals`, `PosReals`, `Reals`, `Universal`

[Package set6 version 0.2.0 Index]