Write a "Python" program that reads coefficients and the right-hand side vector of a linear equation system from a given file (input.txt). The last row of the "input.txt" file is the right-hand side vector of a linear equation system. The coefficients of the linear equation will be integer as shown below. 4x0 +x1= 3 2x0 +5x1 = 1 The content of "input.txt" will be: Size=2 41 25 31 (a) Print the given matrix to the "output.txt" file as shown below: The content of the "output.txt" file: +4x0 +1x1 = 3 +2x0 +5x1 = 1 (b) solve the given linear equation system using the Gauss Elimination and Jacobi methods. Print the solutions to the "output_results.txt". The content of the "output_results.txt" file should be (the 4th digit after the decimal point will be rounded): The solution of the system by Gauss Elimination: x1=0.7778 x2=-0.1111 The solution of the system by Jacobi Method: x1=0.7778 x2=-0.1111 Note : Please write your code by writing functions one for Gauss Elimination Method, one for Jacobi method, one for the
Write a "Python" program that reads coefficients and the right-hand side vector of a linear equation system from a given file (input.txt). The last row of the "input.txt" file is the right-hand side vector of a linear equation system. The coefficients of the linear equation will be integer as shown below. 4x0 +x1= 3 2x0 +5x1 = 1 The content of "input.txt" will be: Size=2 41 25 31 (a) Print the given matrix to the "output.txt" file as shown below: The content of the "output.txt" file: +4x0 +1x1 = 3 +2x0 +5x1 = 1 (b) solve the given linear equation system using the Gauss Elimination and Jacobi methods. Print the solutions to the "output_results.txt". The content of the "output_results.txt" file should be (the 4th digit after the decimal point will be rounded): The solution of the system by Gauss Elimination: x1=0.7778 x2=-0.1111 The solution of the system by Jacobi Method: x1=0.7778 x2=-0.1111 Note : Please write your code by writing functions one for Gauss Elimination Method, one for Jacobi method, one for the
Chapter13: File Input And Output
Section: Chapter Questions
Problem 6PE
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 6 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT