Re: Help with minimization of Eigenvalues

*To*: mathgroup at smc.vnet.net*Subject*: [mg87770] Re: Help with minimization of Eigenvalues*From*: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>*Date*: Wed, 16 Apr 2008 22:30:49 -0400 (EDT)*Organization*: The Open University, Milton Keynes, UK*References*: <fu4ll6$sfq$1@smc.vnet.net>

Chimico wrote: > I am trying to minimize a particular eigenvalue of a generalized > eigenvalue problem that depends on a few parameters. I have the > following problem: > > Suppose we have two matrices s and m like these (the real matrices are > much more complicated) > > m = {{a, b}, {b, -a + 1}} > > s = {{1, 0}, {0, 3a}} > > If I define the function Eig > > Eig[a_, b_] := Eigenvalues[{m, s}]//First > > And use it with the FindMinimum function it does not work. > Infact just calling > > Eig[1,2] gives the error > > Eigenvalues::gfargs: > Generalized Eigenvalues > arguments accept only matrices with machine real > and complex elements. More... > > Even inserting Evaluate[] into the Eigenvalues function does not work. > What am I doing wrong? Your function Eig[a, b] does *not* use or pass its arguments to the matrices m and s. (In other words, the values a and b on the LHS are not used on the RHS: the matrices still hold the symbols a and b.) The following is one possible way to modify the value of a and b within the matrices m and s. In[29]:= m = {{a, b}, {b, -a + 1}}; s = {{1, 0}, {0, 3 a}}; Eig[p_, q_] := Eigenvalues[N@{m, s} /. a -> p /. b -> q] // First Eig[1, 2] Out[32]= 1.75831 Moreover, though I am not sure to have fully understood what you tried to achieved, you might be interested in using the function CharacteristicPolynomial[] to compute the eigenvalues in a symbolic form and use these results to solve or minimize them. In[46]:= CharacteristicPolynomial[{m, s}, x] Out[46]= a - a^2 - b^2 - x + a x - 3 a^2 x + 3 a x^2 In[51]:= Reduce[CharacteristicPolynomial[{m, s}, x] == 0] Out[51]= (x == -(1/3) && a == 1/3 (-1 + 3 b^2)) || (1 + 3 x != 0 && (a == ( 1 + x + 3 x^2 - Sqrt[-4 (b^2 + x) (1 + 3 x) + (-1 - x - 3 x^2)^2])/( 2 (1 + 3 x)) || a == (1 + x + 3 x^2 + Sqrt[-4 (b^2 + x) (1 + 3 x) + (-1 - x - 3 x^2)^2])/( 2 (1 + 3 x)))) Regards -- Jean-Marc