00:00

you’ll learn how to use python to find the volume of a solid of revolution

using the disk method we’ll work through several problems so

let’s see how to do this step by step let’s do some math [Music]

hi everyone welcome back i’m dave so we’re going to begin with the

question uh what is a solid of revolution so solid of revolution is a solid that

is generated by revolving a plane region about a line

that lies in the same plane as the region so for example this line is called the

axis of revolution so let’s look at some familiar examples so let’s say the axis

of revolution here is say the x-axis or some horizontal

line and i want to revolve it around and

00:01

i have this object right here this plane region right here and it’s just a

rectangle and so if we if we revolve this around the uh x-axis for example

then uh what we get is a right circular cylinder

so we’re going to end up revolving this area right here this region right here

and when we revolve this around the x-axis then we’re going to get this

right circular cylinder here so right circular cylinder and

you know what if we revolve say a semi-circle so if we have something like

a semi-circle like that and we revolve this around the x-axis

then now we’re going to get a sphere and so i’ll just draw it like that so

now if we revolve this area the semi-circle right here the

00:02

top part of the circle and we revolve it around the x-axis then we’re going to

get a sphere out of all that and then what about if we have a uh

right triangle right here so have like a right triangle right here

and we’re looking at revolving this area reach this region right here around the

x axis right here so this will now be a what what do you think we’ll get here

right so this re this region right here gets revolved i’ll just draw a

circle right there and so we get a right circular cone right there

so this will be a solid cone right here and it’ll be a right

uh right angle cone right there um and so then you know what if we get

something like this which is something that will look in um

in a in the next episode but what about if say your rectangle just isn’t flush

with your axis of revolution what if your rectangle is say floating up here

00:03

right so let’s say that’s a rectangle right there and there’s my region right

there and i’m going to revolve it around the x-axis and so now

what we’re going to get here is a solid and it’s it’s going to

it’s going to be like a hollow pipe so it’s going to because part of this

has been removed so think about it is you know you got that and then you got

an inside that’s been removed there it comes over here and then comes over here

and so we can draw it like this but this part right here has been removed so

just that part in there it’s so it’s been hollowed out the

hollowed right circular cylinder and so there’s some examples there

00:04

of generating some solids by using some of the common shapes that you know of

and so let’s see here uh yeah and so let’s see what’s next

here so next i want to talk about how do we do this what the disk method is

um and so what we’re going to say here is that

we’re going to start with a continuous function non-negative on closed interval

so it’s non-negative right it may touch but it’s not but it’s you know zero

positive right so and let um r be a region that’s bounded above by the curve

and below the x-axis and on both sides right so let’s sketch a you know graph

of that something like this right here so we’re going to be looking like this

right here and we got this function and it’s not negative so it could touch the

x-axis but i’m just going to draw it for

the sake of drawing it here i’m going to

in fact let’s draw it in blue right here so let’s draw this function right here

and we’re going to be stuck between a and b right here so let’s put an a right

00:05

here and let’s put a b right here and chop this off at a b right there

and so you know we’re bounded above um and so we’re bounded above by this below

by the x-axis and on both sides by the line and so

basically this is just the region under the curve us on a to b and we know how

to find this area of this region right here from calculus one right calculus

one shows us how to find the area of that region right there but now what

we’re going to be doing is we’re going to be taking this region right here and

revolving it around the x-axis and we’re going to actually be trying to find the

volume of the solid and not just the area of the region so we’re going to

revolve this around the x-axis here and what we’re going to end up with is

when we revolve this around we’re going to get a solid

so let’s see if we can sketch that so i’m going to put this line here and

then now i’m going to try to sketch this graph right here again

but let’s say over here it’s going to come up a little bit and come down all

00:06

right and so then let’s say this is a right here again and

we have b right here again and revolving around the x-axis and

so what’s going to happen when when we revolve this around it’s going to come

up with the lower part here which is symmetric right here so it’s going to

come up and then it’s going to go about down like this and then it’s going to

come back like that well let’s make it a little bit better

and then come up and go down like that and so what we’re going to get here is

put this in orange i guess so we’re going to you know get this

cylinder right here and this disc right here also and

we have a disc in here that’s going to kind of be used to represent it

and so we’ll just dot this in here and this is an x

00:07

right because this is going from a to b and this will be just an x and this uh

radius right here uh let’s maybe try to put that in red

so this radius right here is the important part to look at so that right

radius right there is f of x that’s the height right you plug in an x and you go

up and you get the height out which is the f of x and so

the area of the cylinder here so the area of the cylinder is what it’s a of x

