Question

Consider the system of linear algebraic equations, in which the coefficients and the constants are known...

Consider the system of linear algebraic equations, in which the coefficients and the constants are known to the number of significant digits shown.
4.000y - 5.000z = -8.000
3.000x - 6.000y - 2.000z = -23.00
5.000x - 1.000y = 2.000

Write and execute VBA code to solve the system of equations with the Gauss-Seidel algorithm. Let the solution be considered to have converged when consecutive estimates for all three variables differ by less than l0.00001% l.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

VBA code

4.000y - 5.000z = -8.000
3.000x - 6.000y - 2.000z = -23.00
5.000x - 1.000y = 2.000

simple matrix formula A*x = B

A = [ 0 , 4 , - 5 ; 3 , - 6 , -2 ; 5 , -1 , 0 ]

B = [ - 8, -23, 2 ]

you solve this equation, you'll find x = 1, y = 3, z = 4 ; in terms of the matric.

So, C = [ 1 ; 3 ; 4 ]

Now with the help of Excel's worksheets alongside its MMULT and MINVERSE functions makes this easy. My problem is I'm needing to do this calculation inside a VBA function.

Dim A(0 To 2, 0 To 2) As Single
Dim B(0 To 0, 0 To 2) As Single
Dim X(0 To 0, 0 To 2) As Single
A(0, 0 ,0 ) = 0
A(1, 0 ,0 ) = 4
A(0, 1 ,0) = -5
A(0, 0, 1) = 3

A(1, 1, 0 ) = -6

A(1, 0 ,1) = -2

A(0 , 1 , 1 ) = 5

A( 1 , 1 , 1 ) = -1

B(0 , 0 , 0) = -8

B(0 , 1 , 0) = -23

B(1, 1, 1 ) = 2

Gauss-Seidel algorithm

4.000y - 5.000z = -8.000
3.000x - 6.000y - 2.000z = -23.00
5.000x - 1.000y = 2.000

To compare our results from the two methods, we again choose x(0) = (0, 0, 0). We then find x(1) = (x1(1), x2(1), x3(1)) by solving

0 - 0 = -8.000
3.000x - 6.000y - 0z = -23.00
5.000x - 1.000y = 2.000

In this we will use eign value and eigh vetor mathode;

X = [ k1 , k2 , k3 ] ;

Now put the values accordingly

