From: Robert D. <rob...@gm...> - 2025-07-20 19:07:28
|
On Sun, Jul 20, 2025 at 10:57 AM Raymond Toy <toy...@gm...> wrote: > (%i1) load(distrib)$ > (%i2) pdf_bernoulli(1,p); > (%o2) if equal(p, 0) then 0 elseif equal(p, 1) then 1 else p The definition of pdf_bernoulli goes through some gyrations to avoid 0^0, filtering out special cases -- pdf_bernoulli(x,p) := if maybe(p >= 0 and p <= 1) = false then error("pdf_bernoulli: p must be a probability") else if x < 0 or x > 1 or x-floor(x) > 0 then 0 elseif equal (p, 0) then kron_delta(x,0) elseif equal (p, 1) then kron_delta(x,1) else p^x*(1-p)^(1-x) $ and the result you mentioned is just what we get from plugging x = 1 into that. I don't see a simple way to collapse the conditional result, or to avoid it to begin with, so I'm inclined to leave it as it stands, and update the manual accordingly. But if someone can suggest a way to rephrase it which has the same behavior in special cases, that would be terrific. best Robert |