Function Math Arithmetic Class

ContinuedFraction

"Evaluate Continued Fraction" Evaluates the continued fraction illustrated below.

Signature (Visual Basic / VBA)

Public Function ContinuedFraction( _
      ByVal vB As Variant _
    , ByVal vA As Variant _
    , ByVal vX As Variant _
    , ByVal vN As Variant _
    ) As Variant

Code Examples

    ContinuedFraction(2, 3, 4, 0) = 4
    ContinuedFraction(2, 3, 4, 1) = 2.75
    ContinuedFraction(2, 3, 4, 2) = 3.09090909090909
    ContinuedFraction(2, 3, 4, 3) = 2.97058823529412
    ContinuedFraction(2, 3, 4, 4) = 3.00990099009901
    ContinuedFraction(2, 3, 4, 5) = 2.99671052631579
    ContinuedFraction(2, 3, 4, 6) = 3.00109769484083
                  A
    B + ---------------------
                    A
         B + ---------------
                   ...
                      A
              B + ---------
                        A
                   B + ---
                        X

Parameters

Parameter Description
vN The number of divisions to perform within the continued fraction. vN defaults to 1 (one) if it is missing or Null or cannot be fixed up to a number. Function returns vX if vN is <= 0 (less than or equal to zero).

Notes & Version History

vB, vA, vX Numeric values which are substituted into the above expression then evaluated. Function returns Null if any of these values are Null or cannot be fixed up to numbers.