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: [mg45896] RE: [mg45884] Difference of numbers in the list
  • From: "Florian Jaccard" <florian.jaccard at eiaj.ch>
  • Date: Thu, 29 Jan 2004 05:34:43 -0500 (EST)
  • Reply-to: <florian.jaccard at eiaj.ch>
  • Sender: owner-wri-mathgroup at wolfram.com

Here a easy way :

In[31]:=
ListPlot[Table[{((6.67/10^8)*157.85)/(0.225 - x)^2,
     (Pi^2/420^2)*x}, {x, 0., 0.007245, 0.001}] /.
   {a_ -> b_} :> a - b, PlotStyle -> PointSize[0.02]]

But your idea is alright !
You only have to get a simple List.
For that, use Flatten !

ListPlot[Flatten[A-B],PlotStyle->PointSize[0.02]]

Meilleures salutations

Florian Jaccard
professeur de Mathématiques
EICN-HES
7, av. de l'Hôtel-de-Ville
CH-2400 Le Locle
tél. centrale +41 32 930 30 30
tél. direct +41 32 930 35 52
e-mail : florian.jaccard at eiaj.ch


-----Message d'origine-----
De : mtmtk [mailto:mtmtk2003 at yahoo.com]
Envoyé : mer., 28. janvier 2004 11:20
À : mathgroup at smc.vnet.net
Objet : [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.




  • Prev by Date: RE: Difference of numbers in the list
  • Next by Date: Re: changing replacement rule arrow ( ->) to equal sign(==)...
  • Previous by thread: RE: Difference of numbers in the list
  • Next by thread: Re: Difference of numbers in the list