Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

the code must be a fortan code. working GS code with correct results Modify the Gauss-Seidel (GS) code given below to solve for x in

image text in transcribed
image text in transcribed
image text in transcribed
the code must be a fortan code.
working GS code with correct results
Modify the Gauss-Seidel (GS) code given below to solve for x in the following set of equations a(1,1) *x(1) + a (1,2) *x (2) + a (1,3)*x(3) + a(1,4) ** (4) = 5(1) a (2,1) *x(1) + a (2,2) *x(2) + a (2,3) ** (3) + a (2, 4) *x (4) = b (2) a (3,1) *x(1) + a (3,2) *x(2) + a (3,3) *x(3) + a (3, 4) *x(4) = b (3) a (4,1) *x (1) + a (4,2) *x (2) + a (4,3) *x(3) + a (4,4) ** (4) = b (4) where a (1, 1) = 5 a (1, 2) = a (1, 3) = 10 a (1,4) = 2 a (2, 1) = 0 a (2,2) = 4 a (2,3) = 5 a (2, 4) = 7 a (3, 1) = -1 a (3, 2) = -6 a (3, 3) = 0 a (3, 4) -4 a (4,1) = 5 a (4,2) = -5 a (4,3) = 8 a (4,4) = 0 b(1) = 2.33 b (2) = 11.38 b (3) = -5.03 b (4) = -3.04 answer x(1) = -1.23 x (2) = 0.45 x(3) = 0.67 0.89 | Gauss-Seidel Method for Lecture example EG-282 ! NB everything preceded by a '!' is a comment statement ! and is ignored by the computer, it's just for ease I of reading the program I- | beginning of program segment Program GS I a, x and b are set up as arrays (matrices) that 1 contain real numbers real !a (2, 2), (2), (2) ! iis set up as an integer to be used as a ! counter in a do-loop integer :: ! set up initial values (either line by line 1 or on one line separated by semi-colons al1,1)=4. (1,2)=1. (2,1)=2. (2,2)=6. x (1)=0. x (2)=0. b(1)=6. b(2)=14. | Iteration loop do i=0,20 ! start of do-loop ! write out latest estimates write(",) 'Iteration',i,' x(1) =',x(1),' x(2)=', (2) ! the Gauss-Seidel bit x (1) = (b (1) a (1,2) *x (2) ) a (1,1) x(2) = (b (2) - a (2, 1) *x (1))/ a (2,2) end do I end of do-loop pause I wait for a key to be pressed before continuing End Program GS end of program segment

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago