Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/JAVA/Openjdk/test/langtools/tools/javac/6330920/   (Sun/Oracle ©)  Datei vom 13.11.2022 mit Größe 159 B image not shown  

Quelle  newton.cob   Sprache: unbekannt

 
       identification division.
       program-id. newton.
      * Autor JD
      * Dies ist das Newtonverfahren
      * gesucht x mit f(x)=0
      * es konvergiert nicht immer!!
       author"JD".
       date-written. 27.12.2006.
       date-compiled.
       data division.
       working-storage section.
         77 x         pic 9(4)V9(8).
         77 f         pic 9(4)V9(8).
         77 d         pic 9(4)V9(8).
         78 eps       value 1e-8.
         77 xn        pic 9(4)V9(8).
         77 counter   pic 9(8).
       procedure division.
         display "start"
         move eps to f
         move 0 to counter
         accept xn
         perform with test after
         until f*f<eps or counter >1E5
           move xn to x
           perform func
           perform funcdiff
           compute xn = xn -f / d
           add 1 to counter
         end-perform.
         display "done, Zero(x**4+3x**2+5)="xn.
         stop run.
        func.
          compute f=x*x*x*x*x+3*x*x+5
        funcdiff.
          compute d=4*x*x*x+6*x
        end-program newton.

Messung V0.5
C=90 H=100 G=95

[ Dauer der Verarbeitung: 0.14 Sekunden  (vorverarbeitet)  ]