PRODUCTS
Products Overview
Mathematica
Mathematica for Students
Mathematica Home Edition
Wolfram
CDF Player
(free download)
Computable Document Format (CDF)
web
Mathematica
grid
Mathematica
Wolfram
Workbench
Mathematica
Add-Ons
Wolfram|Alpha Products
SOLUTIONS
Solutions Overview
Engineering
Aerospace Engineering & Defense
Chemical Engineering
Control Systems
Electrical Engineering
Image Processing
Industrial Engineering
Materials Science
Mechanical Engineering
Operations Research
Optics
Petroleum Engineering
Biotechnology & Medicine
Bioinformatics
Medical Imaging
Finance, Statistics & Business Analysis
Actuarial Sciences
Data Analysis & Mining
Econometrics
Economics
Financial Engineering & Mathematics
Financial Risk Management
Statistics
Software Engineering & Content Delivery
Authoring & Publishing
Interface Development
Software Engineering
Web Development
Science
Astronomy
Biological Sciences
Chemistry
Environmental Sciences
Geosciences
Social & Behavioral Sciences
Design, Arts & Entertainment
Game Design, Special Effects & Generative Art
Education
STEM Education Initiative
Higher Education
Community & Technical College Education
Primary & Secondary Education
Students
Technology
Computable Document Format (CDF)
High-Performance & Parallel Computing (HPC)
See Also: Technology Guide
PURCHASE
Online Store
Other Ways to Buy
Volume & Site Licensing
Contact Sales
Software
Service
Upgrades
Training
Books
SUPPORT
Support Overview
Knowledge Base
Learning Center
Community & Forums
Training & Free Seminars
Does My Site Have a License?
Wolfram User Portal
COMPANY
About Wolfram Research
News & Events
Wolfram Blog
Partnerships
Employment Opportunities
History of
Mathematica
Stephen Wolfram's Home Page
Contact Us
OUR SITES
All Sites
Wolfram|Alpha
Demonstrations Project
MathWorld
Integrator
Wolfram Functions Site
Mathematica Journal
Wolfram Media
Wolfram
Tones
Wolfram Science
Stephen Wolfram
DOCUMENTATION CENTER SEARCH
New to
Mathematica
?
Find your learning path
»
Mathematica
>
Mathematics and Algorithms
>
Numerical Evaluation & Precision
>
Representation of Numbers
>
Rational
>
Mathematica
>
Core Language
>
Expressions
>
Expression Structure
>
Atomic Elements of Expressions
>
Representation of Numbers
>
Rational
>
BUILT-IN MATHEMATICA SYMBOL
Types of Numbers
Tutorials »
|
Rationals
Integer
Real
Numerator
Denominator
Rationalize
See Also »
|
Atomic Elements of Expressions
Representation of Numbers
More About »
Rational
Rational
is the head used for rational numbers.
MORE INFORMATION
You can enter a rational number in the form
.
The pattern object
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
CLOSE ALL
Basic Examples
(1)
Enter a rational number:
Rational
is the
Head
for rational numbers:
Enter a rational number:
In[1]:=
Out[1]=
Rational
is the
Head
for rational numbers:
In[2]:=
Out[2]=
Scope
(7)
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
:
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
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
(4)
Rationals are numbers:
Rationals are atomic objects with no subexpressions:
Rationals are exact numbers:
Use
Rationals
to indicate assumptions and domain conditions:
Possible Issues
(1)
Numbers entered in the form
only become
Rational
numbers on evaluation:
The unevaluated form is expressed in terms of
Times
and
Power
:
SEE ALSO
Rationals
Integer
Real
Numerator
Denominator
Rationalize
TUTORIALS
Types of Numbers
MORE ABOUT
Atomic Elements of Expressions
Representation of Numbers
New in 1