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


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

Re: Bug with ProbabilityDistribution

From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Bug with ProbabilityDistribution
Date 2014-04-10 07:07 +0000
Message-ID <li5g08$3k3$1@smc.vnet.net> (permalink)
References <20140409081446.CA0646A01@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


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 Bob Hanlon <hanlonr357@gmail.com> - 2014-04-10 07:07 +0000

csiph-web