       RE: Re: Mathematica 4.2 & Strange Plot results

• To: mathgroup at smc.vnet.net
• Subject: [mg36386] RE: [mg36328] Re: Mathematica 4.2 & Strange Plot results
• From: "DrBob" <drbob at bigfoot.com>
• Date: Wed, 4 Sep 2002 02:56:43 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```Plot[Evaluate[Sin[x]/Sin[x]], {x, -2.5, -1.5}]

Gives the "expected" graph.

Bobby Treat

-----Original Message-----
From: Ian McInnes [mailto:ian at whisper-wood.demon.co.uk]
To: mathgroup at smc.vnet.net
Subject: [mg36386] [mg36328] Re: Mathematica 4.2 & Strange Plot results

This results from:
a) the fact that Mathematica implements division as multiplication and
reciprocation
b) the use of machine precision for plotting the graph
c) the default scaling of the y axis revealing the resultant
inaccuracies

Although Sin[x]/Sin[x] gives 1 when evaluated symbolically (x
undefined),
substituting a floating-point value for x results in composite division
being performed numerically, with consequent inaccuracy. This can be
verified by the following:
In:= FullForm[HoldForm[Sin[x]/Sin[x]]
Out//FullForm= HoldForm[Times[Sin[x], Power[Sin[x], -1]]]

By default, Mathematica scales the y axis such that the small
discrepancies
are visible. The PlotRange option may be given to explicitly specify the
range for the y axis (for example PlotRange->{0, 2}).

Regards,
Ian McInnes.

"Ken Thomson" <someone at somewhere.com> wrote in message
news:akn016\$ljr\$1 at smc.vnet.net...
> 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.
>
>
>

```

• Prev by Date: RE: Mathematica 4.2 Benchmarks?
• Next by Date: RE: RE: Generating Two Unit Orthogonal Vectors to a 3D Vector
• Previous by thread: Re: Mathematica 4.2 & Strange Plot results
• Next by thread: RE: How to ...? Piecewise Function Definition