function diophantine_2d_test04 ( )

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

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

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

  diophantine_basis_print ( d, v, w );

  r = diophantine_residual ( a, b, v );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  There are %d strictly positive 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

