function tank1 ( )

%% TANK1 plots the volume as a function of height for the tank problem.

  r = 4.0;
  v_total = pi * r^3 * 4.0 / 3.0;

  for i = 1 : 21

    h = 2.0 * r * ( i - 1 ) / 20.0;

    if ( h <= r )
      v = pi * ( h^2 * r - h^3 / 3 );
    else
      h2 = 2.0 * r - h;
      v2 = pi * ( h2^2 * r - h2^3 / 3 );
      v = v_total - v2;
    end

    hplot(i) = h;
    vplot(i) = v;

  end

  plot ( hplot, vplot, 'r.', 'Markersize', 25 );

  return
end

