This Class defines a Continued Fraction. See Continued Fraction.
Continued fractions are an interesting way of defining irrational (or rational) numbers. There are two distinct types:
Finite
Value parameters
- cf
-
the ConFrac that defines this ContinuedFraction.
- infinite
-
whether this ContinuedFraction is infinite (defaults to true).
- markov
-
the Markov constant for this particular ContinuedFraction (defaults to Hurwitz, i.e. the square root of 5)
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Members list
Value members
Concrete methods
Method to prepend a pair to the start of a continued fraction.
Method to prepend a pair to the start of a continued fraction.
Value parameters
- p
-
the coefficient to prepend.
Attributes
- Returns
-
a new ContinuedFraction with x prepended.
Yield a finite ContinuedFraction from this by considering only a prefix of the coefficients.
Yield a finite ContinuedFraction from this by considering only a prefix of the coefficients.
Value parameters
- n
-
the number of coefficients (terms) to consider. If n = 0, we get the number 1, if n = 1, we get a sub 0. and so on.
Attributes
- Returns
-
a ContinuedFraction which is a prefix of this.
Method to approximate this ContinuedFraction according to the value of epsilon. The result should be close to the value of the represented irrational by less than 1/d/d/markov.
Method to approximate this ContinuedFraction according to the value of epsilon. The result should be close to the value of the represented irrational by less than 1/d/d/markov.
Value parameters
- epsilon
-
a small positive number.
Attributes
- Returns
-
an optional Double approximation to the value of the infinite series.
Method to yield a Rational from the first n elements of this ContinuedFraction.
Method to yield a Rational from the first n elements of this ContinuedFraction.
Value parameters
- n
-
the number of elements (coefficient pairs) to use in the evaluation.
Attributes
- Returns
-
a Rational.
Method to approximate this ContinuedFraction according to the value of epsilon. The result should be close to the value of the represented irrational by less than 1/d/d/markov.
Method to approximate this ContinuedFraction according to the value of epsilon. The result should be close to the value of the represented irrational by less than 1/d/d/markov.
Value parameters
- epsilon
-
a small positive number.
Attributes
- Returns
-
an optional Rational approximation to the value of the infinite series.
Inherited methods
An iterator over the names of all the elements of this product.
An iterator over the names of all the elements of this product.
Attributes
- Inherited from:
- Product
An iterator over all the elements of this product.
An iterator over all the elements of this product.
Attributes
- Returns
-
in the default implementation, an
Iterator[Any] - Inherited from:
- Product
Concrete fields
Method to get the coefficient pairs.
Method to get the coefficient pairs.
Attributes
- Returns
-
a LazyList of Pairs.
- See also
-
ConFrac#coefficients.
Method to get the convergents.
Method to get the convergents.
Attributes
- Returns
-
a LazyList of Rationals.
- See also
-
ConFrac#convergents.
Method to get the coefficients in reverse order, providing that this ContinuedFraction is not infinite.
Method to get the coefficients in reverse order, providing that this ContinuedFraction is not infinite.
NOTE: this is never currently used.
Attributes
- Returns
-
the coefficients in reverse order
- Note
-
Throws ConFracException if cf is infinite.
Returns a string representation of the object.
Returns a string representation of the object.
The default representation is platform dependent.
Attributes
- Returns
-
a string representation of the object.