Student[Calculus1] - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Education : Student Packages : Calculus 1 : Visualization : Integration : Student/Calculus1/ApproximateInt

Student[Calculus1]

 ApproximateInt
 return or plot an approximation to an integral

 Calling Sequence ApproximateInt(f(x), x = a..b, opts) ApproximateInt(f(x), a..b, opts) ApproximateInt(Int(f(x), x = a..b), opts)

Parameters

 f(x) - algebraic expression in variable 'x' x - name; specify the independent variable a, b - algebraic expressions; specify the end points of the curve opts - equation(s) of the form option=value where option is one of boxoptions, functionoptions, iterations, method, outline, output, partition, partitiontype, pointoptions, refinement, showarea, showfunction, showpoints, subpartition, view, or Student plot options; specify output options

Description

 • The ApproximateInt(f(x), x=a..b) command returns an approximation to the integral of the expression $f\left(x\right)$ from a to b. By using options, you can specify that the command returns an animation, plot, or inert sum instead. The first two arguments (function expression and range) can be replaced by a definite integral.
 • If the independent variable can be uniquely determined from the expression, the parameter x need not be included in the calling sequence.
 • For Newton-Cotes methods, which include the Trapezoid rule, Simpson's rule, Simpson's 3/8 rule, and Boole's rule, ApproximateInt interpolates a polynomial of appropriate degree across each subinterval and integrates these polynomials to calculate an approximation to the actual integral.
 • The opts argument can contain any of the Student plot options or any of the following equations that (excluding output, method, and partition) set plot options.
 boxoptions = list
 A list of options for the plot of approximating boxes. In the case of Newton-Cotes methods, the upper edge of the box is a polynomial. For more information on plot options, see plot/options.
 functionoptions = list
 A list of options for the plot of the expression $f\left(x\right)$.  By default, the expression is plotted as a solid red line. For more information on plot options, see plot/options.
 iterations = posint
 The number of successive refinements in the animation. By default, the value is $6$.
 method = lower, upper, left, midpoint, right, trapezoid, simpson, simpson[3/8], boole, newtoncotes[posint], random, or procedure
 The method of approximating the integral.  By default, the midpoint Riemann sum is used.

 lower lower Riemann Sum upper upper Riemann Sum left left Riemann Sum midpoint midpoint Riemann Sum right right Riemann Sum trapezoid trapezoid rule simpson Simpson's rule simpson[3/8] Simpson's 3/8 rule boole Boole's rule newtoncotes[N] Newton-Cotes method of degree N random random selection of point in each interval procedure custom procedure

 If a procedure is given, it must take the four arguments: $f\left(x\right),x,{p}_{i},{p}_{i+1}$, where p[i] and p[i+1] are the end points of an interval, and return an algebraic value which is assumed to be a point between the two end points.
 Note: Boole's rule (which is the fourth degree Newton-Cotes method) is sometimes known as Bode's rule.  This is apparently due to an erroneous attribution in the literature.  This command will accept either method=boole or method=bode.
 outline = true or false
 Whether the boxes as a whole are outlined.  Setting this option to true provides a less cluttered image when the partition is large. By default, this value is false.
 output = value, sum, plot, or animation
 This option controls the return value of the function.
 – output = value specifies that the value of the approximation is returned. Plot options are ignored if output = value.  This is the default.
 – output = sum specifies that an inert sum with the appropriate summand is returned. Plot options are ignored if output = sum. Note: The sum form output is not available when the method option is any of upper, lower, or random.
 – output = plot specifies that a plot, which shows the expression and an approximation to the integral on $a,b$, is displayed.
 – output = animation specifies that an animation, which shows the expression and approximations using a sequence of partitions, each of which is a refinement of its predecessor, is displayed.
 partition = posint, list(algebraic), random[algebraic], or algebraic
 The partition option controls the partitioning of the interval $a,b$.
 By default, the partition consists of $11$ equally spaced points, (creating $10$ equally spaced subintervals when partitiontype=subintervals).
 A positive integer value partition=k creates a partition consisting of $k+1$ equally spaced points (creating $k$ equally spaced subintervals when partitiontype=subintervals).
 A list of algebraic values is assumed to be the partition. If the end points are not included in the partition, they are added.  The values are assumed to be sorted in ascending order.
 The value random indexed by an algebraic value c creates a random partition with the width of each subinterval chosen in the closed interval $\left[\frac{c}{2},c\right]$.  The parameter c must evaluate to a positive value.
 An arbitrary algebraic expression given as the value of this option is assumed to be a positive integer and is useful only if the output option is sum.
 partitiontype = subintervals or normal
 The partitiontype option controls the type of partitioning used in solving the approximation.  This option only applies to Newton-Cotes methods, which include the Trapezoid rule, Simpson's rule, Simpson's 3/8 rule, and Boole's rule.
 – partitiontype = subintervals specifies that each subinterval is bounded by consecutive points in the partition, and extra evaluation points intermediate to the partition are used as needed by the formula of each method.  There is no limit on the partition number when using this option.  This is the default.
 – partitiontype = normal specifies that the partition consists exactly of the evaluation points used in approximating the integral. As a result, the number of points in the partition is of the form $nk+1$, where $k$ is the the number of subintervals, and $n$ depends on the method: $n=2$ when using Simpson's rule, $n=3$ when using Simpson's 3/8 rule, $n=4$ when using Boole's rule, and $n=n$ when using a Newton-Cotes[$n$] rule.  This option does not work with partition = random[c].
 pointoptions = list
 A list of options for the plot of the chosen points $\left(x'[i],f\left(x'[i]\right)\right)$ for Riemann sums.  By default, these points are plotted as green circles. For more information on plot options, see plot/options.
 refinement = halve, random, or numeric in (0, 1)
 In an animation, the refinement controls how an interval is subpartitioned.  The default is halve.
 The value halve indicates that the interval is subdivided into two equal subintervals.
 The value random indicates that the interval is randomly subdivided.  The random value is chosen from the average of two uniform distributions.
 A numeric value c must be in the open interval $\left(0,1\right)$ and indicates that the interval $\left[p,q\right]$ is broken into the intervals $\left[p,p+c\left(q-p\right)\right]$ and $\left[p+c\left(q-p\right),q\right]$.
 showarea = true or false
 Whether the approximation of the integral $f\left(x\right)$ is displayed on the plot.  By default, this value is true.
 showfunction = true or false
 Whether the expression $f\left(x\right)$ is plotted.  By default, the value is true.
 showpoints = true or false
 For Riemann sums, whether the chosen points $x'[i]$ are marked. These are the points at which the function $f\left(x\right)$ is evaluated to obtain the height of the corresponding box. By default, the value is true.  This option is ignored for Newton-Cotes methods.
 subpartition = all, width, or area
 In an animation, subpartition controls which intervals are subpartitioned each iteration.  The default is all.
 The value all indicates that every subinterval is subpartitioned.
 The value width indicates that the interval with greatest width is subpartitioned.  If there is more than one interval with largest width, the leftmost is chosen.
 The value area indicates that the interval with greatest area is subpartitioned.  If there is more than one interval with largest area, the leftmost is chosen.
 caption = anything
 A caption for the plot.
 The default caption is constructed from the parameters and the command options. caption = "" disables the default caption. For more information about specifying a caption, see plot/typesetting.

