|
Initialization: Load the package and set the display of special functions in output to typeset mathematical notation (textbook notation):
|
Consider the AppellF2 function for some values of its parameters, for instance
Check the singularities of this function, that is the values of for which the underlying ODE has singularities
We see that the singularity closer to the origin is located at . So, we can generate a recurrence to evaluate this function in the interval . Assign the result to
Note also that, then the only parameter of the procedure returned is the recurrence index, this procedure always has a cache with the first coefficients - the higher coefficients depend on them - and there are four cached coefficients, because AppellF2 satisfies a fourth order linear ODE:
Since the higher coefficients only depend on the lower coefficients, the above means that all the coefficients of a series expansion around the origin can be expressed in terms of only these four hypergeometric functions.
When is a non-positive integer (nonposint), the procedure works recursively down until the lowest cached coefficients, caching each intermediate result. For example, the sixth coefficient is
Check the cache of
When the recurrence index is not a non-positive integer, the procedure returns unevaluated, just echoing the input
To have these coefficients numerically evaluated, for instance the lower order coefficients with hypergeometric functions with which the higher ones are constructed, apply evalf
Alternatively, if you pass the function F with floating-point arguments, evalf will automatically be applied each time you call the returned procedure. In these cases, to avoid a premature automatic evaluation of the function F itself in the presence of floating-point arguments, either use delay-evaluation quotes (see unevaluated) or use the InertForm of the function, %AppellF2. This is displayed as AppellF2 but in gray.
Check the cache of the - now all-numeric - coefficients
|
A routine for the numerical evaluation of the AppellF2 function
|
|
|
Provided that the evaluation point is within the radius of convergence of the series expansion, this approach can be used to produce a procedure to evaluate the AppellF2 function for arbitrary values of its parameters. For example, start with the general form of AppellF2
|
•
|
Generate now a recurrence-procedure to evaluate the coefficients (of a power series expansion around the origin) for generic values of the function's parameters, and make this procedure also be a function of the parameters of . Assign the result to
|
|
Check it out for some values of the parameters - recall that the first argument indicates the coefficient to be computed
|
|
This general procedure is used now to construct another procedure, following the steps indicated in Evalf:-Add, to numerically evaluate AppellF2 when the evaluation point is within the radius of convergence of the expansion. This is the sum form for AppellF2 using computed above
|
|
Construct with it a general formula that can be passed to Evalf:-Add
|
|
Use the extension mechanism of evalf to construct a numerical evaluation procedure as indicated in the help page of Evalf:-Add (recall the relevance of the use of `:-` in this step). Call this representation of AppellF2
|
|
Check whether the evaluation point, , is within the radius of convergence; i.e.: whether the distance between the origin and the singularity closer to the origin is larger than :
|
|
So is within the radius of convergence that is equal to 1. Hence this is the numerical evaluation of
|
|
Compare with the numerical evaluation of the Maple standard AppellF2 function
|
|
Finally, note that the general procedure that works with arbitrary values of the parameters of an AppellF2 function, has, for instance, in the denominator of each coefficient of the series expansion. These factors that could-be-zero in the denominator frequently indicate a special case, for which the general formula is not valid. To generate the recurrence procedure for these cases, pass the function with the special case applied. In this example that would be the function at
|
|
Generate a recurrence procedure for this special case, call it
|
|
Note that in this particular case of , the coefficients of order 0 to 3 all involve hypergeometric functions at
|
|
The recurrence in this case thus only exists if these four hypergeometric functions are convergent, which in turn will only happen if , and , so that if you passed values such that any of these condition is not met, for example , the recurrence cannot be constructed and GenerateRecurrence returns FAIL
|
|