Question

As a personal preference I don't like the idea of Gauss elimination with back substitution. So...

As a personal preference I don't like the idea of Gauss elimination with back substitution. So I'm not going to make any of you go through that pain either. basically I want you to write a program that takes a set of linear equations like this: 5w+2x+2y+3z = 15 -11w-3x+5y-7z = -2 2w+4x-6y = -21 w+2y+2z = 4 Although I will probably not give you any more than ten equations in ten unknowns your program has to be able to solve any simultaneous set of linear equations. start the program out by giving it the coefficient matrix c=[[5,2,2,3,15],[-11,-3,5,-7,-2],[2,4,-6,0,-21],[1,0,2,2,4]] and have it print out the solution vector in the form: [5, -2.5, 3.5, -4] remember to try testing the program with various input. for example, what if you wanted to solve: 3x=12 input [[3,12]] output [4]

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

`Hey,

Note: If you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

Note: Brother sometimes while uploading on HomeworkLib the indentations change. So, I request you to verify it with screenshot once. This is the link where I have saved the code too

https://trinket.io/python3/fa56f84266

import numpy as np
def getSolution(c):
A=c[:,:-1];
B=c[:,-1:];
X = np.linalg.inv(A).dot(B)
return X;
c=[[5,2,2,3,15],[-11,-3,5,-7,-2],[2,4,-6,0,-21],[1,0,2,2,4]]
print(getSolution(np.array(c)))

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
As a personal preference I don't like the idea of Gauss elimination with back substitution. So...
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
  • solving using Gaussian elimination method to solve the questions above 1. Solve the following systems of...

    solving using Gaussian elimination method to solve the questions above 1. Solve the following systems of linear equations using Gaussian elimination method. a) 3z 9 x 5y 2z 2 1 3 *+2y = 3 b) x+y 0 2x y+3z3 x-2y -z 3 c) xy+z 9 2x +4y-3z= 1 3x+6y 5z= 0 e) 2xz w 5 y-w-1 3x z-w 0 4x +y+ 2z +w 9 2. How many gallons of each of a 60 % acid solution and an 80 %...

  • Please explain how you approach this so I can emulate your problem solving strategies on like...

    Please explain how you approach this so I can emulate your problem solving strategies on like problems Suppose we had a large, positively charged plate in an upright (vertical) position and a point charge with positive charge +Q. In lecture, you saw that a large charged plate gives rise to an electric field which is constant in space: we will call this electric field Eplate. Let us suppose also that we had a s bl with positive charge +q and...

  • Its question 15 that i am stuck with. I want to know how the model looks like and how to make it. 8.2 HC 15. As shown i...

    Its question 15 that i am stuck with. I want to know how the model looks like and how to make it. 8.2 HC 15. As shown in Figure 8.2.6 two large connected mixing tanks A and B initially contain 100 1liters of brine. Liquid is pumped in and out of the tanks as indicated in the figure; the mixture pumped between and out ofa tank is assumed to be well-stirred. (a) Construct a mathematical model in the form of...

  • Homework 1 Due Sunday June 30-Upload Your Answer in PDF at iLearn ENGR 305-01 Linear Systems...

    Homework 1 Due Sunday June 30-Upload Your Answer in PDF at iLearn ENGR 305-01 Linear Systems Analysis (Summer-R2, 2019) answer is clearly 8. Now, compute the following three cases in MATLAB and observe the answers; mention the ones that return the correct answer; explain what is happening in the 1t and 2nd cases: June 24, 2019 Page 2 of 2 - 64/2 4 X= x64/2/4 x 64/(2*4) t/2 + sin(30) In(2) log10(5)j = i = -1. -1 B= T/4 -6/A...

  • Some word problems in this chapter involve one "easy equation", usually found by translating a simple...

    Some word problems in this chapter involve one "easy equation", usually found by translating a simple relationship between x and y (like one is twice the other or that they add to a given number). The second linear equation often uses a "rate times quantity" formula. This is true for • distance problems (rate time = distance) • mixture problems (percent concentration amount of solution = amount of concentrate) • money problems (value of one item = how many items...

  • I have this case study to solve. i want to ask which type of case study...

    I have this case study to solve. i want to ask which type of case study in this like problem, evaluation or decision? if its decision then what are the criterias and all? Stardust Petroleum Sendirian Berhad: how to inculcate the pro-active safety culture? Farzana Quoquab, Nomahaza Mahadi, Taram Satiraksa Wan Abdullah and Jihad Mohammad Coming together is a beginning; keeping together is progress; working together is success. - Henry Ford The beginning Stardust was established in 2013 as a...

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