0

In python it is possible to solve {A}[x]=[B] where A is a known matrix, B a known vector and x an unknown vector.

But is it possible to solve {A}[x]=[B] if A is a know 3x3 matrix, x = [V1 5 V3] and B = [0 I2 0] ?

Thank you very much for your help.

Anthony Lethuillier
  • 1,489
  • 4
  • 15
  • 33
  • THat's easy and you can use Python. Multiply the second column of A with 5, subtract from B to get B' Then ignore the second row and column of your system and solve the reduced system to get v1 and v3. – tschm Nov 11 '14 at 10:25
  • Great it works :)
    I tried applying the same method to a more complex system :
    A is known 19x19 matrix x = [V1, V2, 5, V4, V5, V6, 0.97*V8, V8, V9, V10, V12*0.97, V12, 0, V14, V15, V16, V17, V18, V19] B = [0, 0, I3, 0, 0, 0, I7, 0, 0, 0, I11, 0, I13, 0, 0, 0, 0, 0, 0] I can see how to apply the method for the third and thirteenth line but what about the seventh and eleventh ? Does the method still work ?
    – Anthony Lethuillier Nov 11 '14 at 16:14
  • I think your question doesn't really touch Python. Make sure you understand the maths here: Column 7 * 0.97 * V8 + Column 8 * V8 = (Column 7 * 0.97 + Column 8) * V8, so I got rid of one column essentially. But first you get rid of column 3 and 13. – tschm Nov 11 '14 at 18:07

1 Answers1

2

It's certainly feasible to reduce columns and rows and go down this route but I would rather suggest an alternative approach here. Reformulate your problem as a quadratic problem in 3n unknowns. Use cvxopt to solve it. Essentially you are trying to minimize the 2-norm of the residual r = Ax-b where x and b are vector in n variables. So define

0 = row_i of A * x - b_i - r_i

introduce constraints on

x and b

e.g. b_1 = 0 x_2 = 0.3*x1 etc.

and minimize

sum r_i^2

You could also do something like sum abs(r_i) and introduce another set of n variables and solve a linear problem in 4n dimensions

tschm
  • 2,905
  • 6
  • 33
  • 45