Daily Coding Challenge

Write an algorithm to solve a system of linear
equations.

For example, if the equation is

2a+5b+3c+9d=4
7a+3b+7c+8d=1
5a+8b+2c+3d=7
3a+7b+8c+2d=5

You will get the following matrix

2 5 3 9 | 4
7 3 7 8 | 1
5 8 2 3 | 7
3 7 8 2 | 5

Your program should return the following values:
a=-0.06
b=0.97
c=0.19
d=-0.01

Attached: 0521431085.01._SCLZZZZZZZ_SX500_.jpg (336x500, 32.48K)

is this your homework

No. It's just the second most basic linear algebra algorithm after matrix multiplication. You should be able to solve this in 10 minutes. Unless...

Not gonna lie, on top of my head I wouldn't be able to solve this exercise although I have the solution on my pc because I solved it before with Gauss' elimination after pivoting.

King Terry approves of this challenge

Attached: screenshot.png (313x222, 73.31K)

nice!

inb4
>nooo you can't just use numpy arrays

Attached: 1635123002363.png (1142x479, 46.69K)

I think you are missing the pivot reorder part. What happens if you have a zero in the diagonal?

true

Attached: Screenshot from 2022-08-19 04:52:08.png (819x479, 34.7K)

Bampoz

Yup, it's his homework

How does that work? It's taking the inverse of what?

>noooo you can't talk about math that means it's homework!!!!!

im not doing your amath 101 homework

i have no idea how you would solve this
im unemployed

same but because im retarded

you just implement gaussian elimination

>He can't implement Gaussian elimination...
ngmi, Jamal. Better start stealing shit from white folks.

>basic matrix operations that are standard in community college undergrad CS
>nooo not homework
Just search on google jesus, its trivial
If this was an actual coding challenge thread, it would have one

If you challenge me to solve it, because its so trivial, it is 100% your homework

AX=B
so
X = A^-1*B

A = coefficients (nxn matrix)
X = variables (column vector)
B = rhs of equations (column vector)