Re: Plotting piecewise in 2D

*To*: mathgroup at smc.vnet.net*Subject*: [mg109757] Re: Plotting piecewise in 2D*From*: Bill Rowe <readnews at sbcglobal.net>*Date*: Sat, 15 May 2010 06:14:32 -0400 (EDT)

On 5/14/10 at 5:32 AM, lambaugh at gmail.com (Jim Lambaugh) wrote: >Please take a look at >DensityPlot[If[x == 0 && y == 0, 1000, 0], {x, -1, 1}, {y, -1, 1}] >This just gives me a uniform plot. Why does the peak at (0,0) not >show up? There are a variety of issues. First, the plot routines in Mathematica (or any software for that matter) obviously cannot sample your function at all possible points since it is defined for all real values of x, y. And unless your function is sampled at {0,0} the output is a constant resulting in a uniform plot. Next, even if your function were sampled at {0,0} you likely would still see an uniform plot. By default, Mathematica scales plots to show what it considers the interesting portion of the plot. This results in a scaling that will not show one extreme point. As a simple example, try the following: data = Join[RandomReal[1, {100}], {1000}, RandomReal[1, {100}]]; ListPlot[data] ListPlot[data,PlotRange->All] The first plot will not show the single extreme data point at 1000. The second plot will show the extreme but loses all detail shown by the first plot in the bulk of the data. =46inally, even if the sampling included the value at {0,0} and the plot were scaled correctly to display the function value, it still might not be apparent in the plot. Depending on other factors such as plot size, plot resolution etc., it might be possible the value at {0,0} is represented by a single pixel on your display. Since it would be surrounded by many pixels with different values, the single pixel might well be effectively invisible.