Sponsored links: Algebra eBooks ### The Maxima on-line user's manual

Algebra Calculator

#### Search: Function: quad_qag (<f(x)>, <x>, <a>, <b>, <key>, [<epsrel>, <epsabs>, <limit>]) Function: quad_qag (<f>, <x>, <a>, <b>, <key>, [<epsrel>, <epsabs>, <limit>]) 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:

* an approximation to the integral,

* the estimated absolute error of the approximation,

* the number integrand evaluations,

* an error code.

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```

There are also some inexact matches for `quad_qag`. Try `?? quad_qag` to see them.

```(%o1)                                true
(%i2) ```

### Related Examples

Calculate

Calculate

quad_qag (x^2, x, 0, ...

Calculate

Calculate

Calculate

Calculate

Calculate

Calculate 