Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2013

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

Search the Archive

Re: dark halo around gaussian peak in Plot3D?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg130100] Re: dark halo around gaussian peak in Plot3D?
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Sat, 9 Mar 2013 05:26:23 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <20130308035122.485BC6797@smc.vnet.net>

You don't really care about the tails, so use a Boole factor to suppress them.

With[{r = 40},
  Table[
   Plot3D[
    Evaluate[
     PDF[BinormalDistribution[{m, 0}, {1, 1}, 0], {x, y}]*
      Boole[(x - m)^2 + y^2 < 25]],
    {x, -r, r}, {y, -r, r},
    PlotRange -> {{-r, r}, {-r, r}, {0, 0.15}},
    PlotPoints -> 100,
    PlotLabel -> StringForm["m = ``", m],
    ImageSize -> 300], {m, -40, 40, 10}]] // Column


Bob Hanlon


On Fri, Mar 8, 2013 at 5:38 PM, Michael B. Heaney <mheaney at alum.mit.edu> wrote:
> Hi Bob,
>
> Thanks for your reply. I need results that far out on the tail because I am
> making a series of figures where a travelling gaussian moves from one side
> of the graph to the other side of the graph, and I want each figure to show
> the entire graph. Are there any workarounds?
>
> Thanks,
>
> Michael
>
>
> On Fri, Mar 8, 2013 at 2:19 PM, Bob Hanlon <hanlonr357 at gmail.com> wrote:
>>
>> Table[
>>    Plot3D[
>>     Evaluate[
>>      PDF[BinormalDistribution[0], {x, y}]],
>>     {x, -n, n}, {y, -n, n},
>>     PlotRange -> All,
>>     PlotPoints -> 50,
>>     PlotLabel -> StringForm["n = ``", n],
>>     ImageSize -> 300],
>>    {n, {5, 10, 15, 20, 37, 40}}] //
>>   Partition[#, 2] & // Grid
>>
>> The problem starts at about 20 standard deviations and stops at about
>> 37 standard deviations out on the tail. These are really small values.
>> Presumably, this is a precision issue that stops when the algorithms
>> just give up and call the results zero.
>>
>> Table[
>>  PDF[BinormalDistribution[0], {n, n}] // N,
>>  {n, {20, 37, 40}}]
>>
>> {3.0480870817634576*^-175, \
>> 4.494427778507250610367056211787865772187`15.954589770191005*^-596,
>>    2.1411598269883908369272155013252852`15.954589770191005*^-696}
>>
>> However, even extreme WorkingPrecision does not appear to resolve the
>> issue
>>
>> With[{n = 40},
>>  Plot3D[
>>   Evaluate[PDF[BinormalDistribution[0], {x, y}]],
>>   {x, -n, n}, {y, -n, n},
>>   PlotRange -> All,
>>   PlotPoints -> 50,
>>   PlotLabel -> StringForm["n = ``", n],
>>   ImageSize -> 300,
>>   WorkingPrecision -> 2000,
>>   PerformanceGoal -> "Quality"]]
>>
>> Perhaps then the question is: why do you need results that far out on the
>> tail?
>>
>> Or you could work with the Log of the function
>>
>> With[{n = 40},
>>  Plot3D[
>>   Evaluate[
>>    Log[PDF[BinormalDistribution[0], {x, y}]] //
>>     PowerExpand],
>>   {x, -n, n}, {y, -n, n},
>>   PlotRange -> All,
>>   PlotPoints -> 50,
>>   PlotLabel -> StringForm["n = ``", n],
>>   ImageSize -> 600]]
>>
>>
>> Bob Hanlon
>>
>>
>> On Fri, Mar 8, 2013 at 11:06 AM, Michael B. Heaney <mheaney at alum.mit.edu>
>> wrote:
>> > Here is simple example that demonstrates the problem:
>> >
>> > Plot3D[PDF[BinormalDistribution[0], {x, y}], {x, -40, 40}, {y, -40, 40},
>> >
>> >  PlotRange -> All, PlotPoints -> 200]
>> >
>> > Thanks,
>> >
>> > Michael
>> >
>> >
>> > On Thu, Mar 7, 2013 at 8:49 PM, Bob Hanlon <hanlonr357 at gmail.com> wrote:
>> >>
>> >> I don't see a "dark halo" with the following
>> >>
>> >> Plot3D[
>> >>  PDF[BinormalDistribution[0], {x, y}],
>> >>  {x, -3, 3}, {y, -3, 3}]
>> >>
>> >> Can you send a simple example that demonstrates the problem?
>> >>
>> >>
>> >> Bob Hanlon
>> >>
>> >>
>> >> On Thu, Mar 7, 2013 at 10:51 PM, Michael B. Heaney
>> >> <mheaney at alum.mit.edu>
>> >> wrote:
>> >> >
>> >> > Hi,
>> >> >
>> >> > When I plot a gaussian peak in Plot3D, there is a dark halo around
>> >> > the
>> >> > peak. Why is this? How can I get rid of it?
>> >> >
>> >> > Thanks,
>> >> >
>> >> > Michael
>> >> >
>> >> > --
>> >> > ----------------------------------------------------------
>> >> > Michael B. Heaney
>> >> > 3182 Stelling Drive
>> >> > Palo Alto, CA 94303 USA
>> >> > mheaney at alum.mit.edu
>> >> > www.linkedin.com/in/michaelbheaney
>> >> > ----------------------------------------------------------
>> >> >
>> >> >
>> >
>> >
>> >
>> >
>> > --
>> > ----------------------------------------------------------
>> > Michael B. Heaney
>> > 3182 Stelling Drive
>> > Palo Alto, CA 94303 USA
>> > mheaney at alum.mit.edu
>> > www.linkedin.com/in/michaelbheaney
>> > ----------------------------------------------------------
>> >
>
>
>
>
> --
> ----------------------------------------------------------
> Michael B. Heaney
> 3182 Stelling Drive
> Palo Alto, CA 94303 USA
> mheaney at alum.mit.edu
> www.linkedin.com/in/michaelbheaney
> ----------------------------------------------------------
>



  • Prev by Date: Re: Numbers on rectangles
  • Next by Date: Re: Fixed Typo in Code---> Re: updating a simulation within Manipulate.
  • Previous by thread: Re: dark halo around gaussian peak in Plot3D?
  • Next by thread: Re: dark halo around gaussian peak in Plot3D?