forum.alglib.net
http://forum.alglib.net/

rmatrixsolvels gives different answer for the same problem?
http://forum.alglib.net/viewtopic.php?f=2&t=766
Page 1 of 1

Author:  shale [ Thu Jan 31, 2013 10:36 pm ]
Post subject:  rmatrixsolvels gives different answer for the same problem?

Hi all,

I'm a newbiew to this forum. I encountered a problem when using the function rmatrixsolvels to solve a overdetermined A*x = b problem.

The purpose is solving two unknowns, u1 and u2. The equation is as this format
G = u1 * P / (P + u2).
G and P are both observed from real experiments.
The equation above can be transformed into two different formats as below.
Format 1
P * u1 - p * u2 = G * P
Format 2
p * 1 / u1 + u2 / u1 = P / G.
In Format 2, I set 1 / u1 as x1, and u2 / u1 as x2, so for A*x = b, the equation is like
G * x1 + x2 = P/G
Clearly,
A[i, 0] = Gi, A[i, 1] = 1;
b[i] = Pi/Gi, i = 1,2,..,m data points
Then I used rmatrixsolvels to solve the problem and got the exact answers I want.

However, if I follow Format 1,
A[i, 0] = Pi, A[i, 1] = -Gi;
b[i] = Gi * Pi,
Then I used rmatrixsolvels and got totally different answers!

I'm wondering when we use rmatrixsolvels, should one column in matrix A be always 1? Is that why my Format 2 failed? Per my poor knowledge on least-square method, the equation is x0 + x1*t1 + x2* t2 .... = y. Does that mean the coefficient for x0, is 1 by default?
It may be more like a math rather than coding quesiton. Any comments appreciated!

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/