> > > I am in the process of learning Sage, coming from Maxima (and Mathematica, > which I do not like much...). > Cut'n'pastes from a notebook running on sagenb.org > version() > > version() > > ==> > > 'Sage Version 5.4, Release Date: 2012-11-09' > > var('t,a,b,d') > ## beta density > dbeta(t,a,b)=t^(a-1)*(1-t)^(b-1)/beta(a,b) > ## density of the *difference* of two independent beta(1,1)-distributed RVs > ## (yes, I mean uniforms(0 1)...) > integrate(dbeta(t,1,1)*dbeta(t+d,1,1),t,max(0, -d), min(1,1-d)) > > ==> > > 1 > > Huh ?? This is seriously whacky : > > > You might want to see what "max(0,-d)" does. The function "max_symbolic" should do what you want, though I don't know whether your integration will work. Hopefully it would.
> dbeta(t,a,b):=t^(a-1)*(1-t)^(b-1)/beta(a,b) > integrate(dbeta(t,1,1)*dbeta(t+d,1,1),t,max(0,-d),min(1,1-d)) > > ==> > > dbeta(t,a,b):=t^(a-1)*(1-t)^(b-1)/beta(a,b) > min(1,1-d)-max(0,-d) > > > I'm also not sure what the := notation would mean here in Sage; that's Maxima style, right? > But another one : i tried to give dbeta a proper definition, i. e. with a > domain of definition, therefore allowing convolutions : > > > db2(t,a,b)=Piecewise([[(0,1),t^(a-1)*(1-t)^(b-1)/beta(a,b)]]) > db2 > > You would get this even with db2(x) = Piecewise([[(0,1),x^2]]) because piecewise functions do not accept this construction. db2 = Piecewise([[(0,1),x^2]]) works. Unfortunately, I'm not so sure the three-variable equivalent is much better here, as this (now very old) class was designed for single-variable constructs (though it does support convolution in that context). You may want to use pw.mac inside Maxima for this, I'm not sure. Or there might be a way to trick a lambda function to make this work. I'm sorry that our piecewise support is not the greatest. It's a longstanding annoyance. - kcrisman -- You received this message because you are subscribed to the Google Groups "sage-support" group. To post to this group, send email to sage-support@googlegroups.com. To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support?hl=en.