CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
calculuslab

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: calculuslab/Calculus_Lab
Path: blob/main/141-Labs/Lab 10 - Applications of Integration - Volume by Definite Integral.ipynb
Views: 491
Kernel: SageMath 9.2

Lab 10 - Applications of Integration: Volume by Definite Integral

Overview

The topic of Volume of Revolution is often difficult for students to grasp. With different methods, formulations, and rotating axes, this topic may appear confusing at first and adequate practice is a must. In this lab, we will introduce SageMath commands which will help you visualize Volume of Revolution problems.

Important SageMath Commands Introduced in this Lab

ParseError: KaTeX parse error: Undefined control sequence: \hfill at position 32: …|l|l|} \hline \̲h̲f̲i̲l̲l̲ ̲\textbf{Command…
6.1 and 6.2

Example 1

Consider the solid formed by rotating the region between y=xy = x and y=2x2y = 2-x^2 from x=0x=0 to x=1x=1 about the xx-axis. We will use SageMath to plot this solid and then find its volume. First, we use the plot()\textbf{plot}(\dots) command to plot the region before it is rotated.

plot([x,2-x^2], xmin = 0, xmax = 1)

Next, we can use the ParseError: KaTeX parse error: Expected 'EOF', got '_' at position 19: …xtbf{revolution_̲plot3d}(\textit… command to plot the solid formed by rotating this region about the xx-axis.

p1 = revolution_plot3d(2-x^2, (x,0,1), parallel_axis = 'x', show_curve=True, opacity = .75) p2 = revolution_plot3d(x, (x,0,1), parallel_axis = 'x', show_curve=True) show(p1 + p2)

Now that we can see the solid, we can decide whether we should use the disk/washer method to find the volume, or the shell method. For this example, it is easier to use the disk/washer method since we can find the volume with a single integral. Since there is some open space in our solid, we need to use the washer method. Recall that the formula for calculating the volume using the washer method is V=πab(R(x)2r(x)2) dx,V = \pi\int_a^b (R(x)^2 - r(x)^2) \ dx, where R(x)R(x) is the top function and r(x)r(x) is the bottom function. In this example, we have that R(x)=2x2R(x) = 2 - x^2 and r(x)=x.r(x) = x. We can use SageMath to calculate this volume using the integrate()\textbf{integrate}(\dots) command from Lab 9.

def R(x): return 2 - x^2 def r(x): return x show(pi * integrate(R(x)^2 - r(x)^2, x, 0, 1))

Therefore, the solid formed by rotating the region between y=xy = x and y=2x2y = 2-x^2 from x=0x=0 to x=1x=1 about the xx-axis has volume 3815π.\dfrac{38}{15}\pi.

Example 2

Consider the solid formed by rotating the region between y=cos(x)y = \cos(x) and y=sin(x)y = \sin(x) from x=0x = 0 to x=π4x = \dfrac{\pi}{4} about the yy-axis.

plot([cos(x), sin(x)], xmin = 0, xmax = pi/4)

This time, we are revolving the region around the yy-axis. In order to do that, we need to omit the ParseError: KaTeX parse error: Expected 'EOF', got '_' at position 17: …textit{parallel_̲axis = 'x'} from the ParseError: KaTeX parse error: Expected 'EOF', got '_' at position 19: …xtbf{revolution_̲plot3d}(\dots) command.

p1 = revolution_plot3d(cos(x), (x,0,pi/4), show_curve=True, opacity = .75) p2 = revolution_plot3d(sin(x), (x,0,pi/4), show_curve=True) show(p1 + p2)

Now, we need to decide whether we should use the disk/washer method or the shell method. By looking at the solid, we can see that using rectangles which run parallel to the axis of revolution will result in only having to use a single integral to calculate the volume. Therefore, we will use the shell method. Recall that the formula for calculating the volume using the shell method is V=2πabr(x)h(x) dx,V = 2\pi\int_a^b r(x)h(x) \ dx, where r(x)r(x) is the distance that our generic rectangle is from the axis of revolution and h(x)h(x) is the height of our generic rectangle. Since the axis of revolution is the yy-axis, we have that r(x)=xr(x) = x. Since cos(x)\cos(x) is the top function and sin(x)\sin(x) is the bottom function in this region, we see that h(x)=cos(x)sin(x).h(x) = \cos(x) - \sin(x).

def r(x): return x def h(x): return cos(x) - sin(x) show(2 * pi * integrate(r(x)*h(x), x, 0, pi/4))

Therefore, the solid formed by rotating the region between y=cos(x)y = \cos(x) and y=sin(x)y = \sin(x) from x=0x = 0 to x=π4x = \dfrac{\pi}{4} about the yy-axis has volume 12π(2π4).\dfrac{1}{2}\pi (\sqrt{2}\pi - 4).

Example 3

Consider the solid formed by rotating the region in the first quadrant bounded between the functions f(x)=x3f(x) = x^3 and g(x)=7x6g(x) = 7x - 6 about the xx-axis. In order to plot this region, we need to determine the domain for the bounded region. Note that the endpoints of the bounded region are xx-values such that f(x)=g(x)f(x) = g(x). We can use SageMath to find these values.

def f(x): return x^3 def g(x): return 7*x - 6 solve(f(x) == g(x), x)

Since we want the bounded region in the first quadrant, we use the domain [1,2][1,2].

plot([f(x), g(x)], xmin = 1, xmax = 2)
p1 = revolution_plot3d(7*x-6, (x,1,2), parallel_axis = 'x', show_curve=True, rgbcolor=(1,0.5,0), opacity = .5) p2 = revolution_plot3d(x^3, (x,1,2), parallel_axis = 'x', show_curve=True) show(p1 + p2)

For this solid, we can calculate the volume using both the disk/washer method and the shell method. We will use both and verify that they give the same value. First, we will use the disk/washer method. Note that the top function is R(x)=7x6R(x) = 7x - 6 and the bottom function is r(x)=x3.r(x) = x^3.

def R(x): return 7*x - 6 def r(x): return x^3 show(pi * integrate(R(x)^2 - r(x)^2, x, 1, 2))

Now, we will use the shell method. Since we are using the shell method on a solid which was formed by rotating a region about the xx-axis, we need to write the functions f(x)f(x) and g(x)g(x) in terms of yy instead of xx. Note that y=f(x)=x3    x=f1(y)=y1/3y = f(x) = x^3 \implies x = f^{-1}(y) = y^{1/3} and y=g(x)=7x6    x=g1(y)=y+67.y = g(x) = 7x-6 \implies x = g^{-1}(y) = \dfrac{y + 6}{7}. Also, we need to change the bounds x=1x=1 and x=2x=2 to be in terms of yy. We can use either f(x)f(x) or g(x)g(x) to find the corresponding yy-values.

print(f(1)) print(f(2))

Thus, our new bounds are y=1y = 1 and y=8y = 8. Note that from the perspective of the yy-axis, f1(y)f^{-1}(y) is the top function and g1(y)g^{-1}(y) is the bottom function.

y = var('y') def finv(y): return y^(1/3) def ginv(y): return (y+6)/7 show(2 * pi * integrate(y * (finv(y) - ginv(y)), y, 1, 8))

Therefore, using either method, we found that the volume of the solid formed by rotating the region in the first quadrant bounded between f(x)f(x) and g(x)g(x) about the xx-axis is 13021π.\dfrac{130}{21}\pi.

Example 4

Find the volume formed by rotating the following regions about the xx-axis.

  1. y=x2,y=2x,y=0y = x^2, y = 2 - x, y = 0

  2. y=x,y=2x,y=0y = \sqrt{x}, y = 2 - x, y = 0

  3. y=x,y=2x,x=0y = \sqrt{x}, y = 2 - x, x = 0

Example 5

Find the volume formed by rotating the following regions about the yy-axis.

  1. y=1/x,x=2,y=2y = 1/x, x = 2, y = 2

  2. y=x,y=2x,y=0y = \sqrt{x}, y = 2 - x, y = 0

  3. y=x,y=2x,x=0y = \sqrt{x}, y = 2 - x, x = 0