PRODUCTS
Products Overview
Mathematica
Mathematica Student Edition
Mathematica Home Edition
Wolfram
CDF Player
(free download)
Computable Document Format (CDF)
web
Mathematica
grid
Mathematica
Wolfram
Workbench
Wolfram
SystemModeler
Wolfram
Finance Platform
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
Merchandise
SUPPORT
Support Overview
Mathematica
Documentation
Knowledge Base
Learning Center
Technical Services
Community & Forums
Training
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
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE
DOCUMENTATION CENTER
FOR THE LATEST INFORMATION.
DOCUMENTATION CENTER SEARCH
New to
Mathematica
?
Find your learning path
»
Mathematica
>
BUILT-IN MATHEMATICA SYMBOL
Numerical Functions
Tutorials »
|
N
Chop
Round
ContinuedFraction
Convergents
RootApproximant
LatticeReduce
FindSequenceFunction
See Also »
|
Continued Fractions & Rational Approximations
Number Recognition
Number Theory
More About »
Rationalize
Rationalize
[
x
]
converts an approximate number
x
to a nearby rational with small denominator.
Rationalize
yields the rational number with smallest denominator that lies within
dx
of
x
.
MORE INFORMATION
Rationalize
works with exact numbers
x
.
Rationalize
[
x
]
yields
x
unchanged if there no rational number close enough to
x
to satisfy the condition
, with
chosen to be
.
Rationalize
converts any
x
to rational form.
»
EXAMPLES
CLOSE ALL
Basic Examples
(1)
Convert to a rational number:
Convert to a rational number:
In[1]:=
Out[1]=
Scope
(5)
Find rational approximations to within a given tolerance:
Rationalize
works with exact numbers:
Rationalize all numbers in an expression:
No rational number is by default considered "close enough" to
N
[
Pi
]
:
Force a rational approximation to be found:
Applications
(3)
Successive rational approximations to
:
Plot the error in progressively better rational approximations to
:
Plot the error in progressively better approximations to
:
Create a polynomial with approximate numerical coefficients:
Find a rough approximation involving only rational numbers:
Factor the result:
Properties & Relations
(3)
If
Rationalize
returns a rational number
, then
:
When
Rationalize
[
x
]
returns
x
unchanged, there is no rational number satisfying this:
Get the rational approximations with smallest denominator error
dx
through machine precision:
The residual of the inequality is positive for all of these rational approximations:
SetPrecision
and
Rationalize
both give rational approximations for real
x
:
Rationalize
gives a rational that is equivalent to
x
up to the precision of
x
:
SetPrecision
gets a rational directly from the bitwise representation of
x
:
Rationalize
and
RootApproximant
both give exact quantities approximating real
x
:
RootApproximant
[
x
]
gives an algebraic number equivalent to
x
up to the precision of
x
:
Rationalize
gives a rational number equivalent to
x
up to the precision of
x
:
SEE ALSO
N
Chop
Round
ContinuedFraction
Convergents
RootApproximant
LatticeReduce
FindSequenceFunction
TUTORIALS
Numerical Functions
MORE ABOUT
Continued Fractions & Rational Approximations
Number Recognition
Number Theory
New in 1 | Last modified in 4