Rational
✖
Rational
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 allBasic Examples (1)Summary of the most common use cases
Scope (7)Survey of the scope of standard use cases
Enter a rational number with very big integers in the numerator and denominator:

https://wolfram.com/xid/0ftwdq0-cs2sr3

Rational numbers are represented with the smallest possible positive denominator:

https://wolfram.com/xid/0ftwdq0-hk90qs

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

https://wolfram.com/xid/0ftwdq0-mnsx3u

Enter a rational using the FullForm:

https://wolfram.com/xid/0ftwdq0-hqatym

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

https://wolfram.com/xid/0ftwdq0-fpote4

https://wolfram.com/xid/0ftwdq0-ieh23t

Part does not work:

https://wolfram.com/xid/0ftwdq0-ncd4ep


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

https://wolfram.com/xid/0ftwdq0-bmkazl

It cannot stand for a single integer:

https://wolfram.com/xid/0ftwdq0-lchct

A rule that replaces all rationals with their reciprocals:

https://wolfram.com/xid/0ftwdq0-qpscu

https://wolfram.com/xid/0ftwdq0-b3cxcx

An alternate way to write the rule:

https://wolfram.com/xid/0ftwdq0-5e47

Applications (1)Sample problems that can be solved with this function
Define a function that only applies to rational numbers:

https://wolfram.com/xid/0ftwdq0-ee8rml

https://wolfram.com/xid/0ftwdq0-bbrpgv

This is a close approximation to :

https://wolfram.com/xid/0ftwdq0-b9vkay

An alternative definition of the function:

https://wolfram.com/xid/0ftwdq0-c11cev

https://wolfram.com/xid/0ftwdq0-y8l48

Properties & Relations (5)Properties of the function, and connections to other functions

https://wolfram.com/xid/0ftwdq0-edzc7w

Rationals are atomic objects with no subexpressions:

https://wolfram.com/xid/0ftwdq0-f6kng6


https://wolfram.com/xid/0ftwdq0-fz7wo1

Denominator of a rational is positive:

https://wolfram.com/xid/0ftwdq0-c29mn5


https://wolfram.com/xid/0ftwdq0-c7eqv

Numerator and Denominator of a rational are relatively prime:

https://wolfram.com/xid/0ftwdq0-iwixp2

Use Rationals to indicate assumptions and domain conditions:

https://wolfram.com/xid/0ftwdq0-d41svw

Possible Issues (1)Common pitfalls and unexpected behavior
Numbers entered in the form n/m only become Rational numbers on evaluation:

https://wolfram.com/xid/0ftwdq0-e6i2pu

https://wolfram.com/xid/0ftwdq0-kwiwd


https://wolfram.com/xid/0ftwdq0-wgztn

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

https://wolfram.com/xid/0ftwdq0-clx3ea

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.
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.
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
Wolfram Language. (1988). Rational. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Rational.html
BibTeX
@misc{reference.wolfram_2025_rational, author="Wolfram Research", title="{Rational}", year="1988", howpublished="\url{https://reference.wolfram.com/language/ref/Rational.html}", note=[Accessed: 30-April-2025
]}
BibLaTeX
@online{reference.wolfram_2025_rational, organization={Wolfram Research}, title={Rational}, year={1988}, url={https://reference.wolfram.com/language/ref/Rational.html}, note=[Accessed: 30-April-2025
]}