atomsmasher - 11 months ago 35

Python Question

Using numpy if I had a system of equations:

`3x + 2y = 5`

1x + 4y = 10

I could solve them with

`numpy.linalg.solve`

`a = [[3,2],[1,4]]`

b = [5,10]

solution = numpy.linalg.solve(a,b)

Now, what if I had two matrices, A and B each of shape (100,100) and I wanted to solve an equation of the form: (A'

I'm unsure as to how I would set this up using

`numpy.linalg.solve`

Answer

This specific equation has an analytical solution:

- either
`x`

is 0 and`y`

can be anything

either

`x`

can be anything and then`A'A - yBB' = 0`

which**can**be linear and solved using`numpy.linalg.solve`

**can** be linear because the dimensions does not add well

Source (Stackoverflow)