Re: How to solve the system of linear equations?
- To: mathgroup at smc.vnet.net
- Subject: [mg25450] Re: How to solve the system of linear equations?
- From: Jeff DuMonthier <jeff at lheapop.gsfc.nasa.gov>
- Date: Sun, 1 Oct 2000 02:44:31 -0400 (EDT)
- Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov)
- References: <8r17ui$h8r@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <8r17ui$h8r at smc.vnet.net>, Zak Levi <zaklevi at yahoo.com> wrote: > Dear Mathematica experts, > > How to solve, in Mathematica, the system of linear equations, > > when a number of equations is larger than a number of variables. > > Another system easily pass to apply LSM in this case, but it seems to > me that there is no such opportunity in Mathematica. > > As an application, given N>5 points at plane, how to calculate (the > parameters) of best fitting ellipse. > > Thanks a lot, > ZL This is what I have done before: FindMinimum[Apply[Plus, Map[(# #)&, {A11 X1 + A12 X2 + ... + A1n Xn - B1, A21 X1 + A22 X2 + ... + A2n Xn - B2, ... Am1 X1 + Am2 X2 + ... + Amn Xn - Bm} ] ], {X1, 0.0}, {X2, 0.0}, ... {Xn, 0.0} ] This is a least square error minimization for m equations in n variables (m >= n) in the standard A X = B form. The (# #) is because I can't do exponents in plain text. You may have to change the zeros to some other appropriate initial conditions.