GenerateRecurrence - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


MathematicalFunctions[Evalf]

  

GenerateRecurrence

  

return a procedure to compute the nth coefficient of a power series expansion of the given function (one of the four Appell functions) around the origin

 

Calling Sequence

Parameters

Description

Examples

Compatibility

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 i; default value is []

Description

• 

The GenerateRecurrence command accepts one of the Appell functions and returns a procedure to compute the nth coefficient of a power series expansion of the given function F around the origin as a function of the n1 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 z, and the linear ODE is constructed with z as independent variable. To evaluate the function, the recurrence-procedure returned - say u- is used to generate the coefficient of a power series in z, as in n=0unzn.

• 

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 z 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 z is within the radius of convergence of an expansion around the origin, i.e.: the distance from the origin to z is smaller than the distance from the origin to the singularity closer to it.

– 

The recurrence depends on N initial conditions, Nd where d 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 z0, by using a sequence of concatenated Taylor series expansions (that in turn requires knowing the recurrence formula for an expansion around an arbitrary z0, 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):

withMathematicalFunctions:-Evalf;Typesetting:-EnableTypesetRuleTypesetting:-SpecialFunctionRules:

Add,Evalb,Zoom,QuadrantNumbers,Singularities,GenerateRecurrence,PairwiseSummation

(1)

Consider the AppellF2 function for some values of its parameters, for instance

F2AppellF21,2,3,4,5,6,z2

F2F21,2,3,4,5,6,z2

(2)

Check the singularities of this function, that is the values of z2 for which the underlying ODE has singularities

SingularitiesF2

0,1,−5,+I

(3)

We see that the singularity closer to the origin is located at z2=1. So, we can generate a recurrence to evaluate this function in the interval 0z2 <1. Assign the result to u

uGenerateRecurrenceF2

uprocioptionhfloat&comma;cache&semi;ifi::nonnegint&comma;4&sol;5&ast;i&Hat;24&ast;thisproci1&sol;i&plus;4&ast;i&plus;1&sol;5&ast;i&Hat;3i&Hat;210&ast;i8&ast;thisproci2&sol;i&ast;i&plus;4&ast;i&plus;3&comma;&apos;procnameargs&apos;end proc

