>
|
|
| (1) |
When writing numerical procedures, the expressions or mathematical functions to be numerically evaluated have special cases for integer values of their parameters. For example, consider the 2F1 hypergeometric series - its sum form can be seen using the FunctionAdvisor:
>
|
|
* Partial match of "sum" against topic "sum_form".
| |
| (2) |
In this definition we see a pochhammer function in the denominator, so when the parameter is a nonnegative integer, the sum will diverge when the summation index, , is bigger than the absolute value of , because in those cases pochhammer(c, _k1) will be equal to 0 in the denominator. In turn, when either of or are nonnegative integers, the pochhammer functions in the numerator will be zero at some point, truncating the series so that the 2F1 function is a polynomial. And when both things happen at the same time, the function will be a polynomial if the absolute value of or is smaller or equal to the absolute value of , and will be divergent (as in division by zero) otherwise.
The condition for divergence can thus be written using And, Or and Not as follows:
>
|
|
| (3) |
Thus, using Evalb, you can construct a numerical procedure that first checks for this divergent case, and only forwards the problem to hypergeom for numerical evaluation directly using the condition for divergence above:
>
|
|
| (4) |
Note the simplicity in which the condition got expressed and, due to using Evalb, this condition also works as expected with floating-point numbers. For example, the following input, where c = -3.0, interrupts with division by zero
>
|
|
while the following input, where forwards the problem to hypergeom where the computation is performed
>
|
|