Add a comment
Know the answer?
Add Answer to:
Consider the system of linear algebraic equations, in which the coefficients and the constants are known...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Tutorial 4. Linear systems of algebraic equations 2 October, 4-5 pm in FN2 (Q1) Consider this linear system of equation...

    Tutorial 4. Linear systems of algebraic equations 2 October, 4-5 pm in FN2 (Q1) Consider this linear system of equations a. 1 p -2 0 0 0 1 0 q 0 4 2r -2 0 -1 0 4s Order the four equations such that the system of equations can be solved efficiently by Gauss elimination b. Solve the system by Gauss elimination (Q2) -1] 6 Given the linear system of equations A5 with [A| solve for i 10 and by...

  • Q1 The linear system Ax = b is given by: x1−x2 + 4x3 = 7 4x1...

    Q1 The linear system Ax = b is given by: x1−x2 + 4x3 = 7 4x1 + 2x2 –x3= 18, x1 + 3x2+ x3 = 16, has the solution x=(3, 4,2)T. Using the initial guess   x (0)=(1, 1,1)T Solve the above system as is using: Gauss-Seidel method. If the error increases, what does that mean and what should you do? (see b below) Condition the system so that convergence is secured and solve using the Gauss-Siedel method. Q2: Find a system...

  • Take any system of 3x3 matrix equation which is linear Solve the system using generic algorithm...

    Take any system of 3x3 matrix equation which is linear Solve the system using generic algorithm for the Gauss Seidel method The code must take the matrix input by the user It should be solvable for any nxn system Give only a working proper MATLAB code if you dont know do not answer or i will dislike badly compare with original solution and then break.

  • 1) Consider the system of linear algebraic equations Ax = B where | 1 1/2 1/31...

    1) Consider the system of linear algebraic equations Ax = B where | 1 1/2 1/31 1/2 1/3 1/4 11/3 1/4 1/5 a) Find x, A" and det(A) using Gauss-Jordan elimination without pivoting. b) Using the result of part (a), find the condition number of A based on the Euclidean (Frobenius) norm. How many digits of precision do you suspect are lost in the solution x due to ill-conditioning?

  • plz show all steps 3. Consider the linear system of equations 21-62-33-38 22T3 initial guess r0,0,apply, by hand, the J...

    plz show all steps 3. Consider the linear system of equations 21-62-33-38 22T3 initial guess r0,0,apply, by hand, the Jacobi iteration until the approx- imate relative error falls below 7%. b) With the same initial guess as in a), solve the system using Gauss-Seidel method. 3. Consider the linear system of equations 21-62-33-38 22T3 initial guess r0,0,apply, by hand, the Jacobi iteration until the approx- imate relative error falls below 7%. b) With the same initial guess as in a),...

  • Consider the following system of linear algebraic equations: 7.121 + 2.9.02 + 2.2.03 + 3.3x4 =...

    Consider the following system of linear algebraic equations: 7.121 + 2.9.02 + 2.2.03 + 3.3x4 = 4.2 4.121 +3.422 + 5.0.03 + 1.2x4 = 1.9 4.721 +3.822 + 2.9.03 + 1.4x4 = 1.1 2.0x1 + 2.5.2 + 2.8.03 + 4.7:24 = 1.1 Perform the first step in Gauss elimination to eliminate 21 from the second, third and forth equations, converting the system to the form given below. Fill in the blank spaces. Round up your answers to 4 decimals. 7.121...

  • Consider the following system of linear algebraic equations: 6.3x1 + 3.4x2 + 1.8x3 + 4.3x4 3.8...

    Consider the following system of linear algebraic equations: 6.3x1 + 3.4x2 + 1.8x3 + 4.3x4 3.8 1.5x1 + 3.0x2 + 1.3x3 + 3.3x4 2.9 2.8x1 + 1.2x2 + 3.6x3 + 2.6x4 4.0 4.3x1 + 2.0.x2 + 3.0x3 + 2.6x4 4.3 Perform the first step in Gauss elimination to eliminate xi from the second, third and forth equations, converting the system to the form given below. Fill in the blank spaces. Round up your answers to 4 decimals. 6.3x1 + 3.4x2...

  • Consider the following system of linear algebraic equations: 5.501 +3.222 +2.703 +1.104 = 5.0 4.501 +3.322...

    Consider the following system of linear algebraic equations: 5.501 +3.222 +2.703 +1.104 = 5.0 4.501 +3.322 +4.9.13 +2.4.24 = 3.2 3.1.11 +1.4.22 +2.823 +3.0x4=2.0 2.801 +4.332 + 1.73 +1.624 = 3.3 Perform the first step in Gauss elimination to eliminate 21 from the second third and forth equations, converting the system to the form given below. Fill in the blank spaces. Round up your answers to 4 decimals. 5.5.21 +3.222 +2.723 + 1.1.4 = 5.0 12 + |a3 + 24...

  • Q3. (25 points) Solve the given set of linear algebraic equations in which (A,b) is given....

    Q3. (25 points) Solve the given set of linear algebraic equations in which (A,b) is given. Show all steps of elementary row operations and clearly indicate which of the variables are free (if they exist). Your answer must also include: a. The rank of matrix A. b. The rank of matrix (A,b) C. Whether the system is consistent or inconsistent. 3 1 2 11 (A,b) = 1 - 2 3 12 0 1 0 3 0 1 1

  • The pscudocode shown below solves a system of n linear algebraic equations using Gauss-Jordan 125] elimination. DOFOR -1,n DOPOR 1 = k + 1,n + 1 END DO ae 1 DOFOR 1 = 1, n k THEN IF i DOFOR j- k+...

    The pscudocode shown below solves a system of n linear algebraic equations using Gauss-Jordan 125] elimination. DOFOR -1,n DOPOR 1 = k + 1,n + 1 END DO ae 1 DOFOR 1 = 1, n k THEN IF i DOFOR j- k+1,n+ 1 ENDDO END IF END DO END DO DOFOR m-1,n END DO Write a Matlab function program GaussJordan(A,n) which implements this algorithm and a) returns the solution. Here A is the augmented matrix consisting of the coefficient matrix...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT