Question: Sample a self-defined distribution

It seems Maple's Sample command cannot handle self-defined distribution well. Check this:

U := Distribution(PDF = (t->piecewise(t < 0, 0, t <3, 1/3, 0))); #just a uniform distribution

It runs for all the time and I gave up for 10 seconds. Instead, if I defined Z as Uniform(0,3), it can run immediately.
Of course. This is just a demonstration. I am working on the other very simple self-defined distribution. Now my workaround is to discretized it and use ProbabilityTable to create a discrete approximate. Anyway, Maple seems doing very "considerate contemplating" before really simulate on the self-defined distribution.

Please Wait...