Examples

 > $\mathrm{with}\left(\mathrm{Student}\left[\mathrm{Calculus1}\right]\right):$
 > $R≔\mathrm{Int}\left(x-3,x=-1..1\right)$
 ${R}{≔}{{\int }}_{{-1}}^{{1}}\left({x}{-}{3}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}$ (1)
 > $\mathrm{ApproximateInt}\left(R\right)$
 ${-6}$ (2)
 > $\mathrm{ApproximateInt}\left(\mathrm{ln}\left(x\right),x=1..4\right)$
 $\frac{{3}{}{\mathrm{ln}}{}\left(\frac{{23}}{{20}}\right)}{{10}}{+}\frac{{3}{}{\mathrm{ln}}{}\left(\frac{{29}}{{20}}\right)}{{10}}{+}\frac{{3}{}{\mathrm{ln}}{}\left(\frac{{7}}{{4}}\right)}{{10}}{+}\frac{{3}{}{\mathrm{ln}}{}\left(\frac{{41}}{{20}}\right)}{{10}}{+}\frac{{3}{}{\mathrm{ln}}{}\left(\frac{{47}}{{20}}\right)}{{10}}{+}\frac{{3}{}{\mathrm{ln}}{}\left(\frac{{53}}{{20}}\right)}{{10}}{+}\frac{{3}{}{\mathrm{ln}}{}\left(\frac{{59}}{{20}}\right)}{{10}}{+}\frac{{3}{}{\mathrm{ln}}{}\left(\frac{{13}}{{4}}\right)}{{10}}{+}\frac{{3}{}{\mathrm{ln}}{}\left(\frac{{71}}{{20}}\right)}{{10}}{+}\frac{{3}{}{\mathrm{ln}}{}\left(\frac{{77}}{{20}}\right)}{{10}}$ (3)
 > $\mathrm{ApproximateInt}\left({x}^{\frac{3}{2}},x=1..4,\mathrm{output}=\mathrm{sum}\right)$
 $\frac{{3}{}\left({\sum }_{{i}{=}{0}}^{{9}}{}{\left(\frac{{23}}{{20}}{+}\frac{{3}{}{i}}{{10}}\right)}^{{3}}{{2}}}\right)}{{10}}$ (4)
 > $\mathrm{ApproximateInt}\left(\mathrm{cosh}\left(x\right),1..4,\mathrm{output}=\mathrm{sum}\right)$
 $\frac{{3}{}\left({\sum }_{{i}{=}{0}}^{{9}}{}{\mathrm{cosh}}{}\left(\frac{{23}}{{20}}{+}\frac{{3}{}{i}}{{10}}\right)\right)}{{10}}$ (5)

The command to create the plot from the Plotting Guide is

 > $\mathrm{ApproximateInt}\left(\frac{1}{x},x=1..4,\mathrm{output}=\mathrm{plot}\right)$
 > $\mathrm{ApproximateInt}\left(1+{\left(x-2\right)}^{2},x=0..4,\mathrm{output}=\mathrm{plot},\mathrm{partition}=14,\mathrm{method}=\mathrm{lower}\right)$
 > $\mathrm{ApproximateInt}\left(1+{\left(x-2\right)}^{2},x=0..4,\mathrm{output}=\mathrm{plot},\mathrm{method}=\mathrm{upper},\mathrm{boxoptions}=\left[\mathrm{filled}=\mathrm{false}\right]\right)$

The exact value of the following integral is 2.

To play the following animation in this help page, right-click (Control-click, on Macintosh) the plot to display the context menu.  Select Animation > Play.

 > $\mathrm{ApproximateInt}\left(\mathrm{sin}\left(x\right),0..\mathrm{\pi },\mathrm{output}=\mathrm{animation},\mathrm{partition}=\mathrm{random}\left[1.0\right],\mathrm{refinement}=\mathrm{random},\mathrm{subpartition}=\mathrm{width},\mathrm{iterations}=40,\mathrm{showpoints}=\mathrm{false},\mathrm{outline}=\mathrm{true},\mathrm{boxoptions}=\left[\mathrm{filled}=\left[\mathrm{color}="Burgundy"\right]\right]\right)$