RE: Difference of numbers in the list
- To: mathgroup at smc.vnet.net
- Subject: [mg45901] RE: [mg45884] Difference of numbers in the list
- From: "David Park" <djmp at earthlink.net>
- Date: Thu, 29 Jan 2004 05:34:51 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
tab = Table[{((6.67/10^8)*157.85)/(0.225 - x)^2, (Pi^2/420^2)*x}, {x, 0., 0.007245, 0.001}]; difs = Subtract @@@ tab {0.000207972, 0.000209777, 0.000211608, 0.000213463, 0.000215345, \ 0.000217253, 0.000219188, 0.000221151} ListPlot[difs, Prolog -> AbsolutePointSize[4]]; David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: mtmtk [mailto:mtmtk2003 at yahoo.com] To: mathgroup at smc.vnet.net I have this table: Table[{((6.67/10^8)*157.85)/(0.225 - x)^2, (Pi^2/420^2)*x}, {x, 0., 0.007245, 0.001}] This is the output: {{0.00020797224691358022, 0.}, {0.00020983328683035708, 5.595013832817097*^-8}, {0.00021171941925234768, 1.1190027665634194*^-7}, {0.0002136310973135297, 1.678504149845129*^-7}, {0.0002155687844229233, 2.2380055331268388*^-7}, {0.00021753295454545455, 2.797506916408548*^-7}, {0.00021952409249181628, 3.357008299690258*^-7}, {0.00022154269421765846, 3.9165096829719676*^-7}} I wanted to plot the difference of each pair but the only solution I could find was to first have two tables A and B then take A-B and try to plot that. A = Table[{((6.67/10^8)*157.85)/(0.225 - x)^2}, {x, 0., 0.007245, 0.001}] B = Table[{(Pi^2/420^2)*x}, {x, 0, 0.007245, 0.001}] A - B {{0.00020797224691358022}, {0.0002097773366920289}, {0.00021160751897569133}, {0.00021346324689854517}, {0.00021534498386961064}, {0.0002172532038538137}, {0.00021918839166184726}, {0.00022115104324936126}} But ListPlot will give an error for this : "...is not a list of numbers or pairs of numbers." When I delete the curly braces around the numbers then ListPlot works. But this is too complicated for plotting the difference of two sets of numbers. How can this be done simply? Thanks for any help.