Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2014

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

Search the Archive

Re: Bug with ProbabilityDistribution

  • To: mathgroup at smc.vnet.net
  • Subject: [mg132544] Re: Bug with ProbabilityDistribution
  • From: CHARLES GILLINGHAM <cgillingham1 at me.com>
  • Date: Thu, 10 Apr 2014 03:08:17 -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: <20140409081446.CA0646A01@smc.vnet.net>

Thanks for the work around. Still seems to me this is a bug.

On Apr 9, 2014, at 6:18 AM, Bob Hanlon <hanlonr357 at gmail.com> wrote:

> Works as expected  if you simplify the Piecewise (PiecewiseExpand) or let the Piecewise default handle the cases where the value is zero. Note that PDF[d][{x1,x2}] can be entered simply as PDF[d,{x1,x2}]
> 
> d = ProbabilityDistribution[
>    Piecewise[{
>       {0, x1 == 1 && x2 == 1},
>       {1/2, x1 == 1 && x2 == 0},
>       {0, x1 == 0 && x2 == 1},
>       {1/2, x1 == 0 && x2 == 0}}] //
>     PiecewiseExpand,
>    {x1, 0, 1, 1}, {x2, 0, 1, 1}];
> 
> t1 = Table[
>    {x1, x2, PDF[d, {x1, x2}], PDF[d][{x1, x2}]},
>    {x1, 0, 1}, {x2, 0, 1}] //
>   Flatten[#, 1] &
> 
> {{0, 0, 1/2, 1/2}, {0, 1, 0, 0}, {1, 0, 1/2, 1/2}, 
>    {1, 1, 0, 0}}
> 
> d = ProbabilityDistribution[
>    Piecewise[{
>      {1/2, x1 == 1 && x2 == 0},
>      {1/2, x1 == 0 && x2 == 0}}],
>    {x1, 0, 1, 1}, {x2, 0, 1, 1}];
> 
> t2 = Table[
>    {x1, x2, PDF[d, {x1, x2}], PDF[d][{x1, x2}]},
>    {x1, 0, 1}, {x2, 0, 1}] //
>   Flatten[#, 1] &
> 
> {{0, 0, 1/2, 1/2}, {0, 1, 0, 0}, {1, 0, 1/2, 1/2}, 
>    {1, 1, 0, 0}}
> 
> t1 == t2
> 
> True
> 
> 
> Bob Hanlon
> 
> 
> 
> On Wed, Apr 9, 2014 at 4:14 AM, CHARLES GILLINGHAM <cgillingham1 at me.com> 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}
>          ]
>         PDF[%][{1, 1}]
> 
> And you get:
> 
>         Undefined
> 
> But the probability is obviously 0
> 
> Is there something I am misunderstanding about how simple Boolean probability distributions should be set up?
> 
> Thanks.
> 
> 
> 
> 
> 



  • Prev by Date: Help!
  • Next by Date: Re: Very simple question
  • Previous by thread: Re: Bug with ProbabilityDistribution
  • Next by thread: Re: Bug with ProbabilityDistribution