MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Solving for coefficients...



Paul Abbott wrote:

> Here is one approach which uses LatticeReduce (see the Mathematica
> Journal 6(2): 29-30).  Define NValues for a, b, c etc., e.g.,

Here is a much simpler (and direct) approach to that I outlined before. 
Write the experimentally determined values

	59.2406 == 1.2303 a + 4.5326 b + 5.2113 c, as

  In[1]:= data={1.2303,4.5326,5.2113,59.2406};
  In[2]:= 10000 Rationalize[data]
  Out[2]= {12303, 45326, 52113, 592406}

Appending this vector (of length 4) to a 4x4 identity matrix and use
LatticeReduce:

  In[3]:= Append[IdentityMatrix[Length[data]],%];
  In[4]:= LatticeReduce[Transpose[%]]
  Out[4]= {{-8, -4, -6, 1, 0}, {-13, 12, 4, -1, 19},  
  {-21, -13, 39, -2, -6}, {-4, 36, -19, -1, -29}}

In this case, the vector with last element 0, i.e., {-8, -4, -6, 1, 0}
expresses the  exact (to this precision) solution, i.e.,

	59.2406 == 1.2301 (8) + 4.5327 (4) + 5.2113 (6)

The other vectors are approximate solutions with the last element of
each vector showing the size of the error. Of course, in your problem,
all the multipliers must be positive.

We combine the above steps into a procedure:

  In[5]:= identify[data_]:= LatticeReduce[
    Transpose[Append[IdentityMatrix[Length[data]],10000
Rationalize[data]]]]

and get the same answer as before:

  In[6]:= identify[data]
  Out[6]={{-8, -4, -6, 1, 0}, {-13, 12, 4, -1, 19},  
  {-21, -13, 39, -2, -6}, {-4, 36, -19, -1, -29}}

If we perturb the data slightly, say

  In[7]:= data={1.2301,4.5327,5.2113,59.2406};
  In[8]:= identify[data]
  Out[8]= {{-8, -4, -6, 1, 12}, {-20, 7, 10, -1, -7},  
  {-4, -40, 13, 2, -3}, {11, 24, 22, -4, 21}}

we now find two possible "solution" vectors:

		1.2301 (8) + 4.5327 (4) + 5.2113 (6), and
		1.2301 (11) + 4.5327 (24) + 5.2113 (22),

with errors of 12/10000 == 0.0012 and 0.0022 respectively.

Cheers,
	Paul 

____________________________________________________________________ 
Paul Abbott                                   Phone: +61-8-9380-2734
Department of Physics                           Fax: +61-8-9380-1014
The University of Western Australia            Nedlands WA  6907       
mailto:paul@physics.uwa.edu.au  AUSTRALIA                            
http://www.pd.uwa.edu.au/~paul

            God IS a weakly left-handed dice player
____________________________________________________________________



  • Prev by Date: Re: Q. about Solve as applied to vector equations
  • Next by Date: Re: Calculating eigenvector for zero eigenvalue
  • Prev by thread: Re: Solving for coefficients...
  • Next by thread: Re: Re: Solving for coefficients...