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

Online Help

All Products    Maple    MapleSim


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

Student[NumericalAnalysis][Quadrature] - return or plot a numerical approximation to an integral

Calling Sequence

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

Quadrature(f, a..b, opts)

Quadrature(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 endpoints of integration

opts

-

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

Description

• 

The Quadrature command returns a numerical approximation to the integral of f from a to b, using the specified method.

• 

Unless the output = sum option is specified, f must be an expression than can be evaluated to a floating-point number at all x in the range a..b. Likewise, the endpoints a and b must be expressions that can be evaluated to floating-point numbers.

• 

The Quadrature command is similar to the Student[Calculus1][ApproximateInt] command; however, the Quadrature command provides more methods to approximate integrals numerically. The Quadrature command aims to introduce numerical integration methods, while the Student[Calculus1][ApproximateInt] command aims to introduce the concept of integration itself.

Notes

• 

When the output = sum option is given, this procedure operates symbolically; that is, the inputs are not automatically evaluated to floating-point quantities, and computations proceed symbolically and exactly whenever possible. The output will be an inert sum, giving the formula of the quadrature.

• 

Otherwise, this procedure operates using floating-point numerics; that is, inputs are first evaluated to floating-point numbers before computations proceed, and numbers appearing in the output will be in floating-point format.

• 

Therefore, when output is not sum, the endpoints a and b must be expressions that can be evaluated to floating-point numbers; furthermore, the function f must be an expression that can be evaluated to a floating-point number whenever x is substituted with a floating-point number in the interval [a, b].

Examples

withStudent[NumericalAnalysis]:

a:=0:

b:=48:

f:=1+cosx2:

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

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

56.20282263

(1)

The command to create a plot of the above approximation is

Quadraturef,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 Romberg integration and to print other relevant information concerning the approximation in the interface is

Quadraturef,x=a..b,method=romberg4,output=information

INTEGRAL: Int(x/(x^2-4)^(1/2),x=3..3.5) = 0.636213346      
APPROXIMATION METHOD: Romberg Integration Method with 4 Applications of Trapezoidal Rule
---------------------------------- INFORMATION TABLE ----------------------------------
    Approximate Value         Absolute Error         Relative Error
         0.636213346                   5e-10         7.859e-08 %
------------------------------- ROMBERG INTEGRATION TABLE -----------------------------
   0.6400461
   0.6371906    0.6362387
   0.6364590    0.6362151    0.6362135
   0.6362748    0.6362135    0.6362133    0.6362133
---------------------------------------------------------------------------------------
Number of Function Evaluations:      9

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

Quadraturef,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][AdaptiveQuadrature], 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