because it’s going to depend upon x where the x is

right so over here we’ll have smaller cylinders over here we will have a large

cylinder and then it curves in a little bit

anyway so it depends upon the x right the area and it’s just going to be pi

r squared but the r the radius is given by the function height so pi r squared

00:08

and so that will be the area of the uh the cross-sectional area right there and

so that’s what we’ll say here so we’re going to find the volume of the

solid of revolution that’s generated let’s move this f of x down here

so that’s the height at x and that’s generated by revolving this

region right here around the x-axis right there all right so

so observe that the cross-sectional area right here

of the solid taken perpendicular to the x-axis right here um

at the point x is a circular disk and this is the radius of the circular disk

so it’s important to understand that because you know

as your problems uh switch and change you need to be able to adapt these ideas

so this is this is a very nice situation in the sense that

you got one function you got a closed bounded interval

00:09

um if you looked back at the episodes on finding the area between curves often

you have to break your solid or or whatever you’re working with into pieces

into a finite number of pieces and and so you may apply this problem to

different pieces um and so yeah the area of this region here is

pi f of x squared and so the volume is given by by integrating or adding up all

those little small little pieces and so this right here will be the the um

the volume of the solid right here um so actually the volume of the solid b um

this is not the volume of solid this is the area here so the volume of the solid

will be um actually we need to fix this real quick so we’ll just say pi

and then let’s put parentheses in here and raise this up to the power 2.

00:10

so let’s see if we can get this going here so yeah we want to update the

file right here so we want to update this right here there’s the volume of

the solid so it’s pi and then r squared and then so basically what we’re doing

is we’re adding up all the cross-sectional areas and we’re doing

them infinitely small and that and that’s what we mean by using the

integral right there all right so good now some people like to put the square

brackets just to make it a little bit more readable

so we can put the square brackets on that right there

and yeah so let’s put the square brackets on there and there there’s the

nice formula there all right so let’s look at some examples now let’s look at

our first example and so this was what our first example

is going to be here let’s get this out of the way real quick all right and so

now before we do this example right here i’m going to do this by hand but we’re

00:11

also going to do this by python so i want to quickly look at the setup of the

python that we’re going to use real quick before we start doing our first

example here so let’s switch over to a python notebook here now if you’ve never

used a python before there’s a link below in the description

and when you look at the link in the description you’ll get a you’ll be able

to open up a new blank python notebook and you can type up uh what we show what

i show here of course if you already have python set up you know i recommend

using jupyter notebook you can install it install it using anaconda or

something like that but let’s look and see uh what we’re going to do here in

this episode so first off we’re going to

do a setup here and this is the packages that we need to uh import so that our

work will be a lot easier so we’re going to import the numpy package as mp and

we’re going to make some plots so we’re going to import the math plot library as

plt and we’re going to do some integrating so we’re going to integrate the scipy

00:12

package and we’re going to use the integrate method there and i’m also

going to so let’s um hit shift enter on this cell right here so just click in

there and hit shift enter and then i’m also going to customize my

axes so i’m going to make some plots and

if you’ve watched any of the episodes so

far you know that i like to customize my axes so they look like axes that you

would see in a math course and so there’s our setup there and so now we’re

going to start looking at some examples and so here’s our first example right

here and here’s how we’re going to do it in python

but before we do that let’s go see how to do this by hand

and so what we have here is find the volume of the solid that’s obtained in

this region right here so let’s sketch this region right here in fact i’ll

sketch it down here let’s say so i’m gonna i’m gonna have this region

right here and i like to put this in blue so i’m gonna put the square root

function right here in blue it’s just going up like that now i’m looking on

one to four so let’s put here one to four let’s say

00:13

one is here and four is here and i’m going to be looking at this region right

here between one and four and i’m going to be shading this region

in right here this is the region right here that we’re revolving around and

we’re going to be revolving around the x-axis there so when we revolve this

around the x-axis we’re going to get a volume and our goal is to find the

volume of that solid we’re going to get a solid and we’re we’re going to find

the volume of that so we’re going to revolve around the x-axis there

all right so this is just y equals square root of x

and so now let’s do this here so so the volume is going to be

and we’re going to integrate from one to four so one to four

and we need the cross-sectional area so what is the cross-sectional area going

to be if we make a say a disc so we’re going to have a rectangle right here and

we’re going to be revolving that rectangle around here and when we

revolve it around here it’s going to turn into a disc and so we pick an

00:14

x right there and so what is the radius of this disc going to be remember the

area of a circle is going to be pi r squared so this is going to be pi

and then to get the height it’s just going to be square root of x

and then we’re going to square that so pi r squared or pi and then the

height squared and then this will be dx here

and so now we just need to integrate this right here so this will be 1 to 4

and this will be pi x dx and so now integrating this we’re going

to get pi over 2 and then x squared and then evaluate from 1 to 4.

and so we’re going to get 8 pi minus pi over 2

and then we’re going to get here 15 pi over 2 as the exact value for the volume

of the um yeah and so if we were to say make the negative y equals negative

00:15

square root of x right and then we’re going to get you know a solid right there

so that solid uh three-dimensional solid right here and

we could find the volume of that solid it’s just 15 pi over two right there

then you can put your units on that if you’d like all right so now let’s go to

do this in python and so yeah let’s see how to get the region and

get this numeric value here we’re going to get it numerically not symbolically

so here we go we’re going to let’s see if we can zoom

in here all right so again the same problem find the volume of the solid

region under this curve on this interval about the x axis

and so i’m going to define a function it’s going to be the square root of x so

i’m going to use numpy to get a square root of x function

and i’m going to declare a figure and some axes i’m going to customize the

00:16

axes i’m going to lay down a bunch of x values a thousand of them and we’re

going to go from one to four and then i’m going to use the square root function

so for each of these x’s all thousand of them we’re going to put substitute them

into the function and then we’re going to plot the function

and then i’m going to fill between the x and y so our region is shaded

and then i’m going to show the plot and then we’re going to integrate

so we’re going to integrate um so remember we’re using the scipy

package and we’re going to integrate it and we’re going to use this method right

here to integrate it now what is the lambda mean so up here i defined a

function f of x um and that then the name of this function right here was f

so this is how you define a um ambiguous function right it’s just not ambiguous

anonymous anonymous function sorry anonymous function right there and uh yeah so

00:17

we’re going to see here we’re going to get pi and then the radius squared and

the radius is given by the function one to four and so this is exact

integral that we set up before and so this right here will actually

give us the numeric value right here so let’s shift enter that and it sketches

the graph and then it tells us that 15 pi over 2

which was the exact value and here it gives us a numeric value now if you’re

curious about the error how much error it has you can take off this um

0 0 right here that just tells us we want the first entry in the

output and so if i don’t if i don’t have that it then actually gives us the

numeric value and then this gives us the tolerance or the error range right here

all right so there’s our first example there now let’s go and do a second

example so example two here and now in this example right here we’re

going to have um y equals square root of sine x right

here and we’re going to be looking at zero to pi

00:18

and so it’s you know we don’t have square root of x anymore now we have

square root of sine x right so let’s see if we can put it over here actually um

and so let’s see we have it right here and then we have the square root of sine

x and it kind of looks like a flattened sign so it doesn’t look as nice

and round it looks more like it’s been like squashed or something so i’ll just

put it like that and then um the height is here here is still one

and so we’re looking at this region right here this region here r

and then this will be pi right here and we’re going to be revolving this

around the x-axis here so when we get down here we have the same

function right here and it’s just going to look like an egg

it’s just going to be a solid figure right there that’s just generated by

00:19

revolving that around the x-axis there so that looks like a revolving symbol

a little bit better now all right um and so yeah let’s see how to do this uh by

hand so i’m going to say here the volume is um

so we’re going to integrate from what 0 to pi and we’re going to integrate um

pi and then the radius which is given by

the function right here so the radius so here’s like a representative

uh rectangle right here and when you revolve that representative rectangle it

becomes into a representative disk that’s why it calls the disk method and so

the radius of this disk is going to be given by the height of the function

square root of sine x so pi r and then squared and then dx

all right and so then now we just need to integrate this so i’ll bring the pi

00:20

out and then we have square square root so this will just be zero to pi

of sine x dx and then you probably know how to

integrate this already we’re just going to get a 2 out of that right there so

the whole thing will be a 2 pi all right and so that would be the

volume of the solid that was generated from that region right there so

let’s look to see how to do this on python

and here we go so let’s switch this to python now and let’s get this out of the

way here real quick so let’s see here let’s go and appear right here

and yeah so example two here so we got this uh function right here square root

of sine x zero to pi revolved around the x-axis so i’m going

to define a function and it’s going to be the square root of the pi

square root of the sine right so i’m using numpy square root function and i’m

00:21

using the numpy sine function right there so then i declare a axis and a figure

and i’m going to customize axes i’m going to lay down a thousand x values

between zero and between zero and pi i’m going

to lay down a thousand x values i’m going to substitute substitute each of

those into the function f and get the outputs

now here i’m going to set the aspect ratio equal to each other

that way this distance of 1 and the distance along the x-axis

actually looks like three times that one and so then this way you can get a nice

shape uh get a good a nice feeling for the shape of that square root of

square root of sine x all right and then i’m going to fill

between the x’s and y’s so here’s an x and here’s a y so i’m going to fill

between it and then i’m going to show that plot that we just

defined right we defined the plot now we’re going to show it

all right and so here’s we do the calculus part so we’re going to use the

00:22

scipy integrate quad function and we have i’m going to define this

anonymous function of x and it’s going to be so we’re integrating pi times

the function height squared from zero to pi

and i just want the numeric value right there so let’s execute that cell right

there and there we go we get the two pi approximation right there 6.2831

and so on and so there we go so there’s example 2.

so now let’s move on to example 3 right here

so here we go let’s look back at example three now and here we go so [Music]

we’re going to find the volume of the solid and

so we got y equals x to the third this time i’m we’re going to revolve around

the y-axis right there so i thought we should do one of those

00:23

so here i’m going to look at the graph of y equals x to the third here

and let’s do that right here let’s say yeah let’s just put it right here and so

here we go we have y equals x to the third this is coming in there really

nice like that and then we have y equals eight so we’re

coming across here like that so y equals eight and so right here it’s going to

intersect at 2 8. so 2 to the third is 8. so this is a two right here

so find the volume of the solid obtained by rotating this region [Music]

about the y axis so i’m looking at this region right here

and i’m going to revolve this about the y-axis right here

so let me shade that in and then now let’s revolve this about

the y-axis right here so let’s revolve it right here

all right and so then we’re going to get a solid region right here and so that’s

just going to look like we’ll have like this and then it’ll have a

00:24

disk at the top and it’ll have a representative disk

we can draw the representative disk right here like that

so we need to find the area the cross sectional area i’ll give it a little

thickness right here and that comes from revolving a

representative rectangle right here and revolving that around the x-axis or

sorry y-axis and when you revolve that representative rectangle now you’re

getting a disk and so yeah we need to understand the

cross-sectional area and then we need to

integrate to add them up and we’re going to be integrating along the y-axis so

i’m going to be integrating from 0 to 8.

and so yeah let’s try to find the volume so you know what is the cross-sectional

area so it needs to be a function of y now and the reason why is because

i’m revolving around the y axis and so the disk method is

you need your region to be flush with the axis of rotation

00:25

and so i’m revolving around a vertical line now the y-axis and so i need a

something out here to get me the to get me the radius right here so this

will be the radius right here so this will be the point here for example xy and

we can have it input the x and output the y or we can have the

y is the input here um you know we can solve this and say x

you know because this could be the point here x x to the third

in other words just x y or this could be the same point right

here and we can write it as cube root of y y

right and so we could use either way to represent this point right here x f of x

or y f of y in any case this will be the cross sectional area here would be

00:26

pi x squared or pi solving this for x we get cube root of y squared and so

you know this is just pi and then y to the two thirds power

so this will be our cross-sectional area here and then notice the disks are

horizontal this time all right so anyways let’s find the volume so the

volume is we’re going to integrate 0 to 8 of the cross sectional area

and then times with respect to y and so this is just 0 to 8

and this is going to be pi y to the third two thirds and then we’re going to

[Music] say d y so we can integrate this this will be pi and then we’ll get a

uh what power here y to the two thirds plus one so that’ll be

00:27

uh five thirds and then we’ll divide by five thirds and then zero to eight

and so now we’re going to come in here with an eight

uh sorry and this will be a y right here sorry y to the five thirds yeah um and

so we’ll come in here with an eight now when we come here with an eight

eight to the you know the cube root of eight is two

so that’d be two to the fifth so that’s a 32

so this will be three fifths times 32 pi or said differently 96 pi over five

and so this would be how we would be able to find the exact

value of that volume exact volume using you know just integrating out by

hand and so let’s see how to do this in python now

00:28

here we go let’s erase this real quick all right so find the uh volume of the

solid [Music] region bounded uh rotated about the

y-axis right so what i’m going to do is i’m going to define a function right

here f of x is x to the third um again we’re going to do the same

thing we’re going to declare axes and we’re going to customize

and now i’m going to um go here zero to two um

so yeah we’re just looking zero to two right here and so

here when i did the lean spay uh linear space i did a thousand of them

so let’s try that here let’s do a thousand right there

all right so between zero and two i’m going to do a thousand values for x

