Re: Problem plotting a piecewise function
- To: mathgroup at smc.vnet.net
- Subject: [mg14557] Re: Problem plotting a piecewise function
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Fri, 30 Oct 1998 03:07:29 -0500
- References: <70ras4$sge@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
sergio at scisun.sci.ccny.cuny.edu wrote in message <70ras4$sge at smc.vnet.net>... >(*-- > Hello guys, > > Could somebody explain why in the following plot nothing is > drawn between x =(0,0.5)? > How can I have the complete plot of this function? > Notice that f[0] = 1.0 and the y-axis tick mark gets up to > about 0.15 >---*) >Clear[f,Xa,Xb]; >f[x_] := Which[x >= 0. && x <= 1.5, 0.888889 (-1.5 + x) (-0.75 + x), >True, 0]; Xa=0.0; Xb=3.0; > Plot[Evaluate[f[x]], {x,Xa,Xb}] > >(*------ > I am using: >In[39]:= $Version >Out[39]= Solaris 3.0 (November 22, 1996) > >In[2]:= $Version >Out[2]= SPARC 2.2 (February 5, 1994) > > Using the option PlotPoints does not improve too much the plot. Try > for instance: > Plot[Evaluate[f[x]], {x,Xa,Xb}, PlotPoints -> 100] > > Regards, > Sergio > E-mail: sergio at scisun.sci.ccny.cuny.edu ------*) > >-----------== Posted via Deja News, The Discussion Network ==---------- >http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own > > Sergio: The full line is constructed but Mathematica decides only to show the later part (this is a feature) Plot[f[x], {x,Xa,Xb}] To make it show all you can use one of the following Show[%,PlotRange->All] Plot[f[x], {x,Xa,Xb}, PlotRange->All] Allan ---------------------- Allan Hayes Mathematica Training and Consulting www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565