-1

Let's divide the problem to 2 parts, the second one is optional.

Part 1

I have 3 linear equtions with N variables where N usually bigger then 3.

  • x1*a+x2*b+x3*c+x4*d[....]xN*p = B1
  • y1*a+y2*b+y3*c+y4*d[....]yN*p = B2
  • z1*a+z2*b+z3*c+z4*d[....]zN*p = B3

Looking for (a,b,c,d,[...],p), others are constant.

The standard Gaussian way won't work because the matrix will be wider then tall. Of course i can use it to eliminate 2 variables. Do you know an algorithm to find out a solution? (I only need one.) More 0s in the solution coefficients are better but not required.

Part 2

The coefficients in the solution must be non-negative.

Requirements: The algorithm must be fast enough to run real time. (1800 per sec on an avrage pc). So trial and error method is a no go. The algorithm will be implemented in C# but feel free to use pseudo language if you want to write code.

GaborK
  • 1
  • This sounds like homework. What have you tried, where are you stuck? The answer to Part 1 is just basic linear algebra; find yourself any basic textbook and it'll explain the case where the matrix is wider than tall. – Amit Kumar Gupta Jan 22 '15 at 18:02
  • Then point me please to the right direction with some links or keywords. It's not a homework, i can assure you. – GaborK Jan 22 '15 at 18:51
  • http://math.stackexchange.com is the ideal forum for the first question. – Amit Kumar Gupta Jan 22 '15 at 19:57
  • I thought using constraint programming to find the coefficients. Limit range to 0-1 in R fits for me. I found a C# solver (Mono so Microsoft solver foundation doesn't plays), that may works but i'm afraid not enough fast for me. Do anyone know a good constraint solver for c#? – GaborK Jan 23 '15 at 09:27
  • An other way to solve this is SVD. I will write to solution when i tested it. – GaborK Jan 23 '15 at 10:58

1 Answers1

0

Set extra variables to zero. Now we have the matrix equation

A.x = b, where

   x1 x2 x3

A = y1 y2 y3 z1 z2 z3

b = (B1, B2, B3), as a column vector Now invert A. The solution is;

X = A-1.x

End matrix formula's in excel with Ctrl Shift Enter

clp
  • 1,098
  • 5
  • 11