return or plot a numerical approximation to an integral using an adaptive method - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Education : Student Package : Numerical Analysis : Visualization : Student/NumericalAnalysis/AdaptiveQuadrature

Student[NumericalAnalysis][AdaptiveQuadrature] - return or plot a numerical approximation to an integral using an adaptive method

Calling Sequence

AdaptiveQuadrature(f, x=a..b, opts)

AdaptiveQuadrature(f, a..b, opts)

AdaptiveQuadrature(Int(f, x=a..b), opts)

Parameters

f

-

algebraic; expression in the variable x

x

-

name; the independent variable of f

a,b

-

numeric; the end points of the curve

opts

-

(optional) equation(s) of the for keyword=value, where keyword is one of: boxoptions, functionoptions, iterations, method, outline, output, partition, partitionlist, partitiontype, pointoptions, refinement, showarea, showfunction, showpoints, subpartition, caption, view; the options for numerically approximating the integrand, f

Description

• 

The AdaptiveQuadrature command returns a numerical approximation to the integral of f from a to b, using the specified adaptive method. Note that this command is a shortcut for calling the Quadrature command with the adaptive=true option.

• 

The AdaptiveQuadrature command aims to introduce adaptive numerical integration.

Examples

withStudent[NumericalAnalysis]:

f:=1+cosx2:

a:=0:

b:=48:

The command to numerically approximate the integral of the expression above using Simpson's rule is

AdaptiveQuadraturef,x=a..b,method=simpson,partition=4,output=value

58.47048191

(1)

The command to create a plot of the above approximation is

AdaptiveQuadraturef,x=a..b,method=simpson,partition=4,output=plot

f:=xx24:

a:=3:

b:=3.5:

The command to numerically approximate the definite integral of the above expression using the trapezoid rule and to print other relevant information concerning the approximation in the interface is

AdaptiveQuadraturef,x=a..b,method=trapezoid,output=information

INTEGRAL: Int(x/(x^2-4)^(1/2),x=3..3.5) = 0.636213346      
APPROXIMATION METHOD: Adaptive Trapezoidal Rule
---------------------------------- INFORMATION TABLE ----------------------------------
    Approximate Value         Absolute Error         Relative Error
         0.636258036             4.46897e-05          0.007024 %
---------------------------------- ITERATION HISTORY ---------------------------------------
   Interval           Status         Present Stack
 3.0000..3.5000        fail           EMPTY
 3.0000..3.2500        fail           [3.2500, 3.5000]
 3.0000..3.1250        fail           [[1], [3.1250, 3.2500]]
 3.0000..3.0625        PASS           [[2], [3.0625, 3.1250]]
 3.0625..3.1250        PASS           [[1], [3.1250, 3.2500]]
 3.1250..3.2500        PASS           [3.2500, 3.5000]
 3.2500..3.5000        fail           EMPTY
 3.2500..3.3750        PASS           [3.3750, 3.5000]
 3.3750..3.5000        PASS           EMPTY
--------------------------------------------------------------------------------------------
Number of Function Evaluations:     11

Now use an adaptive Newton-Cotes order 1 approximation with a specific tolerance on the same expression

AdaptiveQuadraturef,3..3.5,adaptive=true,method=newtoncotes1,104,output=information

INTEGRAL: Int(x/(x^2-4)^(1/2),x=3..3.5) = 0.636213346      
APPROXIMATION METHOD: Adaptive Trapezoidal Rule
---------------------------------- INFORMATION TABLE ----------------------------------
    Approximate Value         Absolute Error         Relative Error
         0.636258036             4.46897e-05          0.007024 %
---------------------------------- ITERATION HISTORY ---------------------------------------
   Interval           Status         Present Stack
 3.0000..3.5000        fail           EMPTY
 3.0000..3.2500        fail           [3.2500, 3.5000]
 3.0000..3.1250        fail           [[1], [3.1250, 3.2500]]
 3.0000..3.0625        PASS           [[2], [3.0625, 3.1250]]
 3.0625..3.1250        PASS           [[1], [3.1250, 3.2500]]
 3.1250..3.2500        PASS           [3.2500, 3.5000]
 3.2500..3.5000        fail           EMPTY
 3.2500..3.3750        PASS           [3.3750, 3.5000]
 3.3750..3.5000        PASS           EMPTY
--------------------------------------------------------------------------------------------
Number of Function Evaluations:     11

See Also

Student[NumericalAnalysis], Student[NumericalAnalysis][VisualizationOverview]


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam