Each of these Matlab functions must be defined in its own .m file. They are included here in one text file for easier viewing by students. ============================================================================== areaHemisphere.m ============================================================================== function area = areaHemisphere( x ) % The areaHemisphere function computes the area of a cross-section of % a hemisphere. radius = sqrt( 9 - x.^2 ) ; area = 0.5*pi*radius.^2 ; ============================================================================== areaTorus2.m ============================================================================== function area = areaTorus2( t ) % The areaTorus2 function computes the cross-sectional area of the torus % at x = t using the method of shells. y = sqrt( 1 - (t-2).^2 ) ; height = 2.*y ; area = 2*pi*height.*t ; ============================================================================== volumeTorus2.m ============================================================================== function vol = volumeTorus2( t ) % The volumeTorus2 function computes the volume of the torus from % x = 1 to x = t. vol = quad( @areaTorus2, 1, t ) ; ============================================================================== tobezeroTorus2.m ============================================================================== function z = tobezeroTorus2( t ) % The tobezeroTorus2 function computes the volume of the torus from % x = 1 to x = t and then subtracts 20 from that value. This function % can be passed to Matlab's fzero in order to determine where the volume % of the cut-off torus is equal to 20 (for Problem 2.d). z = volumeTorus2(t) - 20 ; ============================================================================== areaTorus3.m ============================================================================== function area = areaTorus3( t ) % The areaTorus3 function computes the cross-sectional area of the torus % at y = t using the method of washers. rad1 = 2 - sqrt( 1 - t.^2 ) ; rad2 = 2 + sqrt( 1 - t.^2 ) ; area = pi*( rad2.^2 - rad1.^2 ) ; ============================================================================== volumeTorus3.m ============================================================================== function vol = volumeTorus3( t ) % The volumeTorus3 function computes the volume of the torus from % y = -t to y = t. vol = 2*quad( @areaTorus3, 0, t ) ; ============================================================================== tobezeroTorus3.m ============================================================================== function z = tobezeroTorus3( t ) % The tobezeroTorus3 function computes the volume of the torus from % y = -t to y = t and then subtracts 20 from that value. This function % can be passed to Matlab's fzero in order to determine where the volume % of the cut-off torus is equal to 20 (for Problem 3). z = volumeTorus3(t) - 20 ;