25.06.2013 Views

Il Linguaggio Fortran 90/95

Il Linguaggio Fortran 90/95

Il Linguaggio Fortran 90/95

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

5.18 Visibilità 309<br />

FUNCTION f(x)<br />

IMPLICIT NONE<br />

REAL :: f<br />

REAL,INTENT(IN) :: x<br />

END FUNCTION f<br />

FUNCTION df(x)<br />

IMPLICIT NONE<br />

REAL df<br />

REAL,INTENT(IN) :: x<br />

END FUNCTION df<br />

END INTERFACE<br />

! Variabili locali<br />

REAL :: fGuess, dfGuess ! f(guess) e df(guess) rispettivamente<br />

REAL :: newGuess<br />

! *** Sezione esecutiva ***<br />

! Calcola df(guess) e f(guess)<br />

fGuess = f(guess); dfGuess = df(guess)<br />

! Check su f(c). <strong>Il</strong> punto c e’ radice se f(c) e’ minore della tolleranza.<br />

! NB: Qualora l’errore di round-off eccedesse la tolleranza, l’esame di<br />

! questa condizione determinerebbe l’insorgere di un loop infinito<br />

IF (ABS(fGuess)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!