1 / 5

Writing Programs

Writing Programs. Comment Translation Progressive Envelopment. Bisection Method of Root Finding. Bisection. Algorithm Initialization Begin Loop Single step calculations e.g., X K = F(X K-1 ) Test for early exit End Loop. FORTRAN X = X0 DO K = 1, MAXK XT = X X = F(X)

hetal
Télécharger la présentation

Writing Programs

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Writing Programs • Comment Translation • Progressive Envelopment

  2. Bisection Method of Root Finding Bisection

  3. Algorithm Initialization Begin Loop Single step calculations e.g., XK = F(XK-1) Test for early exit End Loop FORTRAN X = X0 DO K = 1, MAXK XT = X X = F(X) PR = ABS( (XXT) / X ) IF( PR .LT. PRCSN ) GOTO 10 ENDDO 10 CONTINUE Iteration

  4. Comment Translation Initialize XL, XR Set KMAX, PRCSN Test F(XL) & F(XR) for early exit Begin Loop: Set XM Test F(XM) for early exit Choose new XL, XR End loop Exit: Output End Program Programs: HTMLDOC

  5. 10 CONTINUE WRITE(*,*) ‘Root at X = ‘, XM WRITE(*,*) ‘ F(X) = ‘, F(XM) END Progressive Envelopment XL = XR = DO K = 1, KMAX XM = ( XL+XR ) / 2. IF( F(XM) .LE. PRCSN ) GOTO 10 IF( F(XM)*F(XR) .LT. 0. ) XL = XM IF( F(XM)*F(XL) .LT. 0. ) XR = XM ENDDO ProgramGraph

More Related