|
Calling Sequence
|
|
GenerateRecurrence(F)
GenerateRecurrence(F, simplifier = ..., parameters = ...)
|
|
Parameters
|
|
F
|
-
|
any of the 4 Appell functions.
|
simplifier = ...
|
-
|
(optional) simplifier to be applied to the recurrence formula before constructing the procedure to be returned; default value is none
|
parameters = ...
|
-
|
(optional) list with parameters of type name, to be used as parameters of the procedure to be returned, in addition to the recurrence index ; default value is []
|
|
|
|
|
Description
|
|
•
|
The GenerateRecurrence command accepts one of the Appell functions and returns a procedure to compute the th coefficient of a power series expansion of the given function F around the origin as a function of the previous coefficients. The recurrence is derived from the linear ODE underlying the function by assuming the existence of a power series solution for it. This means that only the first coefficients (initial conditions of the ODE) involve mathematical functions - all the other ones only involve arithmetic operations involving the value of those first coefficients, thus resulting in an efficient way of numerically computing the value of the function.
|
•
|
Within the context of that linear ODE, the value of the last argument of F is always ignored, taken to be a symbol, say , and the linear ODE is constructed with as independent variable. To evaluate the function, the recurrence-procedure returned - say - is used to generate the coefficient of a power series in , as in .
|
•
|
Depending on the value of the function's parameters (for example if they imply on a singular function, or the hypergeometric functions entering the initial conditions of the recurrence are divergent) it is not possible to construct a recurrence. In these cases GenerateRecurrence returns FAIL.
|
•
|
This approach, which within the Evalf package is referred as the series/recurrence approach, is one of the main methods for numerically evaluating mathematical functions and expressions where one or both of the following situations happen:
|
a.
|
The underlying differential equation has singularities, as it is the case of most special functions of the mathematical language.
|
b.
|
There is no closed form series expansion formula known (e.g. the Heun functions).
|
•
|
The recurrence returned by GenerateRecurrence can effectively compute the value of the given function provided that the following conditions are met:
|
–
|
The evaluation point where the function is to be numerically evaluated (the last argument of F) is not a singularity of the linear ODE underlying the given function F. To see the location of these singularities, use the Evalf:-Singularities command.
|
–
|
The evaluation point is within the radius of convergence of an expansion around the origin, i.e.: the distance from the origin to is smaller than the distance from the origin to the singularity closer to it.
|
–
|
The recurrence depends on initial conditions, where is the order of the differential equation behind the function, that should be numerically computable by other means. These initial conditions are mainly the value of F and its first or also higher derivatives at the origin.
|
|
Generally speaking, when the recurrence can be used to evaluate a function at some (any) point , by using a sequence of concatenated Taylor series expansions (that in turn requires knowing the recurrence formula for an expansion around an arbitrary , that can also be derived from the underlying differential equation), the function can be computed over the whole complex plane.
|
•
|
When there are symbolic parameters (i.e.: not numbers) in the recurrence formula returned, it is frequently desired to simplify the result. For that purpose, use the option simplifier = ... where the right-hand side is the simplifier you want to be used. This simplification will be applied to the formula before constructing the procedure to be returned. Note however that this simplification is not applied to each coefficient each time the returned procedure is applied.
|
•
|
By default, the returned procedure is a function of the recursion index. If the given function F contains symbolic (i.e not a number) parameters, you may prefer to have the returned procedure being a function of these symbolic parameters as well. For that purpose, use the option parameters = [...], where the right-hand side is a list with the parameters to appear after the recursion index in the parameters of the returned procedure.
|
|
|
Examples
|
|
|
Initialization: Load the package and set the display of special functions in output to typeset mathematical notation (textbook notation):
|
>
|
|
| (1) |
Consider the AppellF2 function for some values of its parameters, for instance
>
|
|
| (2) |
Check the singularities of this function, that is the values of for which the underlying ODE has singularities
| (3) |
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
>
|
|
| (4) |
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:
| (5) |
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
| (7) |
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.
>
|
|
| (10) |
>
|
|
| (11) |
| (12) |
| (13) |
Check the cache of the - now all-numeric - coefficients
| (14) |
|
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
|
>
|
|
| (15) |
•
|
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
|
>
|
|
| (16) |
|
Check it out for some values of the parameters - recall that the first argument indicates the coefficient to be computed
|
>
|
|
>
|
|
| (18) |
|
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
|
>
|
|
| (19) |
>
|
|
| (20) |
|
Construct with it a general formula that can be passed to Evalf:-Add
|
>
|
|
| (21) |
|
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
|
>
|
|
| (22) |
|
So this is the function
|
>
|
|
| (23) |
|
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 :
|
>
|
|
| (24) |
|
So is within the radius of convergence that is equal to 1. Hence this is the numerical evaluation of
|
| (25) |
|
Compare with the numerical evaluation of the Maple standard AppellF2 function
|
>
|
|
| (26) |
| (27) |
|
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
|
>
|
|
| (28) |
|
Generate a recurrence procedure for this special case, call it
|
>
|
|
| (29) |
|
Note that in this particular case of , the coefficients of order 0 to 3 all involve hypergeometric functions at
|
>
|
|
>
|
|
| (31) |
>
|
|
| (32) |
>
|
|
| (33) |
|
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
|
>
|
|
|
|
|
Compatibility
|
|
•
|
The MathematicalFunctions[Evalf][GenerateRecurrence] command was introduced in Maple 2017.
|
|
|
|