On Monday 01 September 2008 19:23:40 Robert Dodier wrote:
> ...
> Since the existing code works OK, it's not a pressing issue, but I think
> statistical computation is an important application for Maxima, so I'd like
> to revise the distrib code at some point.
I'm sorry, my first message contains an error.
if member(sign(x-a), ['nz,'neg,'zero]) or ...
is OK, but I think that
else if sign(x-a) = 'pos and sign(x-b) = 'pos
should be replaced by
else if sign(x-a) = 'pos and sign(b-x) = 'pos
For example, the current version of distrib.mac gives
pdf_continuous_uniform(0, - 1, 1) => pdf_continuous_uniform(0, - 1, 1)
while 1/2 is expected.
(%i1) load(distrib)$
(%i2) pdf_continuous_uniform(0, - 1, 1);
(%o2) pdf_continuous_uniform(0, - 1, 1)
(%i3) /* redefine with sign(x-b) => sign(b-x) */
pdf_continuous_uniform(x,a,b):=block([cp:control1(b-a)],
if cp=-1 then error("Illegal parameter"),
if cp=0 or sign(x-a)='pnz or sign(x-b)='pnz
then return(funmake('pdf_continuous_uniform,[x,a,b])),
if member(sign(x-a), ['nz,'neg,'zero]) or member(sign(x-b),
['pos,'pz,'zero]) then 0
else if sign(x-a) = 'pos and sign(b-x) = 'pos then 1/(b-a)
else funmake('pdf_continuous_uniform,[x,a,b]) )$
(%i4) pdf_continuous_uniform(0, - 1, 1);
(%o4) 1/2
--
Setting Orange, Bureaucracy 26, 3174 YOLD
Alexey Beshenov http://beshenov.ru/