Re: Lists
- To: mathgroup at yoda.physics.unc.edu
- Subject: Re: Lists
- From: Boss Man <BOSS at noaapmel.gov>
- Date: Tue, 16 Mar 1993 14:14 PDT
Richard writes: ----------------------------------- I am having a difficult time dealing with lists. I have a list of data : {{1,2},{2,3},{4,5}} I want to do some operations on the second column only. Such as +1, Sin[], etc to each element in the second column. I admit I only have a rudimentary knowledge of Map, Apply, Transpose, and Flatten. Any help would be appreciated. Also, I have data that needs several fitting equations. One will be Exp[a x -b], another Exp[-c x+d], and the last would be a polynomial. Then I would like to Plot the data and fitting equations in there respective regions at the same time. I have seen something like this before, but I can't remember where. Thanks Richard ---------------------------------------- Try using map and Transpose as in the following examples: a = {{1,2},{2,3},{4,5}} {{1, 2}, {2, 3}, {4, 5}} b = Map[(# + 1)&, Transpose[a][[2]]] {3, 4, 6} c = Map[(Sin[#])&, Transpose[a][[2]]] {Sin[2], Sin[3], Sin[5]} It seems there must be a more elegant way to do this, but this may get you started. Ed Boss NOAA/PMEL