Re: Solving Overdetermined Systems
- To: mathgroup@smc.vnet.net
- Subject: [mg11557] Re: Solving Overdetermined Systems
- From: Julian Stoev <stoev@SPAM-RE-MO-VER-usa.net>
- Date: Sat, 14 Mar 1998 13:56:11 -0500
- Organization: Seoul National University, Republic of Korea
- References: <6ecdmf$552@smc.vnet.net>
On 13 Mar 1998, Mark Lawrence Storch wrote: |From: Mark Lawrence Storch <mscc+@andrew.cmu.edu> To: mathgroup@smc.vnet.net |Subject: [mg11557] Solving Overdetermined Systems | |Hello, | I am having a problem solving an overdetermined system of equations. | Specifically, I have 180 equations in 5 variables. Each of these |equations takes the form | |C1*H1 + C2*H2 + C3*H3 + C4*H4 + C5*H5 = L | |where the h's are the unknowns and all of the values for C1...C5 and L |are known. Currently, I have values for the C's and L which are |calculated form specific values of the H's. I have tried |FindRoot,Solve and Nsolve and only met with different error messages. |FindRoot does not like overdetermined systems and both Solve and Nsolve |cannot seem to get going even when specifying two starting values for |the secant method. If anyone could point me in the right direction on |this, I would be most appreciarive. |Thank you, |Mark Storch Hello Mark, Your problem is to find a linear regression. First you have to keep in mind that for overdetermined system you can have only approximate solution. This implies, that you will have some error and you would like to make this error as small, as possible. Most often the solution of this kind of problems is in so called "Lest Squares". Most common representation in these cases is a matrix representation. You can obtain it using Mathematica function LinearEquationsToMatrices. To use it, you have to write first << LinearAlgebra`MatrixManipulation` Then you can look for the help on this function: ?LinearEquationsToMatrices Then suppose that you have your equations in a list like this: eqs={eq1, eq2, ....eqn}, where each eq is in the form c1*h1+...c5*h5==l (it is a good idea not to use capital letters in Mathematica in generall) and you have your unknouns in other list: h={h1,h2,h3,h4,h5} Then you have to use: {c,l}=LinearEquationsToMatrices[eqs,h]; Then your system is equivalently represented in matrix form as c.h=l Most often you want to find such h, so that after multipication c.h, the result is as close, as possible to l. The well known solution to this minimization is by using pseudoinverses, but I think if you want to learn more, you should read some book. I will just tell you that in Mathematica you can use: h=LinearSolve[c,l] This will give the h you search for. There may be other minimizations of this problem and some of them may give results, which may be better for you, but the solution I give you is a kind of typical. Hope this helps... ____________________________________________________________________ Julian Stoev Ph. D. student Intelligent Information Processing Lab. Seoul National University