[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
19.1 Introduction to Integration | ||
19.2 Functions and Variables for Integration | ||
19.3 Introduction to QUADPACK | ||
19.4 Functions and Variables for QUADPACK |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Maxima has several routines for handling integration.
The integrate
function makes use of most of them. There is also the
antid
package, which handles an unspecified function (and its
derivatives, of course). For numerical uses,
there is a set of adaptive integrators from QUADPACK, named quad_qag
,
quad_qags
, etc., which are described under the heading QUADPACK
.
Hypergeometric functions are being worked on,
see specint
for details.
Generally speaking, Maxima only handles integrals which are
integrable in terms of the "elementary functions" (rational functions,
trigonometrics, logs, exponentials, radicals, etc.) and a few
extensions (error function, dilogarithm). It does not handle
integrals in terms of unknown functions such as g(x)
and h(x)
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Makes the change of variable given by f(x,y) = 0
in all integrals
occurring in expr with integration with respect to x.
The new variable is y.
(%i1) assume(a > 0)$ (%i2) 'integrate (%e**sqrt(a*y), y, 0, 4); 4 / [ sqrt(a) sqrt(y) (%o2) I %e dy ] / 0 (%i3) changevar (%, y-z^2/a, z, y); 0 / [ abs(z) 2 I z %e dz ] / - 2 sqrt(a) (%o3) - ---------------------------- a
An expression containing a noun form, such as the instances of 'integrate
above, may be evaluated by ev
with the nouns
flag.
For example, the expression returned by changevar
above may be evaluated
by ev (%o3, nouns)
.
changevar
may also be used to changes in the indices of a sum or
product. However, it must be realized that when a change is made in a
sum or product, this change must be a shift, i.e., i = j+ ...
, not a
higher degree function. E.g.,
(%i4) sum (a[i]*x^(i-2), i, 0, inf); inf ==== \ i - 2 (%o4) > a x / i ==== i = 0 (%i5) changevar (%, i-2-n, n, i); inf ==== \ n (%o5) > a x / n + 2 ==== n = - 2
Categories: Integral calculus
A double-integral routine which was written in
top-level Maxima and then translated and compiled to machine code.
Use load (dblint)
to access this package. It uses the Simpson's rule
method in both the x and y directions to calculate
/b /s(x) | | | | f(x,y) dy dx | | /a /r(x)
The function f must be a translated or compiled function of two variables,
and r and s must each be a translated or compiled function of one
variable, while a and b must be floating point numbers. The routine
has two global variables which determine the number of divisions of the x and y
intervals: dblint_x
and dblint_y
, both of which are initially 10,
and can be changed independently to other integer values (there are
2*dblint_x+1
points computed in the x direction, and 2*dblint_y+1
in the y direction). The routine subdivides the X axis and then for each value
of X it first computes r(x)
and s(x)
; then the Y axis
between r(x)
and s(x)
is subdivided and the integral
along the Y axis is performed using Simpson's rule; then the integral along the
X axis is done using Simpson's rule with the function values being the
Y-integrals. This procedure may be numerically unstable for a great variety of
reasons, but is reasonably fast: avoid using it on highly oscillatory functions
and functions with singularities (poles or branch points in the region). The Y
integrals depend on how far apart r(x)
and s(x)
are,
so if the distance s(x) - r(x)
varies rapidly with X, there
may be substantial errors arising from truncation with different step-sizes in
the various Y integrals. One can increase dblint_x
and dblint_y
in an effort to improve the coverage of the region, at the expense of
computation time. The function values are not saved, so if the function is very
time-consuming, you will have to wait for re-computation if you change anything
(sorry). It is required that the functions f, r, and s be
either translated or compiled prior to calling dblint
. This will result
in orders of magnitude speed improvement over interpreted code in many cases!
demo (dblint)
executes a demonstration of dblint
applied to an
example problem.
Categories: Integral calculus
Attempts to compute a definite integral. defint
is called by
integrate
when limits of integration are specified, i.e., when
integrate
is called as
integrate (expr, x, a, b)
.
Thus from the user's point of view, it is sufficient to call integrate
.
defint
returns a symbolic expression, either the computed integral or the
noun form of the integral. See quad_qag
and related functions for
numerical approximation of definite integrals.
Categories: Integral calculus
Default value: true
When erfflag
is false
, prevents risch
from introducing the
erf
function in the answer if there were none in the integrand to
begin with.
Categories: Integral calculus
Computes the inverse Laplace transform of expr with
respect to s and parameter t. expr must be a ratio of
polynomials whose denominator has only linear and quadratic factors.
By using the functions laplace
and ilt
together with the
solve
or linsolve
functions the user can solve a single
differential or convolution integral equation or a set of them.
(%i1) 'integrate (sinh(a*x)*f(t-x), x, 0, t) + b*f(t) = t**2; t / [ 2 (%o1) I f(t - x) sinh(a x) dx + b f(t) = t ] / 0 (%i2) laplace (%, t, s); a laplace(f(t), t, s) 2 (%o2) b laplace(f(t), t, s) + --------------------- = -- 2 2 3 s - a s (%i3) linsolve ([%], ['laplace(f(t), t, s)]); 2 2 2 s - 2 a (%o3) [laplace(f(t), t, s) = --------------------] 5 2 3 b s + (a - a b) s (%i4) ilt (rhs (first (%)), s, t); Is a b (a b - 1) positive, negative, or zero? pos; sqrt(a b (a b - 1)) t 2 cosh(---------------------) 2 b a t (%o4) - ----------------------------- + ------- 3 2 2 a b - 1 a b - 2 a b + a 2 + ------------------ 3 2 2 a b - 2 a b + a
Categories: Laplace transform
Default value: true
When true
, definite integration tries to find poles in the integrand in
the interval of integration. If there are, then the integral is evaluated
appropriately as a principal value integral. If intanalysis is false
,
this check is not performed and integration is done assuming there are no poles.
See also ldefint
.
Examples:
Maxima can solve the following integrals, when intanalysis
is set to
false
:
(%i1) integrate(1/(sqrt(x)+1),x,0,1); 1 / [ 1 (%o1) I ----------- dx ] sqrt(x) + 1 / 0 (%i2) integrate(1/(sqrt(x)+1),x,0,1),intanalysis:false; (%o2) 2 - 2 log(2) (%i3) integrate(cos(a)/sqrt((tan(a))^2 +1),a,-%pi/2,%pi/2); The number 1 isn't in the domain of atanh -- an error. To debug this try: debugmode(true); (%i4) intanalysis:false$ (%i5) integrate(cos(a)/sqrt((tan(a))^2+1),a,-%pi/2,%pi/2); %pi (%o5) --- 2
Categories: Integral calculus
Attempts to symbolically compute the integral of expr with respect to
x. integrate (expr, x)
is an indefinite integral,
while integrate (expr, x, a, b)
is a definite
integral, with limits of integration a and b. The limits should
not contain x, although integrate
does not enforce this
restriction. a need not be less than b.
If b is equal to a, integrate
returns zero.
See quad_qag
and related functions for numerical approximation of
definite integrals. See residue
for computation of residues
(complex integration). See antid
for an alternative means of computing
indefinite integrals.
The integral (an expression free of integrate
) is returned if
integrate
succeeds. Otherwise the return value is
the noun form of the integral (the quoted operator 'integrate
)
or an expression containing one or more noun forms.
The noun form of integrate
is displayed with an integral sign.
In some circumstances it is useful to construct a noun form by hand, by quoting
integrate
with a single quote, e.g.,
'integrate (expr, x)
. For example, the integral may depend
on some parameters which are not yet computed.
The noun may be applied to its arguments by ev (i, nouns)
where i is the noun form of interest.
integrate
handles definite integrals separately from indefinite, and
employs a range of heuristics to handle each case. Special cases of definite
integrals include limits of integration equal to zero or infinity (inf
or
minf
), trigonometric functions with limits of integration equal to zero
and %pi
or 2 %pi
, rational functions, integrals related to the
definitions of the beta
and psi
functions, and some logarithmic
and trigonometric integrals. Processing rational functions may include
computation of residues. If an applicable special case is not found, an attempt
will be made to compute the indefinite integral and evaluate it at the limits of
integration. This may include taking a limit as a limit of integration goes to
infinity or negative infinity; see also ldefint
.
Special cases of indefinite integrals include trigonometric functions,
exponential and logarithmic functions,
and rational functions.
integrate
may also make use of a short table of elementary integrals.
integrate
may carry out a change of variable
if the integrand has the form f(g(x)) * diff(g(x), x)
.
integrate
attempts to find a subexpression g(x)
such that
the derivative of g(x)
divides the integrand.
This search may make use of derivatives defined by the gradef
function.
See also changevar
and antid
.
If none of the preceding heuristics find the indefinite integral, the Risch
algorithm is executed. The flag risch
may be set as an evflag
,
in a call to ev
or on the command line, e.g.,
ev (integrate (expr, x), risch)
or
integrate (expr, x), risch
. If risch
is present,
integrate
calls the risch
function without attempting heuristics
first. See also risch
.
integrate
works only with functional relations represented explicitly
with the f(x)
notation. integrate
does not respect implicit
dependencies established by the depends
function.
integrate
may need to know some property of a parameter in the integrand.
integrate
will first consult the assume
database,
and, if the variable of interest is not there,
integrate
will ask the user.
Depending on the question,
suitable responses are yes;
or no;
,
or pos;
, zero;
, or neg;
.
integrate
is not, by default, declared to be linear. See declare
and linear
.
integrate
attempts integration by parts only in a few special cases.
Examples:
(%i1) integrate (sin(x)^3, x); 3 cos (x) (%o1) ------- - cos(x) 3 (%i2) integrate (x/ sqrt (b^2 - x^2), x); 2 2 (%o2) - sqrt(b - x ) (%i3) integrate (cos(x)^2 * exp(x), x, 0, %pi); %pi 3 %e 3 (%o3) ------- - - 5 5 (%i4) integrate (x^2 * exp(-x^2), x, minf, inf); sqrt(%pi) (%o4) --------- 2
assume
and interactive query.
(%i1) assume (a > 1)$ (%i2) integrate (x**a/(x+1)**(5/2), x, 0, inf); 2 a + 2 Is ------- an integer? 5 no; Is 2 a - 3 positive, negative, or zero? neg; 3 (%o2) beta(a + 1, - - a) 2
gradef
, and one using the
derivation diff(r(x))
of an unspecified function r(x)
.
(%i3) gradef (q(x), sin(x**2)); (%o3) q(x) (%i4) diff (log (q (r (x))), x); d 2 (-- (r(x))) sin(r (x)) dx (%o4) ---------------------- q(r(x)) (%i5) integrate (%, x); (%o5) log(q(r(x)))
'integrate
noun form. In this example, Maxima
can extract one factor of the denominator of a rational function, but cannot
factor the remainder or otherwise find its integral. grind
shows the
noun form 'integrate
in the result. See also
integrate_use_rootsof
for more on integrals of rational functions.
(%i1) expand ((x-4) * (x^3+2*x+1)); 4 3 2 (%o1) x - 4 x + 2 x - 7 x - 4 (%i2) integrate (1/%, x); / 2 [ x + 4 x + 18 I ------------- dx ] 3 log(x - 4) / x + 2 x + 1 (%o2) ---------- - ------------------ 73 73 (%i3) grind (%); log(x-4)/73-('integrate((x^2+4*x+18)/(x^3+2*x+1),x))/73$
f_1
in this
example contains the noun form of integrate
. The quote-quote operator
''
causes the integral to be evaluated, and the result becomes the
body of f_2
.
(%i1) f_1 (a) := integrate (x^3, x, 1, a); 3 (%o1) f_1(a) := integrate(x , x, 1, a) (%i2) ev (f_1 (7), nouns); (%o2) 600 (%i3) /* Note parentheses around integrate(...) here */ f_2 (a) := ''(integrate (x^3, x, 1, a)); 4 a 1 (%o3) f_2(a) := -- - - 4 4 (%i4) f_2 (7); (%o4) 600
Categories: Integral calculus
Default value: %c
When a constant of integration is introduced by indefinite integration of an
equation, the name of the constant is constructed by concatenating
integration_constant
and integration_constant_counter
.
integration_constant
may be assigned any symbol.
Examples:
(%i1) integrate (x^2 = 1, x); 3 x (%o1) -- = x + %c1 3 (%i2) integration_constant : 'k; (%o2) k (%i3) integrate (x^2 = 1, x); 3 x (%o3) -- = x + k2 3
Categories: Integral calculus
Default value: 0
When a constant of integration is introduced by indefinite integration of an
equation, the name of the constant is constructed by concatenating
integration_constant
and integration_constant_counter
.
integration_constant_counter
is incremented before constructing the next
integration constant.
Examples:
(%i1) integrate (x^2 = 1, x); 3 x (%o1) -- = x + %c1 3 (%i2) integrate (x^2 = 1, x); 3 x (%o2) -- = x + %c2 3 (%i3) integrate (x^2 = 1, x); 3 x (%o3) -- = x + %c3 3 (%i4) reset (integration_constant_counter); (%o4) [integration_constant_counter] (%i5) integrate (x^2 = 1, x); 3 x (%o5) -- = x + %c1 3
Categories: Integral calculus
Default value: false
When integrate_use_rootsof
is true
and the denominator of
a rational function cannot be factored, integrate
returns the integral
in a form which is a sum over the roots (not yet known) of the denominator.
For example, with integrate_use_rootsof
set to false
,
integrate
returns an unsolved integral of a rational function in noun
form:
(%i1) integrate_use_rootsof: false$ (%i2) integrate (1/(1+x+x^5), x); / 2 [ x - 4 x + 5 I ------------ dx 2 x + 1 ] 3 2 2 5 atan(-------) / x - x + 1 log(x + x + 1) sqrt(3) (%o2) ----------------- - --------------- + --------------- 7 14 7 sqrt(3)
Now we set the flag to be true and the unsolved part of the integral will be expressed as a summation over the roots of the denominator of the rational function:
(%i3) integrate_use_rootsof: true$ (%i4) integrate (1/(1+x+x^5), x); ==== 2 \ (%r4 - 4 %r4 + 5) log(x - %r4) > ------------------------------- / 2 ==== 3 %r4 - 2 %r4 3 2 %r4 in rootsof(x - x + 1) (%o4) ---------------------------------------------------------- 7 2 x + 1 2 5 atan(-------) log(x + x + 1) sqrt(3) - --------------- + --------------- 14 7 sqrt(3)
Alternatively the user may compute the roots of the denominator separately,
and then express the integrand in terms of these roots, e.g.,
1/((x - a)*(x - b)*(x - c))
or 1/((x^2 - (a+b)*x + a*b)*(x - c))
if the denominator is a cubic polynomial.
Sometimes this will help Maxima obtain a more useful result.
Categories: Integral calculus
Attempts to compute the definite integral of expr by using limit
to evaluate the indefinite integral of expr with respect to x
at the upper limit b and at the lower limit a.
If it fails to compute the definite integral,
ldefint
returns an expression containing limits as noun forms.
ldefint
is not called from integrate
, so executing
ldefint (expr, x, a, b)
may yield a different
result than integrate (expr, x, a, b)
.
ldefint
always uses the same method to evaluate the definite integral,
while integrate
may employ various heuristics and may recognize some
special cases.
Categories: Integral calculus
The calculation makes use of the global variable potentialzeroloc[0]
which must be nonlist
or of the form
[indeterminatej=expressionj, indeterminatek=expressionk, ...]
the former being equivalent to the nonlist expression for all right-hand
sides in the latter. The indicated right-hand sides are used as the
lower limit of integration. The success of the integrations may
depend upon their values and order. potentialzeroloc
is initially set
to 0.
Computes the residue in the complex plane of the expression expr when the
variable z assumes the value z_0. The residue is the coefficient of
(z - z_0)^(-1)
in the Laurent series for expr.
(%i1) residue (s/(s**2+a**2), s, a*%i); 1 (%o1) - 2 (%i2) residue (sin(a*x)/x**4, x, 0); 3 a (%o2) - -- 6
Categories: Integral calculus Complex variables
Integrates expr with respect to x using the
transcendental case of the Risch algorithm. (The algebraic case of
the Risch algorithm has not been implemented.) This currently
handles the cases of nested exponentials and logarithms which the main
part of integrate
can't do. integrate
will automatically apply
risch
if given these cases.
erfflag
, if false
, prevents risch
from introducing the
erf
function in the answer if there were none in the integrand to begin
with.
(%i1) risch (x^2*erf(x), x); 2 3 2 - x %pi x erf(x) + (sqrt(%pi) x + sqrt(%pi)) %e (%o1) ------------------------------------------------- 3 %pi (%i2) diff(%, x), ratsimp; 2 (%o2) x erf(x)
Categories: Integral calculus
Equivalent to ldefint
with tlimswitch
set to true
.
Categories: Integral calculus
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
QUADPACK is a collection of functions for the numerical computation of one-dimensional definite integrals. It originated from a joint project of R. Piessens (1), E. de Doncker (2), C. Ueberhuber (3), and D. Kahaner (4).
The QUADPACK library included in Maxima is an automatic translation (via the
program f2cl
) of the Fortran source code of QUADPACK as it appears in
the SLATEC Common Mathematical Library, Version 4.1 (5).
The SLATEC library is dated July 1993, but the QUADPACK functions
were written some years before.
There is another version of QUADPACK at Netlib (6);
it is not clear how that version differs from the SLATEC version.
The QUADPACK functions included in Maxima are all automatic, in the sense that these functions attempt to compute a result to a specified accuracy, requiring an unspecified number of function evaluations. Maxima's Lisp translation of QUADPACK also includes some non-automatic functions, but they are not exposed at the Maxima level.
Further information about QUADPACK can be found in the QUADPACK book (7).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
quad_qag
Integration of a general function over a finite interval.
quad_qag
implements a simple globally adaptive integrator using the
strategy of Aind (Piessens, 1973).
The caller may choose among 6 pairs of Gauss-Kronrod quadrature
formulae for the rule evaluation component.
The high-degree rules are suitable for strongly oscillating integrands.
quad_qags
Integration of a general function over a finite interval.
quad_qags
implements globally adaptive interval subdivision with
extrapolation (de Doncker, 1978) by the Epsilon algorithm (Wynn, 1956).
quad_qagi
Integration of a general function over an infinite or semi-infinite interval.
The interval is mapped onto a finite interval and
then the same strategy as in quad_qags
is applied.
quad_qawo
Integration of cos(omega x) f(x) or sin(omega x) f(x) over a
finite interval, where omega is a constant.
The rule evaluation component is based on the modified Clenshaw-Curtis
technique. quad_qawo
applies adaptive subdivision with extrapolation,
similar to quad_qags
.
quad_qawf
Calculates a Fourier cosine or Fourier sine transform on a semi-infinite
interval. The same approach as in quad_qawo
is applied on successive
finite intervals, and convergence acceleration by means of the Epsilon algorithm
(Wynn, 1956) is applied to the series of the integral contributions.
quad_qaws
Integration of w(x) f(x) over a finite interval [a, b], where w is a function of the form (x - a)^alpha (b - x)^beta v(x) and v(x) is 1 or log(x - a) or log(b - x) or log(x - a) log(b - x), and alpha > -1 and beta > -1.
A globally adaptive subdivision strategy is applied, with modified Clenshaw-Curtis integration on the subintervals which contain a or b.
quad_qawc
Computes the Cauchy principal value of f(x)/(x - c) over a finite interval (a, b) and specified c. The strategy is globally adaptive, and modified Clenshaw-Curtis integration is used on the subranges which contain the point x = c.
quad_qagp
Basically the same as quad_qags
but points of singularity or
discontinuity of the integrand must be supplied. This makes it easier
for the integrator to produce a good solution.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Integration of a general function over a finite interval. quad_qag
implements a simple globally adaptive integrator using the strategy of Aind
(Piessens, 1973). The caller may choose among 6 pairs of Gauss-Kronrod
quadrature formulae for the rule evaluation component. The high-degree rules
are suitable for strongly oscillating integrands.
quad_qag
computes the integral
integrate (f(x), x, a, b)
The function to be integrated is f(x), with dependent variable x, and the function is to be integrated between the limits a and b. key is the integrator to be used and should be an integer between 1 and 6, inclusive. The value of key selects the order of the Gauss-Kronrod integration rule. High-order rules are suitable for strongly oscillating integrands.
The integrand may be specified as the name of a Maxima or Lisp function or operator, a Maxima lambda expression, or a general Maxima expression.
The numerical integration is done adaptively by subdividing the integration region into sub-intervals until the desired accuracy is achieved.
The keyword arguments are optional and may be specified in any order.
They all take the form key=val
. The keyword arguments are:
epsrel
Desired relative error of approximation. Default is 1d-8.
epsabs
Desired absolute error of approximation. Default is 0.
limit
Size of internal work array. limit is the maximum number of subintervals to use. Default is 200.
quad_qag
returns a list of four elements:
The error code (fourth element of the return value) can have the values:
0
if no problems were encountered;
1
if too many sub-intervals were done;
2
if excessive roundoff error is detected;
3
if extremely bad integrand behavior occurs;
6
if the input is invalid.
Examples:
(%i1) quad_qag (x^(1/2)*log(1/x), x, 0, 1, 3, 'epsrel=5d-8); (%o1) [.4444444444492108, 3.1700968502883E-9, 961, 0] (%i2) integrate (x^(1/2)*log(1/x), x, 0, 1); 4 (%o2) - 9
Categories: Numerical methods Package quadpack
Integration of a general function over a finite interval.
quad_qags
implements globally adaptive interval subdivision with
extrapolation (de Doncker, 1978) by the Epsilon algorithm (Wynn, 1956).
quad_qags
computes the integral
integrate (f(x), x, a, b)
The function to be integrated is f(x), with dependent variable x, and the function is to be integrated between the limits a and b.
The integrand may be specified as the name of a Maxima or Lisp function or operator, a Maxima lambda expression, or a general Maxima expression.
The keyword arguments are optional and may be specified in any order.
They all take the form key=val
. The keyword arguments are:
epsrel
Desired relative error of approximation. Default is 1d-8.
epsabs
Desired absolute error of approximation. Default is 0.
limit
Size of internal work array. limit is the maximum number of subintervals to use. Default is 200.
quad_qags
returns a list of four elements:
The error code (fourth element of the return value) can have the values:
0
no problems were encountered;
1
too many sub-intervals were done;
2
excessive roundoff error is detected;
3
extremely bad integrand behavior occurs;
4
failed to converge
5
integral is probably divergent or slowly convergent
6
if the input is invalid.
Examples:
(%i1) quad_qags (x^(1/2)*log(1/x), x, 0, 1, 'epsrel=1d-10); (%o1) [.4444444444444448, 1.11022302462516E-15, 315, 0]
Note that quad_qags
is more accurate and efficient than quad_qag
for this integrand.
Categories: Numerical methods Package quadpack
Integration of a general function over an infinite or semi-infinite interval.
The interval is mapped onto a finite interval and
then the same strategy as in quad_qags
is applied.
quad_qagi
evaluates one of the following integrals
integrate (f(x), x, a, inf)
integrate (f(x), x, minf, a)
integrate (f(x), x, minf, inf)
using the Quadpack QAGI routine. The function to be integrated is f(x), with dependent variable x, and the function is to be integrated over an infinite range.
The integrand may be specified as the name of a Maxima or Lisp function or operator, a Maxima lambda expression, or a general Maxima expression.
One of the limits of integration must be infinity. If not, then
quad_qagi
will just return the noun form.
The keyword arguments are optional and may be specified in any order.
They all take the form key=val
. The keyword arguments are:
epsrel
Desired relative error of approximation. Default is 1d-8.
epsabs
Desired absolute error of approximation. Default is 0.
limit
Size of internal work array. limit is the maximum number of subintervals to use. Default is 200.
quad_qagi
returns a list of four elements:
The error code (fourth element of the return value) can have the values:
0
no problems were encountered;
1
too many sub-intervals were done;
2
excessive roundoff error is detected;
3
extremely bad integrand behavior occurs;
4
failed to converge
5
integral is probably divergent or slowly convergent
6
if the input is invalid.
Examples:
(%i1) quad_qagi (x^2*exp(-4*x), x, 0, inf, 'epsrel=1d-8); (%o1) [0.03125, 2.95916102995002E-11, 105, 0] (%i2) integrate (x^2*exp(-4*x), x, 0, inf); 1 (%o2) -- 32
Categories: Numerical methods Package quadpack
Computes the Cauchy principal value of f(x)/(x - c) over a finite interval. The strategy is globally adaptive, and modified Clenshaw-Curtis integration is used on the subranges which contain the point x = c.
quad_qawc
computes the Cauchy principal value of
integrate (f(x)/(x - c), x, a, b)
using the Quadpack QAWC routine. The function to be integrated is
f(x)/(x - c)
, with dependent variable x, and the
function is to be integrated over the interval a to b.
The integrand may be specified as the name of a Maxima or Lisp function or operator, a Maxima lambda expression, or a general Maxima expression.
The keyword arguments are optional and may be specified in any order.
They all take the form key=val
. The keyword arguments are:
epsrel
Desired relative error of approximation. Default is 1d-8.
epsabs
Desired absolute error of approximation. Default is 0.
limit
Size of internal work array. limit is the maximum number of subintervals to use. Default is 200.
quad_qawc
returns a list of four elements:
The error code (fourth element of the return value) can have the values:
0
no problems were encountered;
1
too many sub-intervals were done;
2
excessive roundoff error is detected;
3
extremely bad integrand behavior occurs;
6
if the input is invalid.
Examples:
(%i1) quad_qawc (2^(-5)*((x-1)^2+4^(-5))^(-1), x, 2, 0, 5, 'epsrel=1d-7); (%o1) [- 3.130120337415925, 1.306830140249558E-8, 495, 0] (%i2) integrate (2^(-alpha)*(((x-1)^2 + 4^(-alpha))*(x-2))^(-1), x, 0, 5); Principal Value alpha alpha 9 4 9 4 log(------------- + -------------) alpha alpha 64 4 + 4 64 4 + 4 (%o2) (----------------------------------------- alpha 2 4 + 2 3 alpha 3 alpha ------- ------- 2 alpha/2 2 alpha/2 2 4 atan(4 4 ) 2 4 atan(4 ) alpha - --------------------------- - -------------------------)/2 alpha alpha 2 4 + 2 2 4 + 2 (%i3) ev (%, alpha=5, numer); (%o3) - 3.130120337415917
Categories: Numerical methods Package quadpack
Calculates a Fourier cosine or Fourier sine transform on a semi-infinite
interval using the Quadpack QAWF function. The same approach as in
quad_qawo
is applied on successive finite intervals, and convergence
acceleration by means of the Epsilon algorithm (Wynn, 1956) is applied to the
series of the integral contributions.
quad_qawf
computes the integral
integrate (f(x)*w(x), x, a, inf)
The weight function w is selected by trig:
cos
w(x) = cos (omega x)
sin
w(x) = sin (omega x)
The integrand may be specified as the name of a Maxima or Lisp function or operator, a Maxima lambda expression, or a general Maxima expression.
The keyword arguments are optional and may be specified in any order.
They all take the form key=val
. The keyword arguments are:
epsabs
Desired absolute error of approximation. Default is 1d-10.
limit
Size of internal work array. (limit - limlst)/2 is the maximum number of subintervals to use. Default is 200.
maxp1
Maximum number of Chebyshev moments. Must be greater than 0. Default is 100.
limlst
Upper bound on the number of cycles. Must be greater than or equal to 3. Default is 10.
quad_qawf
returns a list of four elements:
The error code (fourth element of the return value) can have the values:
0
no problems were encountered;
1
too many sub-intervals were done;
2
excessive roundoff error is detected;
3
extremely bad integrand behavior occurs;
6
if the input is invalid.
Examples:
(%i1) quad_qawf (exp(-x^2), x, 0, 1, 'cos, 'epsabs=1d-9); (%o1) [.6901942235215714, 2.84846300257552E-11, 215, 0] (%i2) integrate (exp(-x^2)*cos(x), x, 0, inf); - 1/4 %e sqrt(%pi) (%o2) ----------------- 2 (%i3) ev (%, numer); (%o3) .6901942235215714
Categories: Numerical methods Package quadpack
Integration of
cos (omega x) f(x)
or
sin (omega x) f(x)
over a finite interval,
where
omega
is a constant. The rule evaluation component is based on the modified
Clenshaw-Curtis technique. quad_qawo
applies adaptive subdivision with
extrapolation, similar to quad_qags
.
quad_qawo
computes the integral using the Quadpack QAWO
routine:
integrate (f(x)*w(x), x, a, b)
The weight function w is selected by trig:
cos
w(x) = cos (omega x)
sin
w(x) = sin (omega x)
The integrand may be specified as the name of a Maxima or Lisp function or operator, a Maxima lambda expression, or a general Maxima expression.
The keyword arguments are optional and may be specified in any order.
They all take the form key=val
. The keyword arguments are:
epsrel
Desired relative error of approximation. Default is 1d-8.
epsabs
Desired absolute error of approximation. Default is 0.
limit
Size of internal work array. limit/2 is the maximum number of subintervals to use. Default is 200.
maxp1
Maximum number of Chebyshev moments. Must be greater than 0. Default is 100.
limlst
Upper bound on the number of cycles. Must be greater than or equal to 3. Default is 10.
quad_qawo
returns a list of four elements:
The error code (fourth element of the return value) can have the values:
0
no problems were encountered;
1
too many sub-intervals were done;
2
excessive roundoff error is detected;
3
extremely bad integrand behavior occurs;
6
if the input is invalid.
Examples:
(%i1) quad_qawo (x^(-1/2)*exp(-2^(-2)*x), x, 1d-8, 20*2^2, 1, cos); (%o1) [1.376043389877692, 4.72710759424899E-11, 765, 0] (%i2) rectform (integrate (x^(-1/2)*exp(-2^(-alpha)*x) * cos(x), x, 0, inf)); alpha/2 - 1/2 2 alpha sqrt(%pi) 2 sqrt(sqrt(2 + 1) + 1) (%o2) ----------------------------------------------------- 2 alpha sqrt(2 + 1) (%i3) ev (%, alpha=2, numer); (%o3) 1.376043390090716
Categories: Numerical methods Package quadpack
Integration of w(x) f(x) over a finite interval, where w(x) is a certain algebraic or logarithmic function. A globally adaptive subdivision strategy is applied, with modified Clenshaw-Curtis integration on the subintervals which contain the endpoints of the interval of integration.
quad_qaws
computes the integral using the Quadpack QAWS routine:
integrate (f(x)*w(x), x, a, b)
The weight function w is selected by wfun:
1
w(x) = (x - a)^alpha (b - x)^beta
2
w(x) = (x - a)^alpha (b - x)^beta log(x - a)
3
w(x) = (x - a)^alpha (b - x)^beta log(b - x)
4
w(x) = (x - a)^alpha (b - x)^beta log(x - a) log(b - x)
The integrand may be specified as the name of a Maxima or Lisp function or operator, a Maxima lambda expression, or a general Maxima expression.
The keyword arguments are optional and may be specified in any order.
They all take the form key=val
. The keyword arguments are:
epsrel
Desired relative error of approximation. Default is 1d-8.
epsabs
Desired absolute error of approximation. Default is 0.
limit
Size of internal work array. limitis the maximum number of subintervals to use. Default is 200.
quad_qaws
returns a list of four elements:
The error code (fourth element of the return value) can have the values:
0
no problems were encountered;
1
too many sub-intervals were done;
2
excessive roundoff error is detected;
3
extremely bad integrand behavior occurs;
6
if the input is invalid.
Examples:
(%i1) quad_qaws (1/(x+1+2^(-4)), x, -1, 1, -0.5, -0.5, 1, 'epsabs=1d-9); (%o1) [8.750097361672832, 1.24321522715422E-10, 170, 0] (%i2) integrate ((1-x*x)^(-1/2)/(x+1+2^(-alpha)), x, -1, 1); alpha Is 4 2 - 1 positive, negative, or zero? pos; alpha alpha 2 %pi 2 sqrt(2 2 + 1) (%o2) ------------------------------- alpha 4 2 + 2 (%i3) ev (%, alpha=4, numer); (%o3) 8.750097361672829
Categories: Numerical methods Package quadpack
Integration of a general function over a finite interval.
quad_qagp
implements globally adaptive interval subdivision with
extrapolation (de Doncker, 1978) by the Epsilon algorithm (Wynn, 1956).
quad_qagp
computes the integral
integrate (f(x), x, a, b)
The function to be integrated is f(x), with dependent variable x, and the function is to be integrated between the limits a and b.
The integrand may be specified as the name of a Maxima or Lisp function or operator, a Maxima lambda expression, or a general Maxima expression.
To help the integrator, the user must supply a list of points where the integrand is singular or discontinous.
The keyword arguments are optional and may be specified in any order.
They all take the form key=val
. The keyword arguments are:
epsrel
Desired relative error of approximation. Default is 1d-8.
epsabs
Desired absolute error of approximation. Default is 0.
limit
Size of internal work array. limit is the maximum number of subintervals to use. Default is 200.
quad_qagp
returns a list of four elements:
The error code (fourth element of the return value) can have the values:
0
no problems were encountered;
1
too many sub-intervals were done;
2
excessive roundoff error is detected;
3
extremely bad integrand behavior occurs;
4
failed to converge
5
integral is probably divergent or slowly convergent
6
if the input is invalid.
Examples:
(%i1) quad_qagp(x^3*log(abs((x^2-1)*(x^2-2))),x,0,3,[1,sqrt(2)]); (%o1) [52.74074838347143, 2.6247632689546663e-7, 1029, 0] (%i2) quad_qags(x^3*log(abs((x^2-1)*(x^2-2))), x, 0, 3); (%o2) [52.74074847951494, 4.088443219529836e-7, 1869, 0]
The integrand has singularities at 1
and sqrt(2)
so we supply
these points to quad_qagp
. We also note that quad_qagp
is
more accurate and more efficient that quad_qags
.
Categories: Numerical methods Package quadpack
Control error handling for quadpack. The parameter should be one of the following symbols:
current_error
The current error number
control
Controls if messages are printed or not. If it is set to zero or less, messages are suppressed.
max_message
The maximum number of times any message is to be printed.
If value is not given, then the current value of the parameter is returned. If value is given, the value of parameter is set to the given value.
Categories: Numerical methods Package quadpack
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated by Charlie & on July, 6 2015 using texi2html 1.76.