MathGroup Archive 2001

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

Search the Archive

Re: out of memory, again.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg27500] Re: [mg27473] out of memory, again.
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Thu, 1 Mar 2001 03:53:26 -0500 (EST)
  • References: <200102270537.AAA16252@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Ivan Stegic wrote:
> 
> hi again...
> 
> you may remember the problem i outlined below. i received some help, and
> managed to find the eigenvectors. luckily, i am not interested in all
> three, rather only the real eigenvector. it turns out that the real eigen
> vector is a text file of about 60kb containing cos and sin of two
> parameters... ive tried to simplify each component in turn using
> FullSimplify, to which the machine crunches for about 26 hours, and spits
> out another out of memory exiting message. are there any wise ideas, or
> clever tricks i may try? perhaps someone out there has a machine which
> could attack the simplification by brute force? i would ofcourse cite your
> help, if you like. the eigenvector was too hefty to attach, so i uploaded
> it to the web.
> 1st comp: http://stegic.com/1stcomponent.dat
> 2nd comp: http://stegic.com/2ndcomponent.dat
> 3rd comp: http://stegic.com/3rdcomponent.dat (unity!)
> 
> and the single eigen vector as a whole, for completeness:
> http://stegic.com/N.dat
> 
> any advice, help, comments appreciated.
> 
> ivan, the desperate.
> 
> --- Original Message ---
> 
> >Hello everyone...
> >
> >I've searched the archives extensively, and found various answers to my
> >problem. However, none of them helped me. I am trying to find the
> >eigenvectors to a 3x3 matrix. I keep running into Out of Memory Exiting
> >problems, whether I run it with the frontend or without. I am running
> >Mathematica 3 on a RedHat Linux 5.1, Kernel 2.0.35  Pentium II 400 with
> >128MB of RAM. The matrix I have contains 2 variables, and I am trying to
> >solve the for the Eigenvectors symbolically in terms of these variables.
> >The catch is that the variables are trigonometric functions. Following is
> >the command I execute. The result is "Out of Memory. Exiting." What can I
> >do? Could someone else try this on their more powerful machines, or will
> it
> >still run into the same problem? Or is there a way of simplifying this? Or
> >the matrix?
> >
> >Thanks very much,
> >Ivan.
> > [...]


Symbolic Eigenxxx will use Roots[] on the characteristic polynomial. You
might try

SetOptions[Roots, Cubics->False]

to get a much smaller expression involving algebraic functions expressed
as Root[...] rather than in terms of radicals. These three functions
will be parametrized by your variables {p,q}. As the parameters change,
the branches of these functions might cross. One nice fact is that the
first is always guaranteed to be real; this is due to the way that
Root[...] functions are canonically ordered. Given you need this is
another good reason to use Root functions rather than radicals, as with
the latter your real values may move from one eigenvalue to another when
branches cross.

As I think someone else pointed out, if you are going to use symbolic
techniques it is best first to rationalize everything in sight. Last
week when I was playing around with this I did

mat = {{Cos[q]^2 - Cos[2*p]*Sin[q]^2,
   1.*(Sin[2*p]*Sin[2.*p]*Sin[q] + Cos[p]^2*Cos[2.*p]*Sin[2*q]),
   1.*Cos[2.*p]*Sin[2*p]*Sin[q] - 1.*Cos[p]^2*Sin[2.*p]*Sin[2*q]},
  {-(Cos[p]^2*Sin[2*q]), 1.*Cos[q]*Sin[2*p]*Sin[2.*p] -
    1.*Cos[2.*p]*(-(Cos[2*p]*Cos[q]^2) + Sin[q]^2),
   1.*(Cos[2.*p]*Cos[q]*Sin[2*p] +
      Sin[2.*p]*(-(Cos[2*p]*Cos[q]^2) + Sin[q]^2))},
  {Sin[2*p]*Sin[q], -1.*Cos[2.*p]*Cos[q]*Sin[2*p] +
1.*Cos[2*p]*Sin[2.*p],
   1.*(Cos[2*p]*Cos[2.*p] + Cos[q]*Sin[2*p]*Sin[2.*p])}};

matrat = Rationalize[mat]

Eigenvector extraction uses NullSpace on
matrix-eigenvalue*IdentityMatrix[...]. To make this work correctly I had
to tweak the internal zero-test code, as Eigensystem was getting an
empty null space for each eigenvalue due to a failure to recognize that
certain extremely complicated candidate pivots were zero. The example
shown below is from our development version.

In[13]:= SetOptions[Roots, Cubics->False];

In[14]:= Timing[eigsys = Eigensystem[matrat];]
Out[14]= {51.8 Second, Null}

In[15]:= LeafCount[eigsys]
Out[15]= 11055

What can one do right now for a work-around? As someone pointed out, you
can instead just do this for a vanilla matrix and then plug in your
values after the fact. This will work most of the time, but will mess up
on non-diagonalizable matrices. Also, while it is alot faster for you
example, this need not always be the case. Hence it is a useful tactic
but requires some caution.

In[17]:= newmat = Array[a, {3,3}];

In[18]:= Timing[eigsys2 = Eigensystem[newmat];]
Out[18]= {2.19 Second, Null}

In[19]:= LeafCount[eigsys2]
Out[19]= 3114

In[22]:= eigsys3 = eigsys2 /. Thread[Flatten[newmat]->Flatten[matrat]];

In[25]:= eigsys3 === eigsys
Out[25]= True


Daniel Lichtblau
Wolfram Research


  • Prev by Date: Re: Number formatting for financial applications
  • Next by Date: Re: Out of Memory. Exiting.
  • Previous by thread: Re: Number formatting for financial applications
  • Next by thread: Re: Out of Memory. Exiting.