New Student Package Makes Visualizing Calculus 1 Concepts Easy

Copyright 2002 Waterloo Maple Inc.

Maple 8 introduces a new package called Calculus1  that can help educators and students visualize concepts of 1st-year calculus.  You can use the routines in the Calculus1  package to visualize concepts such as tangent lines and derivatives, function inverses, Newton's method, Taylor series approximate integration, surfaces of revolution, and much more.   Calculus1  is a subpackage of the new Student  package in Maple 8.

Getting Started

While any command in the package can be referred to using the long form, e.g., Student[Calculus1][DerivativePlot] ,  it is easier, and often clearer, to load the package first and then just use the shorter command names.

>    restart;

>    with(Student[Calculus1]);

[AntiderivativePlot, ApproximateInt, ArcLength, Asymptotes, Clear, CriticalPoints, DerivativePlot, ExtremePoints, FunctionAverage, FunctionChart, GetMessage, GetNumProblems, GetProblem, Hint, Inflectio...
[AntiderivativePlot, ApproximateInt, ArcLength, Asymptotes, Clear, CriticalPoints, DerivativePlot, ExtremePoints, FunctionAverage, FunctionChart, GetMessage, GetNumProblems, GetProblem, Hint, Inflectio...
[AntiderivativePlot, ApproximateInt, ArcLength, Asymptotes, Clear, CriticalPoints, DerivativePlot, ExtremePoints, FunctionAverage, FunctionChart, GetMessage, GetNumProblems, GetProblem, Hint, Inflectio...
[AntiderivativePlot, ApproximateInt, ArcLength, Asymptotes, Clear, CriticalPoints, DerivativePlot, ExtremePoints, FunctionAverage, FunctionChart, GetMessage, GetNumProblems, GetProblem, Hint, Inflectio...

The following examples show how the various routines work.  In some cases, examples show how to use these visualization routines in conjunction with the single-stepping Calculus1  routines.

Tangents, Inverses, and Sampling

Tangents

The Tangent  routine returns the tangent to a curve at a given point.  By including the output  option, you can control the return value of the function.  Other possibilities include output = plot and output = slope.

>    Tangent( sin(x), x=1, output = line );

x*cos(1)+sin(1)-cos(1)

Where the tangent is vertical, an equation form is returned.

>    Tangent( surd(x,3), x=0, output = line );

x = 0

>    Tangent( sin(x), x=1, output = plot );

[Maple Plot]

>    Tangent( surd(x - 1,3), x=1.2, output = plot );

[Maple Plot]

Inverse of a Function

The inverse of a function can be plotted using the InversePlot  routine.  The default plot domain and range are chosen to the display reasonable  portions of both the function and its inverse.

>    InversePlot( sin(x), x=0..4*Pi );

[Maple Plot]

>    InversePlot( tan(x), x=0..Pi );

[Maple Plot]

>    InversePlot( (3*x^3 + x + 1)/(x^2 + 1), x=-3..3 );

[Maple Plot]

>   

The Failures of Approximating by Sampling

One reason for studying derivatives is to get qualitative information about a function.  The easiest way to sketch a function is to sample it at a number of points and connect the dots.  For example, sampling the function sin(12*x)  at the points x  = 0, 1, 2, 3, 4 , and 5  would suggest the following approximation (shown in blue), and knowing that the sine function oscillates, one may be satisfied with this result.  The actual expression is plotted in red.

>    PointInterpolation(sin(12*x), x=0..5 );

[Maple Plot]

In the following example, the global cubic behavior is very well picked up by the sampling, but the asymptote at x = -1

 is completely missed.

>    PointInterpolation( (x^4 - 2*x^3 - 3*x^2 + 3*x + 1)/(x + 1), x=-6..6 );

[Maple Plot]

In other cases, some of the behavior of the expression may occur outside the region you are sampling on.  The following misses that the expression goes to infinity , and not -infinity  as the plot would suggest.      

>    PointInterpolation(x^4-3*x^3-x+3, x=-2..2);

[Maple Plot]

>   

Derivatives

Newton Quotients

The slope of the line connecting the two points `<,>`(a,b)  and `<,>`(c,d)  is given by the formula (d-b)/(c-a) .  Given a function f(x) , a point x[0] , and a value, the slope of the line between the points `<,>`(x[0],f(x[0]))  and `<,>`(x[0]+h,f(x[0]+h))  is thus (f(x[0]+h)-f(x[0]))/(x[0]+h-x[0]) , which simplifies to (f(x[0]+h)-f(x[0]))/h   

>    NewtonQuotient( f(x), x = x[0], h = h );

(f(x[0]+h)-f(x[0]))/h

We can define a given sequence of values of h  and use this to calculate the Newton Quotient at these parameters.

>    hl := [seq( 1/2^n, n=1..10 )];

hl := [1/2, 1/4, 1/8, 1/16, 1/32, 1/64, 1/128, 1/256, 1/512, 1/1024]

>    NewtonQuotient( sin(x), x=2.0, output=value, h = hl );

-.6216505654, -.5248969196, -.4718210960, -.4442822560, -.4302857216, -.4232336448, -.4196945280, -.4179217408, -.4170345472, -.4165905408
-.6216505654, -.5248969196, -.4718210960, -.4442822560, -.4302857216, -.4232336448, -.4196945280, -.4179217408, -.4170345472, -.4165905408

In this case, the slope approaches the value of the derivative at the point 2.0:

>    eval( diff( sin(x), x ), x = 2.0 );

-.4161468365

This convergence to the derivative can be seen using the option output = animation  

>    NewtonQuotient( sin(x), x=2.0, output=animation, h = hl );

[Maple Plot]

>   

Plotting the Derivative

You can easily plot an expression and its derivative using the DerivativePlot  routine.

>    DerivativePlot(x*sin(x), x=-3..3);

[Maple Plot]

The option order  may be used to plot more than just the first derivative.  In the next example, the first 4 derivatives of   x^4-4*x+3  are plotted, where the 1st and 4th derivatives are colored blue and green, respectively, and the intermediate derivatives are interpolated between blue and green.  The function itself is plotted in red.

>    DerivativePlot(x^4-4*x+3, x=-3..3, order = 1..4);

[Maple Plot]

The following example plots the expression (x^2-x)*exp(x)  and the first 10 derivatives.  To control the range of the y axis, we simply specify that the default view runs from -2 to 10.

>    DerivativePlot((x^2 - x)*exp(x), x=-5..1, order = 1..10, view = [DEFAULT, -2..10]);

[Maple Plot]

>   

Various Theorems about Derivatives

Rolle's Theorem

Rolle's theorem states that if f  is a function which satisfies:

  • 1.  f is continuous on the closed interval [a, b] ,
  • 2.  f is differentiable on the open interval ( a, b ), and
  • 3.   f(a) = f(b)

then there exists a point c  in the open interval ( a, b ) such that f'( c ) = 0.

The routine RollesTheorem  takes an expression representing the function, checks that the requirements of the theorem hold, and plots the expression and all points where the derivative is zero.

>    RollesTheorem(x*(x - 4), x=1..3);

[Maple Plot]

 If the output=points  option is included, the points that satisfy Rolle's theorem will be returned.

>    RollesTheorem(x*(x - 4), x=1..3, output=points);

[2]

>    RollesTheorem(sin(x), 1..2*Pi + 1);

[Maple Plot]

>   

The Mean Value Theorem

The Mean Value Theorem is a generalization of Rolle's Theorem which states that if f  is a function which satisfies:

  • 1.  f is continuous on the closed interval [a, b] , and
  • 2.  f is differentiable on the open interval ( a, b ),

then there exists a point c  in the open interval ( a, b ) such that f'( c ) = (f(b)-f(a))/(b-a)  where the right hand side is the slope of the line connecting the points ( a, f(a) ) and ( b, f(b) ).  Rolle's theorem follows from this since the right hand side is 0  if f(a) = f(b) .

The MeanValueTheorem  routine plots the expression and all points where the derivative equals the slope of the secant line connecting the endpoints of the graph of   f  on [a, b] .  We simply enter an expression representing the function and this routine checks that the requirements of the theorem hold before displaying the result.  

Similarly with the RolesTheorem  routine, if output=points  is stated in the definition input, then only the points that satisfy the Mean Value Theorem are returned.

>    MeanValueTheorem(x^3 - 5*x^2 + 8*x - 1, x=1..3, output=points);

[7/3]

>    MeanValueTheorem(x^3 - 5*x^2 + 8*x - 1, x=1..3);

[Maple Plot]

>    MeanValueTheorem(sin(x), x=-4..2*Pi);

[Maple Plot]

>   

Applications of Derivatives

Taylor Approximations

If at a point c , a function f  has a power series expansion
                    
f(x) = Sum(a[n]*(x-c)^n,n = 0 .. infinity)
the coefficients
a[n]  are given by
                   
a[n] = (f^``(n))(c)/n!

where (f^``(n))(c)  is the n'th  derivative of f  evaluated at the point c .  Named after the English mathematician Brook Taylor, this infinite series is called the Taylor expansion of the function f  at c .

The Taylor expansion of the exponential function exp(x)  is:
                  
exp(x) = Sum(x^n/n!,n = 0 .. infinity)

from which it follows that:

                     exp(1) = Sum(1/n!,n = 0 .. infinity)

Using the TaylorApproximation  routine, we enter both an expression and a point around which to expand to demonstrate this approximation

>    TaylorApproximation(x^7 - 5*x^5 + 4*x^4 - 7*x^2 + 3, x=1, order=3);

8*x-12*x^2

By stating output=plot  in the input definition, we see that the polynomial x^7-5*x^5+4*x^4-7*x^2+3  behaves like 8*x-12*x^2  around the point x = 1 .

>    TaylorApproximation(x^7 - 5*x^5 + 4*x^4 - 7*x^2 + 3, x=1, order=3, output=plot);

[Maple Plot]

By stating output=animation , an animation is displayed of the expression and the specified Taylor approximations (arranged by approximation order).  To start the animation, we simply right click the graph region and select Animation..Play.

>    TaylorApproximation(sin(x), x=1, output=animation, order=1..16, view=[-2*Pi..2*Pi, DEFAULT]);

[Maple Plot]

The derivative of the arctan function has singularities at I  and -I , and therefore the radius of convergence of the Taylor approximation around the origin is 1 .  We can see this behaviour by animating the plot.

>    TaylorApproximation(arctan(x), x=0, output=animation, order=1..20, view=[-3..3, DEFAULT]);

[Maple Plot]

>   

Function Chart

The FunctionChart  routine plots a function and shows regions of positive and negative sign, increasing and decreasing, and positive and negative concavity.  By default,

  • 1.  Roots are marked with circles,
    2.  Extreme points are marked with diamonds,
    3.  Inflection points are marked with crosses,
    4.  Regions of increase and decrease are marked with red and blue, respectively, and
  • 5.  Regions of positive and negative concavity are marked with yellow and green fill, respectively, with arrows point in the direction of the concavity.

>    FunctionChart(sin(x), x=0..2*Pi);

[Maple Plot]

>    FunctionChart(x^4 + 2*x^3 - 9*x^2 - 3*x + 6, x=-4.5..3, view=[DEFAULT, -50..75]);

[Maple Plot]

>   

Newton's Method

Given a point a  and an expression f(x) , we could argue that the x -intercept of the tangent line through ( a , f(a) ) may be an approximation to a root of the original expression f(x) .  

>    Tangent(f(x), x=a, output=line);

x*diff(f(a),a)+f(a)-diff(f(a),a)*a

Convert the previous result to use the D  operator in Maple.

>    collect(convert(%, D),D(f)(a));

(x-a)*D(f)(a)+f(a)

We solve the previous expression for x when the expression is equal to zero.

>    solve(% = 0, x);

(-f(a)+D(f)(a)*a)/D(f)(a)

By expanding the previous expression, Newton's Method is displayed.

>    result:=expand(%);

result := -1/D(f)(a)*f(a)+a

As an example, consider the function F(x) = x^2-1  and an initial point x = 2.0

>    F := x -> x^2-1;

F := proc (x) options operator, arrow; x^2-1 end proc

Placing this function and initial point into expression named "result", we can see the approximation for solving this function.

>    aroot := 2.0 - F(2.0)/D(F)(2.0);

aroot := 1.250000000

aroot := 1.000000000

aroot := 1.025000000

aroot := 1.000304878

aroot := 1.000000046

aroot := 1.000000000

For better results to see where this function and initial point converges, lets repeat this another 9 times.

>    for i from 1 to 5 do
    aroot := aroot - F(aroot)/D(F)(aroot);
end do;

aroot := 1.025000000

aroot := 1.000304878

aroot := 1.000000046

aroot := 1.000000000

aroot := 1.000000000

Using the NewtonsMethod  routine, we may go through the same process easily.

>    NewtonsMethod(F(x), x=2, output=sequence);

2, 1.250000000, 1.025000000, 1.000304878, 1.000000046, 1.000000000

>    NewtonsMethod(F(x), x=2, output=plot);

[Maple Plot]

>    NewtonsMethod(sin(x)/x, x=1, output=plot);

[Maple Plot]

The root to which a sequence of Newton iterations converges to depends on the initial point.

>    NewtonsMethod(sin(x)/x, x=2, output=plot);

[Maple Plot]

In general, when the root is not a double root, Newton's method is very efficient.  In the following example with Digits  set to 30 , Newton's method converges to the root after just 7  iterations.

Compute all floating point approximations with 30 digits of precision.

>    Digits := 30:

>    NewtonsMethod(x^4-4*x^3+4*x^2-3*x+3, x=1, output=sequence, iterations=10);

1, 1.33333333333333333333333333333, 1.28318584070796460176991150443, 1.28231623816647766759714731909, 1.28231595363411166690275078928, 1.28231595363408116582940754743, 1.28231595363408116582940754709, ...
1, 1.33333333333333333333333333333, 1.28318584070796460176991150443, 1.28231623816647766759714731909, 1.28231595363411166690275078928, 1.28231595363408116582940754743, 1.28231595363408116582940754709, ...
1, 1.33333333333333333333333333333, 1.28318584070796460176991150443, 1.28231623816647766759714731909, 1.28231595363411166690275078928, 1.28231595363408116582940754743, 1.28231595363408116582940754709, ...
1, 1.33333333333333333333333333333, 1.28318584070796460176991150443, 1.28231623816647766759714731909, 1.28231595363411166690275078928, 1.28231595363408116582940754743, 1.28231595363408116582940754709, ...

Reset the value of digits to the default value of 10.

>    Digits := 10:  

>   

Integration

Approximating an Integral

The methods of approximating an integral fall into two categories:

     1.  Riemann sums, and

     2.  Newton-Cotes methods.

Riemann sums approximate an integral by summing the areas of adjacent rectangles, where the height of the rectangle depends on the value of function in that interval.

Newton-Cotes methods assume knowledge of integration of polynomials, interpolate the function on each sub-interval, and integrate this interpolating polynomial.  The trapezoid rule is a case where the approximating polynomial is a linear function, and Simpson's rule uses quadratic functions to approximate the expression.

The ApproximateInt  routine accepts the following methods when approximating the integral.

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

By default, the midpoint Riemann sum is used.

>    ApproximateInt(cos(x), x=0..20, output=plot);

[Maple Plot]

>    ApproximateInt(sin(x), x=0..20, method=simpson, output=plot);

[Maple Plot]

In every case, an animation may be returned where each frame shows a refinement of the previous partition.

>    ApproximateInt(sin(x), x=0..3*Pi/2, output=animation);

[Maple Plot]

An interesting variation is to begin with a random partition, and at each step, choose a refinement which divides the largest sub-interval randomly:

>    ApproximateInt(sin(x), x=0..4*Pi, partition = random[2], subpartition=width, refinement=random, output=animation, iterations=50);

[Maple Plot]

When doing this with a partition, you may note how the total area appears to converge to a value and then jumps.

>    ApproximateInt(1/(x^2 - 2), x=-2..2, partition = random[2], subpartition=width, refinement=random, output=animation, iterations=50);

[Maple Plot]

>   

Antiderivatives

Given a function f(x) , an antiderivative of f(x)  is any function F(x)  such that diff(F(x),x) = f(x) .  By this definition, if F(x)  is an antiderivative of f(x) , then so is F(x)+c  for any constant c .

The routine AntiderivativePlot  can plot either a single antiderivative or a class of antiderivatives.

>    AntiderivativePlot( x^3 - 2*x^2 - 4*x + 2, x=-2..2 );

[Maple Plot]

By including the showclass  option, the class of antiderivatives are viewed.

>    AntiderivativePlot( x^3 - 2*x^2 - 4*x + 2, x=-2..2, showclass );

[Maple Plot]

>   

Applications of Integration

Function Average

The FunctionAverage routine command returns the average value of a function f(x)  on the interval [a, b] .where the output can be either the integral, value or plot of the function.

>    FunctionAverage(f(x), x=a..b, output=integral);

1/(b-a)*Int(f(x),x = a .. b)

>    FunctionAverage(sin(x) + x, x=0..2*Pi, output=plot);

[Maple Plot]

The integral output  option can be used with the single-stepping functionality.  For more information on single-stepping functionality, visit the Maple Application Center and refer to the Single Stepping worksheet from the Maple 8 Demos category or refer to Maple's extensive help pages and locate Single Stepping Overview.

>    FunctionAverage(sin(x) + x, x=0..2*Pi, output=integral);

1/2*1/Pi*Int(sin(x)+x,x = 0 .. 2*Pi)

We can see that the sum  rule would be the next step in solving this problem. Since we understand this rule, we apply it to the previous output

>    Rule[sum](%);

1/2*1/Pi*Int(sin(x)+x,x = 0 .. 2*Pi) = 1/2*(Int(sin(x),x = 0 .. 2*Pi)+Int(x,x = 0 .. 2*Pi))/Pi

The next step in solving this problem requires the sin  rule.  Apply the sin  rule to the previous output.  ie to  1/2*(Int(sin(x),x = 0 .. 2*Pi)+Int(x,x = 0 .. 2*Pi))/Pi

>    Rule[sin](%);

1/2*1/Pi*Int(sin(x)+x,x = 0 .. 2*Pi) = 1/2*1/Pi*Int(x,x = 0 .. 2*Pi)

To complete the problem we apply the power  rule to the previous output.  ie to 1/2*1/Pi*Int(x,x = 0 .. 2*Pi)

>    Rule[power](%);

1/2*1/Pi*Int(sin(x)+x,x = 0 .. 2*Pi) = Pi

>   

Volume of Revolution

The VolumeOfRevolution  routine finds the volume of revolution of a curve given a function f(x) .  The graph is rotated around the x -axis, if the output  option is set equal to plot, where the red line represents the value of the function.  You can also ask what the volume of the resulting solid is or display the inert integral with the appropriate integrand through the output options.

>    VolumeOfRevolution(sin(x) + 2, x=0..4*Pi, output=plot);

[Maple Plot]

The volume of this 3-D shape is given by the integral:

>    VolumeOfRevolution(sin(x) + 2, x=0..4*Pi, output=integral);

Int(Pi*(sin(x)+2)^2,x = 0 .. 4*Pi)

The volume of this 3-D can also be calculuated using the value  command by referring to the previous integral.

>    value(%);

18*Pi^2

Similarly, one can rotate the graph of f(x)  around the y -axis.  In this case, we ask what is the volume under the resulting surface.

>    VolumeOfRevolution(-cos(x), x=Pi/2..Pi, output=plot, axis=vertical);

[Maple Plot]

This volume is given by displaying the integral of the expression.

>    VolumeOfRevolution(-cos(x), x=Pi/2..Pi, output=integral, axis=vertical);

Int(-2*Pi*x*cos(x),x = 1/2*Pi .. Pi)

>    value(%);

2*Pi+Pi^2

You may also ask what is the volume between two functions rotated around an axis.  Consider the two expressions (x-1)^10+1  and x  on the interval [1, 2] .

>    VolumeOfRevolution((x-1)^10 + 1, x, x=1..2, output=plot);

[Maple Plot]

>    VolumeOfRevolution((x-1)^10 + 1, x, x=1..2, output=plot, axis=vertical);

[Maple Plot]

Calculate the volume of the shapes displayed previously.

>    VolumeOfRevolution((x-1)^10 + 1, x, x=1..2);

-85/77*Pi

>    VolumeOfRevolution((x-1)^10 + 1, x, x=1..2, axis=vertical);

-29/22*Pi

>   

Negative Values

The interpretation of negative values requires some explanation.  When rotating a function around the xx -axis the volume is always positive.

>    VolumeOfRevolution(abs(sin(x)), x=0..2*Pi);

>    VolumeOfRevolution(sin(x), x=0..2*Pi);

Pi^2

Pi^2

When the expression is rotated around the y -axis, the function must be properly analyzed.

>    VolumeOfRevolution(sin(x - 1), x=-4..2, axis=vertical);

2*Pi*sin(1)-4*Pi*cos(1)+2*Pi*sin(5)-8*Pi*cos(5)

When we evaluate the previous result, the volume size is negative.

>    evalf(%);

-14.65682811

In order to get the volume of this object, we first look at the volume and a profile.

>    VolumeOfRevolution(sin(x - 1), x=-4..2, axis=vertical, output = plot);

[Maple Plot]

The profile of this object is shown by displaying a plot of sin(x-1)  ranging from -4  to 2  as stated in our original problem.  Since the expression is rotated around the x-axis, a second plot is required of sin(-x-1)  ranging from -2 to 4.   

>    plots[display]( plot( sin(x - 1), x=-4..2, filled=true ), plot( sin(-x - 1), x=-2..4, filled = true, color = blue ) );

[Maple Plot]

From the profile displayed above, we calculate the volume by identifying all sections of the object.

>    VolumeOfRevolution(sin(-x - 1), x=Pi - 1..4, axis=vertical) +
VolumeOfRevolution(-sin(-x - 1), x=0..Pi - 1, axis=vertical) +
VolumeOfRevolution(sin(x - 1), x=1..2, axis = vertical);

-2*Pi*sin(5)+8*Pi*cos(5)+4*Pi^2-2*Pi-4*Pi*cos(1)

>    evalf(%);

39.55990051

>   

Arc Length

Given a function f(x) , you may ask what the length of the curve (or arc) is from the point ( a, f(a) ) to the point ( b, f(b) ).  The formula can be shown using the ArcLength  routine.

>    ArcLength(f(x), x=a..b, output=integral);

Int((diff(f(x),x)^2+1)^(1/2),x = a .. b)

When calling ArcLength  with the plot output  option, three curves are plotted:

  1.  The expression in red,

  2.  The integrand in blue,

  3.  The expression Int(sqrt(diff(f(s),s)^2+1),s = a .. x)  and thus, the value of the green line at the point b is the total arc length of the curve.     

>    ArcLength(2*sin(x), x=0..2*Pi, output=plot);

[Maple Plot]

In general, the resulting integrand can be difficult to solve except for very simple cases.

Simple Example Using Single Stepping

By returning the integral to the Arc Length of a function, we step through the problem.

>    ArcLength(x^2 - ln(x)/8, x=1..3, output=integral);

Int(1/8*((16*x^2+1)^2/x^2)^(1/2),x = 1 .. 3)

Before stepping through the problem, we will simply the previous result.

>    simplify(%);

1/8*Int((16*x^2+1)/x,x = 1 .. 3)

We see that the next step in this problem is to rewrite it.

>    Rule[rewrite, (16*x^2+1)/x = 16*x+1/x](%);

Creating problem #3

1/8*Int((16*x^2+1)/x,x = 1 .. 3) = 1/8*Int(16*x+1/x,x = 1 .. 3)

The sum  rule should be applied next.  We apply the sum  rule to   1/8*Int(16*x+1/x,x = 1 .. 3)

>    Rule[sum](%);

1/8*Int((16*x^2+1)/x,x = 1 .. 3) = 1/8*Int(16*x,x = 1 .. 3)+1/8*Int(1/x,x = 1 .. 3)

The constant multiple rule is the next step and should be applied to 1/8*Int(16*x,x = 1 .. 3)+1/8*Int(1/x,x = 1 .. 3)

Rules can be applied using the rule name (constantmultiple) or an alternative name (`c*`).  Refer to the help pages for a complete list of alternate names for rules.

>    Rule[`c*`](%);

1/8*Int((16*x^2+1)/x,x = 1 .. 3) = 2*Int(x,x = 1 .. 3)+1/8*Int(1/x,x = 1 .. 3)

The power rule is next

>    Rule[`^`](%);

1/8*Int((16*x^2+1)/x,x = 1 .. 3) = 8+1/8*Int(1/x,x = 1 .. 3)

Finally, the power rule must be applied again to 8+1/8*Int(1/x,x = 1 .. 3)   .

>    Rule[`^`](%);

1/8*Int((16*x^2+1)/x,x = 1 .. 3) = 8+1/8*ln(3)

Advanced Example Using Hyperbolic Cosine

One special case is the hyperbolic cosine function which is defined as:
                
cosh(x) = (exp(x)+exp(-x))/2  
Among other uses, this function gives the shape of a wire hanging from two points:

>    plot( cosh(x), x=-1..1.1);

[Maple Plot]

In this special case, the length of the curve cosh(x)  is equal to the integral of cosh(x) .

>    ArcLength(cosh(x), x=-1.0..1.1);

2.510848664

>    int(cosh(x), x=-1.0..1.1);

2.510848664

>   

Surface of Revolution

The SurfaceOfRevolution  routine finds the surface of revolution of a curve given a function f(x) .  Similar to the VolumeOfRevolution  routine, you can rotate its graph around the x -axis and ask what the area of the resulting surface is.  The red line represents the value of the function on the graph.

>    SurfaceOfRevolution(sin(x) + 2, x=0..4*Pi, output=plot);

[Maple Plot]

By stating the output=integral  option, the area of this surface is given.

>    SurfaceOfRevolution(sin(x) + 2, x=0..4*Pi, output=integral);

Int(2*Pi*(sin(x)+2)*(cos(x)^2+1)^(1/2),x = 0 .. 4*Pi)

Another example

>    SurfaceOfRevolution(exp(x), x=0..1, output=integral);

Int(2*Pi*exp(x)*(exp(x)^2+1)^(1/2),x = 0 .. 1)

>    value(%);

Pi*exp(1)*(exp(2)+1)^(1/2)+Pi*ln(exp(1)+(exp(2)+1)^(1/2))-Pi*2^(1/2)-Pi*ln(2^(1/2)+1)

Similarly, one can rotate the graph of f(x)  around the y -axis and ask what the area of the resulting surface is.

>    SurfaceOfRevolution(sin(x) + 2, x=2*Pi..4*Pi, output=plot, axis=vertical);

[Maple Plot]

When determining the area of the surface of revolution around the x - or y -axis, the difference to the integrand is limited to the term multiplying the square root in the integrand:

>    SurfaceOfRevolution(f(x), x=a..b, output=integral);

Int(2*Pi*f(x)*(diff(f(x),x)^2+1)^(1/2),x = a .. b)

>    SurfaceOfRevolution(f(x), x=a..b, output=integral, axis=vertical);

Int(2*Pi*x*(diff(f(x),x)^2+1)^(1/2),x = a .. b)

Negative Values

The interpretation of negative values requires some explanation.  When rotating a function around the x -axis, a negative value of the function is interpreted as a negative surface.

>    SurfaceOfRevolution(sin(x), x=0..2*Pi);

0

The absolute value function can be used to get the expected value.

>    SurfaceOfRevolution(abs(sin(x)), x=0..2*Pi);

4*Pi*2^(1/2)+2*Pi*ln(2^(1/2)+1)-2*Pi*ln(2^(1/2)-1)

Similarly, when the graph is rotated around the y -axis, negative x  values may be interpreted as negative surface values.

>    SurfaceOfRevolution(cosh(x), x=-Pi..Pi, axis=vertical);

0

If the function is symmetric, the integral should be calculated from the origin, otherwise the surface area is added twice.

>    SurfaceOfRevolution(cosh(x), x=0..Pi, axis=vertical);

Pi*(Pi*exp(Pi)^2-exp(Pi)^2-Pi-1+2*exp(Pi))/exp(Pi)

When the function is not symmetric, the sum of each positive branch should be added:

>    SurfaceOfRevolution(exp(x), x=0..Pi, axis=vertical) + SurfaceOfRevolution(exp(-x), x=0..Pi, axis=vertical);

int(2*Pi*x*(exp(x)^2+1)^(1/2),x = 0 .. Pi)+int(2*Pi*x*(exp(-x)^2+1)^(1/2),x = 0 .. Pi)

>    SurfaceOfRevolution(exp(x), x=-Pi..Pi, axis=vertical, output=plot);

[Maple Plot]