NumberTheory - Maple Programming Help

Home : Support : Online Help : Mathematics : Number Theory : NumberTheory/SimplestRational

NumberTheory

 SimplestRational
 compute the simplest rational number in a real interval

 Calling Sequence SimplestRational( a, b )

Parameters

 a, b - realcons; real numbers with $a

Description

 • The SimplestRational( a, b ) command computes the "simplest" rational number $\frac{p}{q}$ such that $a\le \frac{p}{q}$ and $\frac{p}{q}\le b$.  It is "simplest" in the sense that $p$ and $q$ are as small as possible.  (Note that an integer is considered to be "simpler" than a non-integral rational.)
 • If Maple is able to determine that $b\le a$, then an exception is raised.

Examples

 > with( NumberTheory ):
 > SimplestRational( 1/2, 3/4 );
 $\frac{{1}}{{2}}$ (1)
 > SimplestRational( 1/2, 4/3 );
 ${1}$ (2)
 > SimplestRational( Pi, Pi + Pi^(-10) );
 $\frac{{355}}{{113}}$ (3)
 > SimplestRational( 9/10, 15/2 );
 ${1}$ (4)
 > SimplestRational( sqrt( 1000 ), sqrt( 1001 ) );
 $\frac{{253}}{{8}}$ (5)
 > SimplestRational( Pi, gamma );

Compatibility

 • The NumberTheory[SimplestRational] command was introduced in Maple 2017.