The ContinuedFraction class required that an implementation provide a and b coefficients of the form:

 *              b1
 * a0 + ------------------
 *      a1 +      b2
 *           -------------
 *           a2 +    b3
 *                --------
 *                a3 + ...

I added this form to the class javadoc to clarify usage. This form is the opposite of the form used by the linked resource on Wolfram [1] and the original paper that is the source of the method.

It is the same order as defined for the formula on Wikipedia [2].

The choice of a and b is point of contention described on wolfram [3] when discussing a simple continued fraction where all a are 1:

"In contexts where only simple continued fractions are considered, the partial denominators are often denoted [a0, a1, a2, ...] instead of [b0; b1, b2, ...] (e.g., Rockett and Szüsz 1992, p. 3), a practice which unfortunately conflicts with the common notation for generalized continued fractions in which a_n denotes a partial numerator."

This file has been ported from Commons Math where the implementation is the same. If we re-arrange the definition of a and b to match the link from wolfram, the original paper and wolfram's stated common notation for a continued fraction then a user upgrading from Commons Math will have to transpose all their function logic.

The simpler action is to drop the link to Wolfram and use the Wikipedia link, or be very specific in the javadoc about the form expected. A note can be added to the code to indicate that the definition of a and b have been reversed from the original paper.

1. Maintain functional compatibility with Commons Math
2. Change for notation compatibility with the original paper

Opinions on which action?

Alex

[1] https://mathworld.wolfram.com/ContinuedFraction.html

[2] https://en.wikipedia.org/wiki/Continued_fraction#Basic_formula

[3] https://mathworld.wolfram.com/SimpleContinuedFraction.html


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to