a thousand x’s substitute them into my function i’m going to keep keep the ax

00:29

aspect ratio equal to each other so that way this distance of 2

is the same distance between 2 here and here

all right and so then i’m going to fill between the x y and the 8

so we get this part right here and then we’re going to show that plot

and then now we’re going to integrate here so we’re integrating um

so we’re going to use some science pi and then we’ll integrate use the quad

method anonymous function of x so now notice i use [Applause]

anonymous function of x because i used um so [Music] this right here is

the squared so this will be x to the fifth here

00:30

so let’s see here what should this be here so um if i’m going to use the f here

um so i’m going to define a new function f of y but not f i’m going to use

g of y and i’m going to return the um so i’m going to return so we’re looking

at uh y equals x to the third right so i’m going to say x is cube root of y so

input a y y and take cube root of it so here i’m going to input a y and i’m

going to take cube root of that so i believe that’s m p dot cube root cube root

of y so this will be cube root of y just like that

00:31

and now we want to use this function so this right here will be a function of y

and we want to do this function right here g of y

and then i’ll square that so that’s pi r squared and the r is given by this

function right here so yeah we want to measure

this height right here horizontally um and so yeah let’s execute that

and so we’re going to get here almost a 6 out

and we’re going to and we’re going to do this from 0 to my bad 0 to 8.

there we go and so now we’re getting uh a 60 right there

00:32

and let’s see here the 996 pi over 5 which was the exact volume so this is um

[Music] 96 pi so yeah there we go so um you know using this python right here

is only going to give us the approximation

not the exact value so if i want to do an example like this derive the formula

for the volume of the sphere of radius r well for this one here example 4

i’m not going to use the python to do that so let’s just do that

by hand here so let’s go back over here and look at that

and let me get rid of this and so yeah this last example is derive the formula

for the volume of a sphere of radius r so to do that what i’m going to do is

i’m going to say okay we have a sphere of radius r so we have x squared plus y

00:33

squared equals r squared and so that i’m just going to be looking

at the top part and so i’m going to say this will be square root of the r

squared minus the x squared in other words move the x squared over and then

take square root of both sides and just look at the positive root

and that will give us the top part of the circle or a circle of radius r

centered at the origin and so let’s just make a good top part

of the circle right there and so this is

radius r so that distance right there is r and this distance right here is r and

we’re going to revolve this around the x-axis

and when we do we’re going to get the sphere

and so the volume of the sphere will be and we’re going to integrate from 0 to r

and we’re going to have pi and how do we get the radius here

so the radius at a given x and the height will be given by all this right here

00:34

so pi and then the radius squared and then dx

so this will give us the volume of the sphere when we revolve this we’ll get

the sphere so we just need to integrate this so this will be

zero to r and then pi and then r squared minus x squared

and then dx and remember r here is just a constant right so a sphere of radius 4

a sphere of radius 16. and so what we can get here is just um actually um

using the symmetry right two and two because i’m integrating zero to r

and and and this is symmetric right or we can integrate minus r to r if we want

minus r to r but i’m going to multiply by 2 to get the full hemisphere here

or if you want you can just do what i was doing and then multiply by

00:35

4 at the end if you want to just actually no that never mind so yeah i

want to just integrate zero to r but i’m gonna multiply it by two and use

symmetry um and so yeah if we integrate this here

this is a dx so this right here is in fact let’s just pull out the

pi right here so 0 to r and then we’re going to get r squared minus x squared

yeah and then we can just integrate this

so 2 pi and then r squared will get an x and this will be minus x to the third

over 3 and then all this will get evaluated from 0 to r right there

and so then if we come in here with an r we’re going to get 2 pi

and then we’re going to get an r to the third right there so r to the

third and then here we’re going to get minus r to the third over three

and then when we come in with a zero that all vanishes so i don’t need to say

minus or i could say minus zero if i want but in the end what do we get here

00:36

so think of this as three over three so this will be three r cubed minus r cubed

so that’ll be two r cubed so this will be two pi

times two r to the third over three and so then lastly we’re going to get

the 2 times 2 so we’re going to get 4 pi thirds r to the third

and so then there’s the volume of a sphere of radius r you give me the

radius i’ll find the the volume of it uh yeah so that’s a lot

of fun uh so you know this is a numerical uh answer here at the end so

we would just do this by hand and you know um and it’s a lot of fun and so

yeah let’s uh i’m gonna say i’ll see you in the next

episode and uh hey have a great day if you enjoyed this video please like

and subscribe to my channel and click the bell icon to get new video updates