Function: integrate (<expr>, <x>)
Function: integrate (<expr>, <x>, <a>, <b>) 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.
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 (
minf), trigonometric functions with limits of integration equal to zero and
2 %pi, rational functions, integrals related to the definitions of the
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
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
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
integrate works only with functional relations represented explicitly with the
integrate does not respect implicit dependencies established by the
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
integrate is not, by default, declared to be linear. See
integrate attempts integration by parts only in a few special cases.
* Elementary indefinite and definite integrals.
(%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
* Use of
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
* Change of variable. There are two changes of variable in this example: one using a derivative established by
gradef, and one using the derivation
diff(r(x)) of an unspecified function
(%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)))
* Return value contains the
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$
* Defining a function in terms of an integral. The body of a function is not evaluated when the function is defined. Thus the body of
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
(%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
There are also some inexact matches for
?? integrate to see them.
(%o1) true (%i2)
e1: ratsimp(2 * (subs...