MathGroup Archive 2001

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

Search the Archive

Re: List Manipulation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg31551] Re: List Manipulation
  • From: "Manfred Plagmann" <m.plagmann at irl.cri.nz>
  • Date: Sat, 10 Nov 2001 01:19:40 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Jonathan,

this might do what you want:

In[1]:= eigList = {{A, {0, 0, 0, 5}}, {B, {3, 0, 0, 6}}, {C, {-5, -3, 0,
0}}, {D,{7,0, 0, -7}}};


In[2]:= eigList[[All, 2]] = Map[Sign, eigList[[All, 2]]];

In[3]:= eigList

Out[10]= {{A, {0, 0, 0, 1}}, {B, {1, 0, 0, 1}},
          {C, {-1, -1, 0, 0}}, {D, {1, 0, 0, -1}}}

Cheers,
Manfred




----------
>From: woodward at chem.ufl.edu (Jonathan Woodward)
To: mathgroup at smc.vnet.net
>Subject: [mg31551] [mg31538] List Manipulation
>Date: Sat, Nov 10, 2001, 12:13 AM
>

> I am a relatively new user to Mathematica with virutally no
> programming experience and need help with a problem:
>
> Given the following hypothetical eigensystem, a "list of lists" which
> has the eigenvalues (A,B,C,D) associated with their corresponding
> eigenvectors ({0,0,0,a},{b,0,0,d},{-a,-b,0,0},{c,0,0,-c}):
>
> {{A,{0,0,0,a}},{B,{b,0,0,d}},{C,{-a,-b,0,0}},{D,{c,0,0,-c}}}
>
> where the list contains zeros, symbolic expressions, and numbers.
> The actual system I have is the eigensystem of a 32x32 symbolic matrix
> where the vector components seem to take up hundreds of pages and
> are therefore almost useless to me.  However, I am interested in the
> position of the zero and nonzero components only, not their actual
> values.
>
> So what I want to do is transform the list into another more
> useful list in the following way:
>
> I do not want to change the eigenvalues but want to convert all
> eigenvector
> components in such a way that I have a list of zeros, ones, and
> negative ones.
> In other words, divide each eigenvector component by its absolute
> value, except for the zeros, to create a new list that might now look
> like:
>
> {{A,{0,0,0,1}},{B,{1,0,0,1}},{C,{-1,-1,0,0}},{D,{1,0,0,-1}}}
>
> This way I can greatly simplify my problem while keeping the position
> of the
> zero and nonzero elements of the components unchanged.
>
> How would I write a code in Mathematica to accomplish this?  In
> particular,
> how would do I tell the program to scan through this list, doing
> nothing
> to the eigenvalues, but look through the eigenvectors, check to see if
> they
> are nonzero (if zero, do nothing) and divide each nonzero component by
> its
> absolute value, and return a new list.  I don't want to break the list
> apart
> and operate just on the vector components themselves because I want to
> preserve the eigenvalue-eigenvector association.  Also, I need to be
> able to tell
> the program that symbols of the type {x} are positive and {-x} are
> negative
> otherwise I might have a list returned like:
>
>
{{A,{0,0,0,a/Abs[a]}},{B,{b/Abs[b],0,0,d/Abs[d]}},{C,{-a/Abs[a],-b/Abs[b],0,
0}},{D,{c
> /Abs[c],0,0,-c/Abs[c]}}}
>
> which is not simplified to what I need.
>
> Any help would be greatly appreciated.
>
> Thanks
>
> Jonathan Woodward
> 


  • Prev by Date: Re: List Manipulation
  • Next by Date: Re: Storing Data into Excel - Pls Help ...
  • Previous by thread: Re: List Manipulation
  • Next by thread: Re: List Manipulation