Question: How can I define (and sample) a mixture of two random variables ?


I can't find a unique way to define a mixture of two random variables that enables at the same time to compute its PDF and generate a sample.
In the attached file you will find two methods :

  1. the first one is the most formal and only CAS are supposed to be able to allow its implementation:
     it enables computing the PDF and the CDF (trivial) but fails to generate a sample.
    (PS : in a first attempt I had defined only the PDF, which should have been enough for method=envelope does work... ... at my opinion)
  2. the second method is the one one would use in non CAS languages (for instance Matlab, R, ...). It enables generating a sample (of course) but fails to compute the PDF (which is not very surprising).

So my question: does anyone here would have some suggestions to make one these two methods capable to compute both the PDF (eventually the CDF) and generate samples ?

PS: still have this kind of problems (tomleslie suggested months ago that using interface(rtablesize=10) could help but it's not the case here)
Maple Worksheet - Error
Failed to load the worksheet /maplenet/convert/ .




Please Wait...