function diophantine_2d_test03 ( )

%*****************************************************************************80
%
%% diophantine_2d_test03() tests diophantine_2d_nonnegative().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    08 April 2020
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'diophantine_2d_test03():\n' );
  fprintf ( 1, '  diophantine_2d_nonnegative() returns the nonnegative solutions\n' );
  fprintf ( 1, '  of a Diophantine equation in 2 variables\n' );

  a = [ 2; 3 ];
  b = 18;
  diophantine_equation_print ( a, b );

  [ d, v, w, cmin, cmax ] = diophantine_2d_nonnegative ( a, b );

  diophantine_basis_print ( d, v, w );

  r = diophantine_residual ( a, b, v );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  There are %d nonnegative solutions:\n', cmax + 1 - cmin );

  for c = cmin : cmax
    x = v + w * c;
    ax = a' * x;
    fprintf ( 1,'  c=%d: %d (%d) + %d (%d) = %d\n', c, a(1), x(1), a(2), x(2), ax );
  end

  return
end

