Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #16767

Re: Bug with ProbabilityDistribution

From CHARLES GILLINGHAM <cgillingham1@me.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Bug with ProbabilityDistribution
Date 2014-04-10 07:08 +0000
Message-ID <li5g1g$3kl$1@smc.vnet.net> (permalink)
References <20140409081446.CA0646A01@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


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

On Apr 9, 2014, at 6:18 AM, Bob Hanlon <hanlonr357@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@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.
> 
> 
> 
> 
> 

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar


Thread

Re: Bug with ProbabilityDistribution CHARLES GILLINGHAM <cgillingham1@me.com> - 2014-04-10 07:08 +0000

csiph-web