MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Difference of numbers in the list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg45895] RE: [mg45884] Difference of numbers in the list
  • From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
  • Date: Thu, 29 Jan 2004 05:34:42 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com


>-----Original Message-----
>From: mtmtk2003 at yahoo.com [mailto:mtmtk2003 at yahoo.com]
To: mathgroup at smc.vnet.net
>Sent: Wednesday, January 28, 2004 11:20 AM
>To: mathgroup at smc.vnet.net
>Subject: [mg45895] [mg45884] Difference of numbers in the list
>
>
>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.
>

Not complicated, with your A, B, just Flatten (did you do that by hand?)

ListPlot[Flatten[A - B], PlotStyle -> PointSize[.02]]


However starting from your first form of the data:


t = Table[{((6.67/10^8)*157.85)/(0.225 - x)^2, (Pi^2/420^2)*x}, {x, 0., 
        0.007245, 0.001}];

{a, b} = Transpose[t];

ListPlot[a - b, PlotStyle -> PointSize[.02]]

--
Hartmut Wolf


  • Prev by Date: Re: Nasty bug in Integrate (version 5.0)
  • Next by Date: RE: Difference of numbers in the list
  • Previous by thread: Re: Difference of numbers in the list
  • Next by thread: RE: Difference of numbers in the list