MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Plotting piecewise in 2D


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 at 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.




  • Prev by Date: Re: Genetic Algorithm
  • Next by Date: Re: Plotting piecewise in 2D
  • Previous by thread: Re: Plotting piecewise in 2D
  • Next by thread: Re: Plotting piecewise in 2D