This project has moved. For the latest updates, please go here.

Turning off exceptions

Dec 19, 2013 at 4:28 PM
Hi all,

I'm using the 3.0.038 version ( some Alpha of the new version ). I have two quick questions. I'm getting many System.ArgumentException with the message "Value is too large for the current iteration limit.".

I'm using the Beta Distribution.

So
  1. Is there a way of knowing when a value is too large beforehand?
  2. Is there a way to turn off exceptions?
Here is a test case:
Alpha: 3846.2382301675848
Beta: 738420369.64263761
x: 0.0000052331266889206809

I'm using the CDF function:
MathNet.Numerics.Distributions.Beta.CDF(e.Alpha, e.Beta, x);

Thanks,
Christian
Coordinator
Dec 19, 2013 at 9:54 PM
Edited Dec 19, 2013 at 10:04 PM
Hi Christian,

It turns out that only very few more iterations are required with these specific numbers - changing maxIterations from 100 to 110 fixes the problem.

I suggest I permanently increase the iteration limit a bit, or alternatively add an optional argument that defaults to that new limit.

Thanks,
Christoph

PS: your actual questions:

1) there might be, but would need to be derived (continued fraction)
2) not as of now
Marked as answer by cdrnet on 12/30/2013 at 6:45 AM
Dec 20, 2013 at 1:34 PM
cdrnet wrote:
Hi Christian,

It turns out that only very few more iterations are required with these specific numbers - changing maxIterations from 100 to 110 fixes the problem.

I suggest I permanently increase the iteration limit a bit, or alternatively add an optional argument that defaults to that new limit.
This sounds like the right way. But where can I find maxIterations? Ideally I would like to use the static CDF member. I'm using 3.0.038.

Thanks a lot for your answer!

Christian
Coordinator
Dec 21, 2013 at 9:33 AM
Unfortunately you can't influence it from user code, but I've increased it to 120 in master and plan a new alpha release in a few days.

Thanks,
Christoph
Dec 23, 2013 at 3:19 PM
I created a new thread.
Feb 20, 2014 at 10:14 AM
Edited Feb 20, 2014 at 11:17 AM
cdrnet wrote:
Unfortunately you can't influence it from user code, but I've increased it to 120 in master and plan a new alpha release in a few days.
I built the library locally with MaxIterations = 120; I still got the same problem for BetaRegularized with a = 0.038459322032068435; b = 2616.5472749092005; x = 0.00040236338211950594. (This was not a fringe test case, but an actual data set used in a simulation.) The result it would have returned after 120 iterations was close enough to the one we would have gotten after 201 iterations, which was the necessary iteration count for this data triple. So I don't think setting MaxIterations to 120 solves the problem for good. I suggest that instead:
  • either a result is always returned
  • or the MaxIterations is an input parameter
  • or there is an option to either throw an exception, or return a result in any case.
  • or there is an option to return the result once the difference between previous and current iteration falls below a specific threshold (an input parameter)
--- Werner
Coordinator
Mar 10, 2014 at 7:47 AM
I've just updated master such that it always returns a result, either once it reached the required accuracy (as before) or the intermediate result after 140 iterations.
Marked as answer by cdrnet on 3/10/2014 at 12:47 AM