pyoculus 0.1.1
Loading...
Searching...
No Matches
pyoculus.irrationals.continued_fraction Namespace Reference

Functions

 expandcf (irrational, n, thres_ai=1000)
 Expand an (positive) irrational using the continued fraction expansion.
 
 fromcf (ai)
 Obtain the fraction pp/qq of the continued fraction ai.
 

Function Documentation

◆ expandcf()

pyoculus.irrationals.continued_fraction.expandcf ( irrational,
n,
thres_ai = 1000 )

Expand an (positive) irrational using the continued fraction expansion.

Parameters
irrational– the positive irrational number to expand. an absolute will be taken if negative
n– the number of terms
thres_ai=1000– terminate the expansion if some ai>thres_ai
aninteger sequence contains the continued fraction expansion of irrational up to the nth term

◆ fromcf()

pyoculus.irrationals.continued_fraction.fromcf ( ai)

Obtain the fraction pp/qq of the continued fraction ai.

Parameters
aian integer array contains ai for the continued fraction expansion
Returns
(pp, qq), the fraction (pp/qq)