Pari/GP Reference Documentation |
Contents - Index - Meta commands |

intcirc intfouriercos intfourierexp intfouriersin intfuncinit intlaplaceinv intmellininv intmellininvshort intnum intnuminit intnumromb intnumstep prod prodeuler prodinf solve sum sumalt sumdiv suminf sumnum sumnumalt sumnuminit sumpos | |

intcirc(X = a,R,expr, {tab}) | |

numerical
integration of
The library syntax is | |

intfouriercos(X = a,b,z,expr,{tab}) | |

numerical
integration of The library syntax is | |

intfourierexp(X = a,b,z,expr,{tab}) | |

numerical
integration of The library syntax is | |

intfouriersin(X = a,b,z,expr,{tab}) | |

numerical
integration of The library syntax is | |

intfuncinit(X = a,b,expr,{flag = 0},{m = 0}) | |

initalize tables for use with integral transforms such as The library syntax is | |

intlaplaceinv(X = sig,z,expr,{tab}) | |

numerical integration of sig is coded as follows. Either it is a real number sigma, equal to the
abcissa of integration, and then the function to be integrated is assumed to
be slowly decreasing when the imaginary part of the variable tends to
± oo . Or it is a two component vector [sigma,alpha], where
sigma is as before, and either alpha = 0 for slowly decreasing functions,
or alpha > 0 for functions decreasing like exp(-alpha t). Note that it
is not necessary to choose the exact value of alpha. It is often a good idea to use this function with a value of m one or two
higher than the one chosen by default (which can be viewed thanks to the
function
The library syntax is | |

intmellininv(X = sig,z,expr,{tab}) | |

numerical
integration of sig is coded as follows. Either it is a real number sigma, equal to the
abcissa of integration, and then the function to be integrated is assumed to
decrease exponentially fast, of the order of exp(-t) when the imaginary
part of the variable tends to ± oo . Or it is a two component vector
[sigma,alpha], where sigma is as before, and either alpha = 0 for
slowly decreasing functions, or alpha > 0 for functions decreasing like
exp(-alpha t), such as gamma products. Note that it is not necessary to
choose the exact value of alpha, and that alpha = 1 (equivalent to sig
alone) is usually sufficient. As all similar functions, this function is provided for the convenience of
the user, who could use
The library syntax is | |

intmellininvshort(sig,z,tab) | |

numerical integration
of s(X)z^{-X} with respect to X on the line Re(X) = sig, divided by
2iPi, in other words, inverse Mellin transform of s(X) at the value z.
Here s(X) is implicitly contained in
or similar commands. Take the example of the inverse Mellin transform of
Gamma(s)^3 given in
In the computation of The library syntax is | |

intnum(X = a,b,expr,{tab}) | |

numerical integration
of If If
However this value may be off from the optimal one, and this is important since the integration time is roughly proportional to 2^m. One may try consecutive values of m until they give the same value up to an accepted error. The endpoints a and b are coded as follows. If a is not at ± oo ,
it is either coded as a scalar (real or complex), or as a two component vector
[a,alpha], where the function is assumed to have a singularity of the
form (x-a)^{alpha+epsilon} at a, where epsilon indicates that powers
of logarithms are neglected. In particular, [a,alpha] with alpha The endpoints of integration can be ± oo , which is coded as [± 1] or as [[±1],alpha]. Here alpha codes the behaviour of the function at ± oo as follows.
The last two codes are reserved for oscillating functions. Let k > 0 real, and g(x) a nonoscillating function tending to 0, then
Here it is critical to give the exact value of k. If the oscillating part is not a pure sine or cosine, one must expand it into a Fourier series, use the above codings, and sum the resulting contributions. Otherwise you will get nonsense. Note that cos(kx) (and similarly sin(kx)) means that very function, and not a translated version such as cos(kx+a). If for instance f(x) = cos(kx)g(x) where g(x) tends to zero exponentially
fast as exp(-alpha x), it is up to the user to choose between
[[±1],alpha] and [[±1],kI], but a good rule of thumb is that if the
oscillations are much weaker than the exponential decrease, choose
[[±1],alpha], otherwise choose [[±1],kI], although the latter can
reasonably be used in all cases, while the former cannot. To take a specific
example, in the inverse Mellin transform, the function to be integrated is
almost always exponentially decreasing times oscillating. If we choose the
oscillating type of integral we perhaps obtain the best results, at the
expense of having to recompute our functions for a different value of the
variable z giving the transform, preventing us to use a function such as
We shall now see many examples to get a feeling for what the various parameters achieve. All examples below assume precision is set to 105 decimal digits. We first type
thus only correct to 76 decimal digits. This is because close to 0 the function f is computed with an enormous loss of accuracy. A better solution is
It is up to the user to determine constants such as the 10^{-18} and 7 used above.
We may use the above linearization and compute two oscillating integrals with
"infinite endpoints"
Note the formula int_0^ oo sin(x)/x^sdx = cos(Pi s/2) Gamma(1-s) , a priori valid only for 0 < Re(s) < 2, but the right hand side provides an analytic continuation which may be evaluated at s = -2...
For example, to compute the double integral on the unit disc x^2+y^2
The first
However, the
The library syntax is | |

intnuminit(a,b,{m = 0}) | |

initialize tables for integration from
a to b, where a and b are coded as in The result is technical, but in some cases it is useful to know the output.
Let x = phi(t) be the change of variable which is used. The library syntax is | |

intnumromb(X = a,b,expr,{flag = 0}) | |

numerical integration of
Set If
If The user should not require too much accuracy: 18 or 28 decimal digits is OK, but not much more. In addition, analytical cleanup of the integral must have been done: there must be no singularities in the interval or at the boundaries. In practice this can be accomplished with a simple change of variable. Furthermore, for improper integrals, where one or both of the limits of integration are plus or minus infinity, the function must decrease sufficiently rapidly at infinity. This can often be accomplished through integration by parts. Finally, the function to be integrated should not be very small (compared to the current precision) on the entire interval. This can of course be accomplished by just multiplying by an appropriate constant. Note that infinity can be represented with essentially no loss of accuracy by 1e1000. However beware of real underflow when dealing with rapidly decreasing functions. For example, if one wants to compute the int_0^ oo e^{-x^2}dx to 28 decimal digits, then one should set infinity equal to 10 for example, and certainly not to 1e1000. The library syntax is | |

intnumstep() | |

give the value of m used in all the
The library syntax is | |

prod(X = a,b,expr,{x = 1}) | |

product of expression
As an extreme example, compare
The library syntax is | |

prodeuler(X = a,b,expr) | |

product of expression The library syntax is | |

prodinf(X = a,expr,{flag = 0}) | |

infinite product of
expression If The library syntax is | |

solve(X = a,b,expr) | |

find a real root of expression
The library syntax is | |

sum(X = a,b,expr,{x = 0}) | |

sum of expression As an extreme example, compare
The library syntax is
| |

sumalt(X = a,expr,{flag = 0}) | |

numerical summation of the
series If Divergent alternating series can sometimes be summed by this method, as well
as series which are not exactly alternating (see for example
Section [
The library syntax is | |

sumdiv(n,X,expr) | |

sum of expression Arithmetic functions like The library syntax is | |

suminf(X = a,expr) | |

infinite sum of expression
If the series converges slowly, make sure
The library syntax is | |

sumnum(X = a,sig,expr,{tab}),{flag = 0} | |

numerical
summation of The parameter sigma belongs to
The function uses the When
Finally, if
For slowly decreasing function, we must indicate singularities:
Since the
For exponentially decreasing functions,
The library syntax is | |

sumnumalt(X = a,sig,expr,{tab},{flag = 0}) | |

numerical
summation of (-1)^X
sig is coded as in
The library syntax is | |

sumnuminit(sig,{m = 0},{sgn = 1}) | |

initialize tables for numerical
summation using The library syntax is | |

sumpos(X = a,expr,{flag = 0}) | |

numerical summation of the
series If The library syntax is | |