Function getConvergents

  • Calculate best rational approximations to a given fraction that are closer than any approximation with a smaller or equal denominator unless non-monotonic approximations are requested as well.

    Parameters

    • value: FractionValue

      The fraction to simplify.

    • Optional maxDenominator: number

      Maximum denominator to include.

    • Optional maxLength: number

      Maximum length of the array of approximations.

    • includeSemiconvergents: boolean = false

      Include semiconvergents.

    • includeNonMonotonic: boolean = false

      Include non-monotonically improving approximations.

    Returns Fraction[]

    An array of (semi)convergents.