ALGLIB forum
It is currently Thu Dec 08, 2022 5:31 am

All times are UTC

Forum rules

1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: rmatrixsolvels gives different answer for the same problem?
PostPosted: Thu Jan 31, 2013 10:36 pm 

Joined: Thu Jan 31, 2013 10:21 pm
Posts: 1
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
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!

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group