     with A83_014_Vector; use A83_014_Vector;
     with A83_015_Matrix; use A83_015_Matrix;
     with ConsAK        ; use ConsAK        ;
     with FloaAK        ; use FloaAK        ;
     with Text_IO       ; use Text_IO       ;

     procedure Euler_dt is
     ----------------------------------------------------------------------
     ----------------------------------------------------------------------
     F : constant array ( 'A'..'C' ) of Matrix_Type ( 1..2, 1..2 )
       := (
	    ( (    0.0,    1.0 ),
	      (   -1.0,    0.0 ) ),    -- A

	    ( (    0.0,    1.0 ),
	      (   -1.0,   -0.1 ) ),    -- B

	    ( (    0.0,    1.0 ),
	      ( -100.0, -101.0 ) )     -- C
	  );

     E : float;
     Y_Init : array ( F'range ) of Vector_Type ( 1..2 )
       := ( (  1.0,  0.0 ),            -- Initial
	    (  1.0,  0.0 ),            -- Values
	    (  1.0, -1.0 ) );          -- for Y and Y'
     Y : Vector_Type ( 1..2 );
     E_OK : boolean;
     E_File, Y_File : File_Type;

     procedure Euler (
       Y : in out Vector_Type;
       E : in     float;    -- time delta
       F : in     Matrix_Type ) is
     ----------------------------------------------------------------------
     begin
       Y := Y + E * ( F * Y );
     end Euler;

     ----------------------------------------------------------------------
     ----------------------------------------------------------------------
     begin
       Create ( E_File, Out_File, "Euler_dt.E" );
       for Index in reverse F'range loop
	 E := 0.5;
	 loop
	   E_OK := true;
	   Y := Y_Init ( Index );
	   Put_Line ( "Creating save file Euler_dt." & Index & "..." );
	   Create ( Y_File, Out_File, "Euler_dt." & Index );
	   for N in 0..10_000 loop
	     Put ( Index );
	     Put ( "   E:  " );
	     Put ( E );
	     Put ( "   Step:  " );
	     Put ( integer'image ( N ) );
	     Put ( Y_File, integer'image ( N ) );
	     Put ( "   Y:  " );
	     Put ( Y_File, "   " );
	     Put_Line ( Y ( 1 ) );
	     Put_Line ( Y_File, Y ( 1 ) );
	     begin
	       Euler ( Y, E, F ( index ) );
	       if abs Y ( 1 ) > 1.01 then
		 raise Numeric_Error;
	       end if;
	     exception
	       when Numeric_Error =>
		 E := E / 2.0;
		 E_OK := false;
	       when others =>
		 raise;
	     end;
	     exit when not E_OK;
	   end loop;
	   Close ( Y_File );
	   exit when E_OK;
	 end loop;
	 Put_Line ( E_File, E );
       end loop;
       Close ( E_File );
     end Euler_dt;
