MathGroup Archive 2002

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

Search the Archive

Re: Mathematica 4.2 & Strange Plot results

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36316] Re: [mg36292] Mathematica 4.2 & Strange Plot results
  • From: Dale Horton <daleh at wolfram.com>
  • Date: Sat, 31 Aug 2002 01:26:00 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

At 12:19 AM 8/30/2002, Ken Thomson wrote:
>I would expect that
>
>Plot[Sin[x]/Sin[x], {x, -2.5, -1.5}]
>
>would produce a horizontal line at y=1.
>
>However, on my Windows XP computer it produces a graph where the y value is
>less than 1 at several points.  Most notibly between x=-1.6 and x=-1.8
>
>Is this just an isolated case? Or does it happen to others?  If so - why?
>
>Regards,
>Ken.

The y axis has a very narrow range. The differences are very small. To see 
that, you can pull out the tick marks.

In[13]:=
yticks=FullOptions[gr,Ticks][[2]]

In[15]:=
InputForm[First/@yticks]

Out[15]//InputForm=
{0.9999999999999981, 0.9999999999999991, 1.,
  1.000000000000001, 1.000000000000002,
  0.9999999999999983, 0.9999999999999986,
  0.9999999999999987, 0.9999999999999989,
  0.9999999999999993, 0.9999999999999996,
  0.9999999999999997, 0.9999999999999999,
  1.0000000000000002, 1.0000000000000004,
  1.0000000000000007, 1.0000000000000009,
  1.0000000000000013, 1.0000000000000016,
  1.0000000000000018, 1.000000000000002,
  0.9999999999999979, 0.9999999999999977,
  1.0000000000000022}

The ragged shape is caused by roundoff error, if you increase the PlotRange 
of the y-axis you see what you expect.

gr = Plot[Sin[x]/Sin[x], {x, -2.5, -1.5},  PlotRange -> {0, 2}]

-Dale



  • Prev by Date: Re: Using a Named Pattern in a Rule
  • Next by Date: emmathfnt on WIN98
  • Previous by thread: Re: Mathematica 4.2 & Strange Plot results
  • Next by thread: Resizing Graphics