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.
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet)
¤
|
Haftungshinweis
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.
|