function [ age_to_die, total_to_die, male_to_die, female_to_die ] = ...
  mortality_to_die ()

%*****************************************************************************80
%
%% mortality_to_die() computes the per bracket "to die" function.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    10 February 2024
%
%  Author:
%
%    John Burkardt
%
  [ age, total_death, male_death, female_death ] = mortality_count ( );

  n = length ( age );
%
%  This bracket's "to die" minus this year's deaths gives next bracket's "to die".
%
  age_to_die = linspace ( 0, n, n + 1 );

  total_to_die = zeros ( n + 1, 1 );
  total_to_die(1) = sum ( total_death );
  for i = 2 : n + 1
    total_to_die(i) = total_to_die(i-1) - total_death(i-1);
  end

  male_to_die = zeros ( n + 1, 1 );
  male_to_die(1) = sum ( male_death );
  for i = 2 : n + 1
    male_to_die(i) = male_to_die(i-1) - male_death(i-1);
  end

  female_to_die = zeros ( n + 1, 1 );
  female_to_die(1) = sum ( female_death );
  for i = 2 : n + 1
    female_to_die(i) = female_to_die(i-1) - female_death(i-1);
  end

  return
end
