Prev: GeometricTransformation causes dislocated Arrowheads in Graphics3D
Next: innerApply[{f, g}, {{a, b}, {c, d}}] = {f[a, b],
From: Jim Lambaugh on 14 May 2010 05:32 Hi 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? Best, Jimmy.
From: Patrick Scheibe on 14 May 2010 19:57 Hi, because at the end all comes to the point that your function is sampled at different places and single dicontinuous points are a problem DensityPlot[ Piecewise[{{1000, x == 0 && y == 0}}, 0], {x, -1, 1}, {y, -1, 1}, PlotPoints -> 3, Mesh -> All, MaxRecursion -> #, ColorFunction -> "LightTemperatureMap"] & /@ Range[1, 10] Such stuff will not work reliable. Try to sample it by yourself and see what happens ArrayPlot[ Table[If[x == 0 && y == 0, 1000, 0], {y, -1, 1, 2/#}, {x, -1, 1, 2/#}]] & /@ Range[50, 55] Cheers Patrick On Fri, 2010-05-14 at 05:32 -0400, Jim Lambaugh wrote: > Hi > > 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? > > Best, > Jimmy. >
From: Bob Hanlon on 14 May 2010 19:58 Because it is hard to see a point? However, the following shows an excessively large area: DensityPlot[ If[Abs[x] < 0.001 && Abs[y] < 0.001, 1000, 0], {x, -1, 1}, {y, -1, 1}] "If" is a programming construct not a mathematical function. Piecewise works better. DensityPlot[ Piecewise[{{1000, Abs[x] < 0.001 && Abs[y] < 0.001}}], {x, -1, 1}, {y, -1, 1}] Bob Hanlon ---- Jim Lambaugh <lambaugh(a)gmail.com> wrote: ============= Hi 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? Best, Jimmy.
From: Peter Pein on 14 May 2010 19:58 Am Fri, 14 May 2010 09:32:49 +0000 (UTC) schrieb Jim Lambaugh <lambaugh(a)gmail.com>: > Hi > > 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? > > Best, > Jimmy. > Because a point is too small for the real world ;-) Try: DensityPlot[If[Norm[{x, y}] <= 1*^-9, 1000, 0], {x, -1, 1}, {y, -1, 1}] hth, Peter
From: Bill Rowe on 15 May 2010 06:14
On 5/14/10 at 5:32 AM, lambaugh(a)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. |