% Convergence Team Lab

% Part 1

%%  Find the volume of two portions of a hemisphere.
%%  The functioin crossSection(x) computes the cross sectional area.

X = 0;
volPartSphere = quad('crossSection', -3, X)
check = (4/3)*pi*3^3 / 4

X = 1.5;
volPartSphere = quad('crossSection', -3, X)

% Part 2
%%  Compute the volume of the torus.
%  Find the volume at t = 2

t = 2;
vol = quad('areaShell', 1, t)

%  Find the volume at t = 3

t = 3;
vol = quad('areaShell', 1, t)

%% Put the volume in a function.

t = 2;
vol = volumeTorus(t) ;
disp([' For x = ', num2str(t),' the volume of the torus is ', num2str(vol) ])

t = 3;
vol = volumeTorus(t)
disp([' For x = ', num2str(t),' the volume of the torus is ', num2str(vol) ])

%%  Find the value of t so that the volume of that piece of
%%  the torus is 20.

tShell = fzero('volLess20', 2)

% Part 3

%%  Find the value of t so that the volume of that piece of
%%  the torus is 20.

tSlice = fzero('volDiskLess20', 0.5)