ContFrac
ContFrac(number, steps=5)
Continued fraction from number with maximal length steps
Example:
ContFrac(pi, 3)
returns
ContFrac(3, 7, 15)
.
This represent the number 3 + 1/(7 + 1/15).
Overview:
ContFrac (number, steps=5)
Operator | Meaning |
str(x) |
Method | Meaning |
toRational (n=0) | Rational number defined by the first n list elements |
Constructor
Usage: ContFrac(number, steps=5)
Object representation as string
Usage: str(x)
Description:
toRational(n=0)
Usage: self.toRational(n=0)
Description:
Rational number defined by the first n list elements
Converts the continued fraction int a rational number.
Example:
ContFrac(pi).toRational(2)
returns 22/7.