Re: Re: A plot of Sign[x]
- To: mathgroup at smc.vnet.net
- Subject: [mg94155] Re: [mg94146] Re: A plot of Sign[x]
- From: "Curtis F. Osterhoudt" <cfo at lanl.gov>
- Date: Sat, 6 Dec 2008 06:13:18 -0500 (EST)
- References: <gh8hjr$r0h$1@smc.vnet.net>
- Reply-to: cfo at lanl.gov
It's a sampling issue. Why not use a ListPlot of the exact numbers you want? ListPlot[{#, Sign[#]} & /@ Range[-5, 5, 1/10]] At least then you're guaranteed to sample right on zero. Your Table example does exactly the same thing, but due to numerical problems, it might not sample at exactly 1/100 intervals. Change the 0.01 to 1/100, and you're guaranteed your Sign[0] == 0 point. > Thanks for the replies. > > But do I really have to conclude that Mathematica is unable to make a > decent > automatic Plot of a function as simple as Sign[x]? > > Following does the trick: > a := Table[{x, Sign[x]}, {x, -5, 5, .01}] > ListPlot[a] > > > Bert Aerts (rm X) wrote: > >> I tried to plot the Sign function, making clear that Sign[0]=0 by typing >> Plot[Sign[x], {x, -5, 5}, Mesh -> 51, PlotRange -> All] >> Making Mesh an odd value shows x=0. >> >> But the point at x=0 is being plot as 0.5 in stead of zero. >> >> What am I doing wrong? >> >> Mathematica 6.0.3 Linux x86_64 > > >