Need help with creating a List
- To: mathgroup at yoda.ncsa.uiuc.edu (Mathematica Mailing List)
- Subject: Need help with creating a List
- From: Avi Y. Feldblum <uunet!pruxk!ayf>
- Date: Wed, 22 Aug 90 12:57:13 EDT
I am having some trouble with creating a list for plotting with ListPlot. As I understand it, what is needed is a list of lists, where each element of the main list is a list of two values, the x and y positions to be plotted. In my case, the x values are just a set of evenly spaced values, while the y values are the difference between some data I have and a functional form for the data. What I have is: func[x_] = "some long function" The data is in a list called "data" diff[x_] := data[[x]] - func[.05x] difftable = Table[ {.05i, diff[i]}, {i, Length[data]} ] My problem is the output of difftable. It looks like: {{.05, {value1}}, {.01, {value2}}, ....} What it needs to be for ListPlot to work (I think) is: {{.05, value1}, {.01, value2}, ....} I tried to make a test file with a simple func[x_] and just put in some datapoints, and there it did work. So I'm confused as to when and why mathematica is giving me {{xval1,yval1},{xval2,yval2}, ..} in one case and {{xval1,{yval1}}, {xval2,{yval2}}, ..} in the other case. Any ideas or suggestions? -- Avi Feldblum ayf at pruxk.att.com or avi_feldblum at att.com