       Re: List Manipulation

• To: mathgroup at smc.vnet.net
• Subject: [mg31556] Re: List Manipulation
• From: peter weijnitz <pewei at algonet.se>
• Date: Sun, 11 Nov 2001 00:34:43 -0500 (EST)
• References: <9sgeqm\$93v\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```A simple trnsformation seems to work

{{A, {0, 0, 0, 5}}, {B, {3, 0, 0, 6}}, {C, {-5, -3, 0,0}}, {D,{7,0, 0,-7}}}/.{ww_,{a_,b_,c_,d_}}->{
ww,{Sign[a],Sign[b],Sign[c],Sign[d]}}

gives:
{{A,{0,0,0,1}},{B,{1,0,0,1}},{C,{-1,-1,0,0}},{D,{1,0,0,-1}}}

Jonathan Woodward wrote:

> 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: Text Statements in 3D Graphics
• Next by Date: Re: Limit question
• Previous by thread: Re: List Manipulation
• Next by thread: Built-in functions to C code