PDF[BinomialDistribution[1,.5],{0,0.5,1}]
gives {0.5,0.63662,0.5}
and
PDF[BernoulliDistribution[.5],{0,0.5,1}]
gives {0.5,0,0.5}.
Obviously, BinomialDistribution[1,.5] and BernoulliDistribution[.5] are the same.
PDF[BinomialDistribution[1,.5],{0,0.5,1}]
gives {0.5,0.63662,0.5}
and
PDF[BernoulliDistribution[.5],{0,0.5,1}]
gives {0.5,0,0.5}.
Obviously, BinomialDistribution[1,.5] and BernoulliDistribution[.5] are the same.
The issue appears to be that
PDF[BinomialDistribution[n,p],{x}]
doesn’t catch illegitimate values for x between 0 and n. And maybe “illegitimate” is a bit strong: it doesn’t appropriately give a zero probability to values between 0 and n. It does give a zero probability for values larger than n and values less than 0. (Mathematica 12.2, Windows 10)
You should report this to Wolfram, Inc.
If you feed a list to PDF as the 2nd argument it ussumes that you want to calculate the multivariate PDF (ceck the documentation). I guess this is not what you intended. To compute the PDF for several x values you can use for instance Map
Map[PDF[BinomialDistribution[1, 0.5], #] &, {0, 0.5, 1}]
Map[PDF[BernoulliDistribution[0.5], #] &, {0.0, .5, 1}]
By doing so we get {0.5, 0, 0.5} as a result for each of these as expected
Good reminder to RTFM (for all parts of the code). But what multivariate distribution would result in
{0.5,0.63662,0.5}
from
PDF[BinomialDistribution[1,.5],{0,0.5,1}]
i havent studied distributions yet but this look very mathematical:
In[174]:= PDF[BinomialDistribution[1, 5/10], {0, 5/10, 1}]
Out[174]= {1/2, 2/\[Pi], 1/2}
Strange or not?
In[1]:= p[t_] := PDF[BinomialDistribution[1, 0.5], t]; {p[0.5]} == p[{0.5}]
Out[1]= false
strange input ( n=1 srsly ) \Rightarrow strange output
r u testing robustness of mma function
n=1 is not the point:
In[2]:= p[t_] := PDF[BinomialDistribution[2, 0.5], t]; {p[0.5]} == p[{0.5}]
out[2] = False
Maybe this helps. Just made it for myself. We need to study the documentation more thanks.
Distributions_in_11.3.nb (454 KB)
Yes, somewhat strange, indeed! If you define you probability p as a pure function, then it works:
p = PDF[BinomialDistribution[2, 0.5]];
{p[0.5]} == p[{0.5}]
(* Out: True *)