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 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
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 <lamb...@gmail.com> wrote:
=============
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
>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.