Re: Difference of numbers in the list
- To: mathgroup at smc.vnet.net
- Subject: [mg45908] Re: Difference of numbers in the list
- From: drbob at bigfoot.com (Bobby R. Treat)
- Date: Thu, 29 Jan 2004 05:35:08 -0500 (EST)
- References: <bv83mt$ie1$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
You could Flatten your A-B before applying ListPlot. Or you could
produce the differences directly in the Table statement. Or you could
do this:
Table[{((6.67/10^8)*157.85)/(0.225 - x)^2, (Pi^2/420^2)*
x}, {x, 0., 0.007245, 0.001}]
ListPlot[Subtract @@@ %, PlotStyle -> PointSize[.02]]
Bobby
mtmtk2003 at yahoo.com (mtmtk) wrote in message news:<bv83mt$ie1$1 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.