Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Mathematics and Algorithms > Numerical Evaluation & Precision > Representation of Numbers >
Mathematica > Core Language > Expressions > Expression Structure > Atomic Elements of Expressions > Representation of Numbers >

Rational

Rational
is the head used for rational numbers.
  • 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.
Enter a rational number:
Rational is the Head for rational numbers:
Enter a rational number:
In[1]:=
Click for copyable input
Out[1]=
Rational is the Head for rational numbers:
In[2]:=
Click for copyable input
Out[2]=
Enter a rational number with very big integers in the numerator and denominator:
Rational numbers are represented with the smallest possible 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:
Define a function that only applies to rational numbers:
This is a close approximation to
:
An alternative definition of the function:
Rationals are numbers:
Rationals are atomic objects with no subexpressions:
Rationals are exact numbers:
Use Rationals to indicate assumptions and domain conditions:
Numbers entered in the form n/m only become Rational numbers on evaluation:
The unevaluated form is expressed in terms of Times and Power:
New in 1
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team