(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:

op4&comma;evalu

Cache512&comma;permanent=0=F121,2;4;6&comma;1=3F122,2;4;65&comma;2=2F122,3;4;65&comma;3=2F012;;67

(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 n 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

u6

188F012;;69375

(6)

Check the cache of u

op4&comma;evalu

Cache512&comma;temporary=4=3F012;;635&comma;5=29F012;;6750&comma;6=188F012;;69375&comma;permanent=0=F121,2;4;6&comma;1=3F122,2;4;65&comma;2=2F122,3;4;65&comma;3=2F012;;67

(7)

When the recurrence index is not a non-positive integer, the procedure u returns unevaluated, just echoing the input

un

un

(8)

To have these coefficients numerically evaluated, for instance the lower order coefficients with hypergeometric functions with which the higher ones are constructed, apply evalf

evalf

0.0008021333332

(9)

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.

IF2%AppellF21.0&comma;2.0&comma;3.0&comma;4.0&comma;5.0&comma;6.0&comma;z__2

IF2F21.0&comma;2.0&comma;3.0&comma;4.0&comma;5.0&comma;6.0&comma;z__2

(10)

uGenerateRecurrenceIF2

uprocioptionhfloat&comma;cache&semi;ifi::nonnegint&comma;0.8&ast;i&Hat;23.2&ast;thisproci1&sol;i&plus;4.&ast;i&plus;0.2&ast;i&Hat;30.2&ast;i&Hat;22.&ast;i1.6&ast;thisproci2&sol;i&ast;i&Hat;2&plus;7.&ast;i&plus;12.&comma;&apos;procnameargs&apos;end proc

(11)

u0

−0.55686637670.4363323130I

(12)

u6

0.0008021333335+0.I

(13)

Check the cache of the - now all-numeric - coefficients

op4&comma;evalu

Cache512&comma;temporary=4=0.003428571429+0.I&comma;5=0.001546666667+0.I&comma;6=0.0008021333335+0.I&comma;permanent=0=−0.55686637670.4363323130I&comma;1=−0.09270413916+0.2094395102I&comma;2=0.04454931012+0.03490658504I&comma;3=0.01142857143

(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

F2AppellF2a&comma;b1&comma;b2&comma;c1&comma;c2&comma;z1&comma;z2

F2F2a&comma;b1&comma;b2&comma;c1&comma;c2&comma;z1&comma;z2

(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 F2. Assign the result to U

UGenerateRecurrenceF2&comma;parameters=opF2

Uproci&comma;a&comma;b1&comma;b2&comma;c1&comma;c2&comma;z1&comma;z2optioncache&semi;ifi::nonnegint&comma;ifi<4&comma;T&lsqb;i&rsqb;i&comma;a&comma;b1&comma;b2&comma;c1&comma;c2&comma;z1&comma;z2&comma;i&plus;b21&ast;a&plus;ib11&ast;z12&ast;a2&ast;i&plus;c1&plus;2&ast;thisproci1&comma;a&comma;b1&comma;b2&comma;c1&comma;c2&comma;z1&comma;z2&sol;z11&ast;i&plus;c21&ast;i&plus;i&plus;b21&ast;i&plus;b22&ast;a&plus;i2&ast;a&plus;ic11&ast;thisproci2&comma;a&comma;b1&comma;b2&comma;c1&comma;c2&comma;z1&comma;z2&sol;i&ast;i1&ast;i&plus;c21&ast;i&plus;c22&ast;z11&comma;&apos;procnameargs&apos;end proc

(16)
  

Check it out for some values of the parameters a,b1,b2,c1,c2,z1,z2 - recall that the first argument indicates the coefficient to be computed

U0&comma;1&comma;12&comma;13&comma;14&comma;15&comma;16&comma;17

F1212,1;14;16

(17)

U5&comma;7&comma;6&comma;5&comma;4&comma;3&comma;2&comma;14

16884F126,10;4;256048F126,9;4;25

(18)
  

This general procedure U is used now to construct another procedure, following the steps indicated in Evalf:-Add, to numerically evaluate AppellF2 when the evaluation point z2 is within the radius of convergence of the expansion. This is the sum form for AppellF2 using U computed above

F2=n=0Un&comma;opF2z2n

F2a&comma;b1&comma;b2&comma;c1&comma;c2&comma;z1&comma;z2=n=0Un&comma;a&comma;b1&comma;b2&comma;c1&comma;c2&comma;z1&comma;z2z2n

(19)
  

Get the summand

summandop1&comma;rhs

summandUn&comma;a&comma;b1&comma;b2&comma;c1&comma;c2&comma;z1&comma;z2z2n

(20)
  

Construct with it a general formula that can be passed to Evalf:-Add

general_formulaunapplysummand&comma;n

general_formulanUn&comma;a&comma;b1&comma;b2&comma;c1&comma;c2&comma;z1&comma;z2z2n

(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 AF2 this representation of AppellF2

`evalf/AF2`a&comma;b1&comma;b2&comma;c1&comma;c2&comma;z1&comma;z2&rarr;Addsubs:-a&equals;a&comma;:-b1&equals;b1&comma;:-b2&equals;b2&comma;:-c1&equals;c1&comma;:-c2&equals;c2&comma;:-z1&equals;z1&comma;:-z2&equals;z2&comma;evalgeneral_formula

evalf/AF2a&comma;b1&comma;b2&comma;c1&comma;c2&comma;z1&comma;z2Addsubs:−a=a&comma;:−b1=b1&comma;:−b2=b2&comma;:−c1=c1&comma;:−c2=c2&comma;:−z1=z1&comma;:−z2=z2&comma;evalgeneral_formula

(22)
  

So this is the AF2 function

AF21&comma;2&comma;3&comma;4&comma;5&comma;6&comma;12

AF21&comma;2&comma;3&comma;4&comma;5&comma;6&comma;12

(23)
  

Check whether the evaluation point, z2=12, is within the radius of convergence; i.e.: whether the distance between the origin and the singularity closer to the origin is larger than 12:

SingularitiessubsAF2=AppellF2&comma;

0&comma;1&comma;−5&comma;+I

(24)
  

So 12 is within the radius of convergence that is equal to 1. Hence this is the numerical evaluation of AF21&comma;2&comma;3&comma;4&comma;5&comma;6&comma;12

evalf

−0.59037211370.3228859116I

(25)
  

Compare with the numerical evaluation of the Maple standard AppellF2 function

subsAF2=AppellF2&comma;

F21&comma;2&comma;3&comma;4&comma;5&comma;6&comma;12

(26)

evalf

−0.59037211370.3228859116I

(27)
  

Finally, note that the general procedure U that works with arbitrary values of the parameters of an AppellF2 function, has, for instance, z11 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 z1=1

F2z1  %AppellF2a&comma; b1&comma; b2&comma; c1&comma; c2&comma; 1&comma; z2

F2z1F2a&comma;b1&comma;b2&comma;c1&comma;c2&comma;1&comma;z2

(28)
  

Generate a recurrence procedure for this special case, call it U1

U1GenerateRecurrenceF2z1&comma;parameters=opF2

U1proci&comma;a&comma;b1&comma;b2&comma;c1&comma;c2&comma;z1&comma;z2optioncache&semi;ifi::nonnegint&comma;ifi<4&comma;T&lsqb;i&rsqb;i&comma;a&comma;b1&comma;b2&comma;c1&comma;c2&comma;z1&comma;z2&comma;a&plus;i1&ast;a&plus;ic1&ast;i&plus;b21&ast;thisproci1&comma;a&comma;b1&comma;b2&comma;c1&comma;c2&comma;z1&comma;z2&sol;i&ast;i&plus;c21&ast;i&plus;a&plus;b1c1&comma;&apos;procnameargs&apos;end proc

(29)
  

Note that in this particular case of z1=1, the coefficients of order 0 to 3 all involve hypergeometric functions at z1=1

U10&comma;a&comma;b1&comma;b2&comma;c1&comma;c2&comma;1&comma;z2

F12a,b1;c1;1

(30)

U11&comma;a&comma;b1&comma;b2&comma;c1&comma;c2&comma;1&comma;z2

ab2F12b1,a+1;c1;1c2

(31)

U12&comma;a&comma;b1&comma;b2&comma;c1&comma;c2&comma;1&comma;z2

ab2a+1b2+1F12b1,2+a;c1;12c2c2+1

(32)

U13&comma;a&comma;b1&comma;b2&comma;c1&comma;c2&comma;1&comma;z2

ab2F12b1,a+3;c1;1b2+2b2+12+aa+16c2c22+3c2+2

(33)
  

The recurrence in this case thus only exists if these four hypergeometric functions are convergent, which in turn will only happen if 0<cab1,0<ca1b1,0<c2ab1, and 0<ca3b1, so that if you passed values such that any of these condition is not met, for example c1=1,a=2,b=3, the recurrence cannot be constructed and GenerateRecurrence returns FAIL

GenerateRecurrence%AppellF22&comma; 3&comma; b2&comma; 1&comma; c2&comma; 1&comma; z2,parameters&equals;opF2

FAIL

(34)

Compatibility

• 

The MathematicalFunctions[Evalf][GenerateRecurrence] command was introduced in Maple 2017.

• 

For more information on Maple 2017 changes, see Updates in Maple 2017.

See Also

Appell

AppellF2

evalf

Evalf command

Evalf package

Evalf[Add]

Evalf[Singularities]

FunctionAdvisor

gfun:-diffeqtorec

hypergeom

InertForm

MathematicalFunctions

unapply