Working with Lists
- To: mathgroup at smc.vnet.net
- Subject: [mg104327] Working with Lists
- From: BenT <brtubb at pdmusic.org>
- Date: Wed, 28 Oct 2009 04:05:19 -0500 (EST)
I have several practical problems which I need to solve, and
understand, preferable in a generic matter well, before needing to
apply them specifically pertaining to:
using a "generic" example:
f={{1,2,},{3,4,},{5,6},{7,8}}
NOTE: the use of 1 thru 8 for the values is purely arbitrary so please
to do not apply any "simplifications" based on their present values.
I know have to obtain the sum of all of the elements in each of the
lists by using
Apply[Plus,f]
and from it, I can use the Part function or "[[]]" method of obtaining
each result as needed.
asum=Apply[Plus,f][[1]]
bsum=Apply[Plus,f][[2]]
What I further need are methods to:
(1) obtain separate lists, call them a and b which contain just the
1st and 2nd elements of each sublist respectively
(2) then after further, if eny modification of either list's data (a
copletely separate issue), I need to know the method of how to merge
them, and replace the original data.
I know how to apply Rule's to transform data on a list of single
elements, but not for "larger" lists.
Consider this code:
f={{0,1},{7,1},{12,2}}
rd={1->1/4,2=1/2}
How can I apply the rd "rule" (or any Rule) to just the second
elements' 2nd values in the f list? And more importantly how are such
things done generically?
And someone please define distinct differences between:
(1) list
(2) sequence
(2) vector
(2) array
(3) matrix/table
I'm using Mathemata Version 7, but am only a "hobbies" at it. Music is
my primary interest.
--- Benjamin Tubb