I have two Piecewise functions that are (in this case) just the empirical CDFs of two sets of data:

$MaxPiecewiseCases = 1000;

When I find

Min[PartialCDF1, PartialCDF2]// FullForm

it just returns Min[...Piecewise1...Piecewise2...] instead of the combined function of the minimum across the range. So (based on a comment in this question) I tried

Simplify@PiecewiseExpand[Min[PartialCDF1, PartialCDF2]]

and that just never finishes. Also, it uses 24Gb of RAM while failing to perform this simple task. I've also tried every other combination of Simplify, PiecewiseExpand, and combinations with Evaluate, but nothing works to get the combined piecewise min function.

I've succeeded in doing this with other piecewise linear functions using the same code in a fraction of a second, so I really have no idea what is different in this case. How do I get Mathematica to provide the combined function in a case like this?

  • 1
    $\begingroup$ You might want to look at EmpiricalDistribution. I think this does what your are trying to implement $\endgroup$ – mikado Apr 9 '17 at 11:02
  • $\begingroup$ I think the problem must be that in the PiecewiseExpand it considers every possible piecewise case (e.g. about 10000 pieces) from the two functions it is combining with Min. $\endgroup$ – mikado Apr 9 '17 at 11:23
  • $\begingroup$ Yes, the problem is clearly with PiecewiseExpand, but making 10,000 comparisons is easy and nearly instantaneous for Mathematica on other functions, so the cause must be something to do with the function specification that is incompatible with this way of using PiecewiseExpand. $\endgroup$ – Aaron Bramson Apr 9 '17 at 12:03
  • $\begingroup$ Maybe you should explain what you are trying to achieve and explain the coefficient of overlapping (OVL). $\endgroup$ – gwr Apr 9 '17 at 13:28
  • $\begingroup$ @gwr: It is true that if these were PDFs instead of CDFs then the integral of the min function would be the overlap coefficient. I need the min function in a form so that I can extract the boundaries of the piecewise min function to perform the integral; Mathematica won't do it properly without manual exclusions (as per my linked question). $\endgroup$ – Aaron Bramson Apr 9 '17 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.