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

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

Compatibility

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