MathGroup Archive 1998

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

Search the Archive

Re: Re: Solving for coefficients...



Paul, puzzled as I was about this seemingly wonderful solution, I
checked it on an example:

In[1]:= nn={10,24,45,12,1,38,21,1};

In[2]:=
data0={1.0002,1.2303,2.3456,4.5326,5.2113,40.3456,59.24,100.4321};

In[3]:= data=Flatten[{data0,data0.nn}] Out[3]=
{1.0002,1.2303,2.3456,4.5326,5.2113,40.3456,59.24,100.4321,3082.29}

In[4]:=
dd=Rationalize[#]&@Transpose[Append[IdentityMatrix[Length[data]],10000data]]
;
sol=LatticeReduce[dd]
Out[4]=
        {{1,3,-2,0,0,0,0,0,0,-1},
         {1,1,2,0,-1,-4,1,1,0,1},
         {-1,0,-1,-3,-4,-2,2,0,0,0},
         {4,-3,-1,-3,3,0,0,0,0,4},
         {-2,2,2,-4,2,3,-2,0,0,4},
         {-2,-1,-1,5,1,-1,2,-1,0,3},
         {-1,-1,1,0,-1,0,-5,3,0,1},
         {3,2,2,-2,-4,4,1,-2,0,2},
         {1,1,4,0,-2,-8,-11,-21,1,0}}


When I tried TranscendentalRecognize, the answer was

 Power::infy  : Infinite expression 1/0 encountered.

Out[101]= ComplexInfinity


Did I miss the point?

Jürgen

-----Original Message-----
From: Paul Abbott <paul@physics.uwa.edu.au> To: mathgroup@smc.vnet.net
Subject: [mg12252] [mg12204] 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: How to do 3D plot of vertical planes?
  • Next by Date: Re: Want a smooth function from Arg[ ]
  • Prev by thread: Re: Solving for coefficients...
  • Next by thread: Re: Q. about Solve as applied to vector equations