Computational Solution for a Given Function using Fortran Code, Exercises of Computer Fundamentals

The fortran code for calculating the exact solution of a given function using an iterative method. The function is defined by the variables a, b, h, alpha, beta, and involves trigonometric functions and arithmetic operations. The code initializes the variables, calculates the constants k11 to k42 and u1, u2, v1, v2 using the given formula, and then iteratively calculates wi for each value of i from 0 to n. The final output displays the values of wi. This code can be useful for students and researchers in the field of numerical analysis, computer science, and engineering, as it demonstrates the implementation of a common numerical method for solving mathematical functions.

Typology: Exercises

2011/2012

Uploaded on 07/17/2012

pafmavasa
pafmavasa 🇮🇳

4.7

(24)

76 documents

1 / 12

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Output of Computer Program
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Computational Solution for a Given Function using Fortran Code and more Exercises Computer Fundamentals in PDF only on Docsity!

Output of Computer Program

Exact Solution

K32 = H((-2/(X+(H/2.0)))(U2+(K22/2)) + ((2/(X+(H/2.0))**2)

$ (U1+(K21/2))) + (SIN(LOG(X+H/2.0)))/((X+(H/2.0))*2))

WRITE(,) 'K32 = ',K

K41 = H * (U2 + K32)

WRITE(,) 'K41 = ',K

K42 = H(((-2/(X+H))(U2+K32)) + ((2/(X+H)**2)

$ (U1+K31)) + ((SIN(LOG(X+H)))/((X+H)*2)))

WRITE(,) 'K42 = ',K

U1 = U1 + (1/6.0)(K11 + 2K21 + 2*K31 + K41)

WRITE(,)'U1 = ', U

U2 = U2 + (1/6.0)(K12 + 2K22 + 2*K32 + K42)

WRITE(,)'U2 = ', U

U1ARR(I) = U

dK11 = H * V WRITE(,) 'dK11 = ', dK dK12 = H((-2.0/X)V2+(2.0/(X * X))V1) WRITE(,) 'dK12 = ', dK dK21 = H * (V2 + (1.0/2.0) * dK12) WRITE(,) 'dK21 = ', dK dK22 = H((-2/(X+(H/2.0)))(V2+(dK12/2)) + ((2/(X+(H/2.0))2) $ (V1+(dK11/2)))) WRITE(,)'dK22 = ',dK dK31 = H * (V2 + (dK22/2.0)) WRITE(,) 'dK31 = ', dK dK32 = H((-2/(X+(H/2.0)))(V2+(dK22/2)) + ((2/(X+(H/2.0))**2)

$ (V1+(dK21/2)))) WRITE(,) 'dK32 = ',dK dK41 = H * (V2 + dK32) WRITE(,) 'dK41 = ',dK WRITE(,)'V1ARR(0) ', V1ARR(1) dK42 = H(((-2/(X+H))(V2+dK32)) + ((2/(X+H)2) $ (V1+dK31))) WRITE(,) 'dK42 = ',dK V1 = V1 + (1/6.0)(dK11 + 2dK21 + 2dK31 + dK41) WRITE(,)'V1 = ', V V2 = V2 + (1/6.0)(dK12 + 2dK22 + 2dK32 + dK42) WRITE(,)'V2 = ', V V1ARR(I) = V ENDDO W10 = ALPHA W20 = (BETA - U1) / V WRITE(,)'W20 ', W DO I=0, N- W1 = U1ARR(I) + W20 * V1ARR(I) WRITE(,)'Wi =', W ENDDO END