[BACK]Return to ts_durker.adb CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / PHC / Ada / Root_Counts / Implift

Annotation of OpenXM_contrib/PHC/Ada/Root_Counts/Implift/ts_durker.adb, Revision 1.1

1.1     ! maekawa     1: with text_io,integer_io;                 use text_io,integer_io;
        !             2: with Standard_Floating_Numbers;          use Standard_Floating_Numbers;
        !             3: with Standard_Floating_Numbers_io;       use Standard_Floating_Numbers_io;
        !             4: with Standard_Complex_Numbers;           use Standard_Complex_Numbers;
        !             5: with Standard_Complex_Numbers_io;        use Standard_Complex_Numbers_io;
        !             6: with Standard_Complex_Vectors;           use Standard_Complex_Vectors;
        !             7: with Standard_Random_Vectors;            use Standard_Random_Vectors;
        !             8: with Durand_Kerner;
        !             9:
        !            10: procedure ts_durker is
        !            11:
        !            12: -- DESCRIPTION :
        !            13: --   Test on the solver for polynomial equations in one variable.
        !            14:
        !            15:   procedure Read ( cv : in out Vector ) is
        !            16:   begin
        !            17:     for i in cv'range loop
        !            18:       put(' '); put(i,1); put(" : ");
        !            19:       get(cv(i));
        !            20:     end loop;
        !            21:   end Read;
        !            22:
        !            23:   procedure Write ( step : in natural; z,res : in Vector ) is
        !            24:   begin
        !            25:     put("Output after step  "); put(step,1); put_line(" :");
        !            26:     put_line
        !            27:    ("------------------------------------------------------------------------");
        !            28:     put_line
        !            29:    ("|    APPROXIMATED ROOTS                        |     RESIDUALS         |");
        !            30:     put_line
        !            31:    ("------------------------------------------------------------------------");
        !            32:     for i in z'range loop
        !            33:       put("| "); put(z(i)); put(" | "); put(AbsVal(res(i))); put(" |");
        !            34:       new_line;
        !            35:     end loop;
        !            36:     put_line
        !            37:    ("------------------------------------------------------------------------");
        !            38:   end Write;
        !            39:
        !            40:   procedure dk is new Durand_Kerner(Write);
        !            41:
        !            42:   procedure Main is
        !            43:
        !            44:     n,nb : natural;
        !            45:
        !            46:   begin
        !            47:     put("Give the degree of p(x) : "); get(n);
        !            48:     declare
        !            49:       p : Vector(0..n);
        !            50:       z,res : Vector(1..n);
        !            51:       max : natural;
        !            52:       eps : double_float;
        !            53:     begin
        !            54:       put_line("p(x) = a_0 + a_1*x + a_2*x^2 + ... + a_n*x^n");
        !            55:       put("Give "); put(n+1,1); put_line(" complex coefficients of p(x) :");
        !            56:       Read(p);
        !            57:       z := Random_Vector(n);    -- first approximation is random vector
        !            58:       res := z;
        !            59:       put("Give the maximum number of steps : "); get(max);
        !            60:       put("Give the required accuracy       : "); get(eps);
        !            61:       dk(p,z,res,max,eps,nb);
        !            62:     end;
        !            63:   end Main;
        !            64:
        !            65: begin
        !            66:   Main;
        !            67: end ts_durker;
        !            68:

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>