Rational

Rational

is the head used for rational numbers.

Details

  • You can enter a rational number in the form n/m.
  • The pattern object _Rational can be used to stand for a rational number. It cannot stand for a single integer.
  • You have to use Numerator and Denominator to extract parts of Rational numbers.

Examples

open allclose all

Basic Examples  (1)

Enter a rational number:

Rational is the Head for rational numbers:

Scope  (7)

Enter a rational number with very big integers in the numerator and denominator:

Rational numbers are represented with the smallest possible positive denominator:

The FullForm of a rational number is Rational[numerator,denominator]:

Enter a rational using the FullForm:

You have to use Numerator and Denominator to extract parts of Rational numbers:

Part does not work:

The pattern object _Rational can be used to stand for a rational number:

It cannot stand for a single integer:

A rule that replaces all rationals with their reciprocals:

An alternate way to write the rule:

Applications  (1)

Define a function that only applies to rational numbers:

This is a close approximation to :

An alternative definition of the function:

Properties & Relations  (5)

Rationals are numbers:

Rationals are atomic objects with no subexpressions:

Rationals are exact numbers:

Denominator of a rational is positive:

Numerator and Denominator of a rational are relatively prime:

Use Rationals to indicate assumptions and domain conditions:

Possible Issues  (1)

Numbers entered in the form n/m only become Rational numbers on evaluation:

The unevaluated form is expressed in terms of Times and Power:

Wolfram Research (1988), Rational, Wolfram Language function, https://reference.wolfram.com/language/ref/Rational.html.

Text

Wolfram Research (1988), Rational, Wolfram Language function, https://reference.wolfram.com/language/ref/Rational.html.

CMS

Wolfram Language. 1988. "Rational." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Rational.html.

APA

Wolfram Language. (1988). Rational. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Rational.html

BibTeX

@misc{reference.wolfram_2023_rational, author="Wolfram Research", title="{Rational}", year="1988", howpublished="\url{https://reference.wolfram.com/language/ref/Rational.html}", note=[Accessed: 19-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_rational, organization={Wolfram Research}, title={Rational}, year={1988}, url={https://reference.wolfram.com/language/ref/Rational.html}, note=[Accessed: 19-March-2024 ]}