MathGroup Archive 2014

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

Search the Archive

Re: Bug with ProbabilityDistribution

  • To: mathgroup at smc.vnet.net
  • Subject: [mg132550] Re: Bug with ProbabilityDistribution
  • From: CHARLES GILLINGHAM <cgillingham1 at me.com>
  • Date: Fri, 11 Apr 2014 02:08:29 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net
  • References: <20140410070657.9900D69EE@smc.vnet.net>

On Apr 10, 2014, at 12:06 AM, Bill Rowe <readnews at sbcglobal.net> wrote:

> On 4/9/14 at 4:14 AM, cgillingham1 at me.com (CHARLES GILLINGHAM) wrote:
>
>> Evaluate this:
>
>> ProbabilityDistribution[
>> Piecewise[{{0, x1 == 1 && x2 == 1}, {1/2, x1 == 1 && x2 == 0}, {0,
>> x1 == 0 && x2 == 1}, {1/2, x1 == 0 && x2 == 0}}], {x1, 0, 1,
>> 1}, {x2, 0, 1, 1}
>> ]
>
> Start with a fresh session and pay attention to the syntax
> coloring. Note that x1 and x2 are undefined and your syntax does
> not make these local variables. That is entering
>
> f[x_]:=2 x
>
> will cause x to be colored differently than your x1, x2 above.
>
> You get undefined as a result since x1 and x2 are never defined.

This is an interesting issue (that may point to other problems), but it doesn't explain the particular bug I am looking at. The variables are also undefined in Bob Hanlon's workaround. Try this, which is exactly equivalent, and works fine:

ProbabilityDistribution[
 Piecewise[{{0, (x1 != 0 && x1 != 1) || x2 != 0}}, 1/2] , {x1, 0, 1, 1}, {x2,
  0, 1, 1}]
PDF[%][{1,1}]







  • Prev by Date: Controlling breaking of lines in output of Write
  • Next by Date: Variables in ProbabilityDistribution have strange "scoping" mechanism
  • Previous by thread: Re: Bug with ProbabilityDistribution
  • Next by thread: Variables in ProbabilityDistribution have strange "scoping" mechanism