Cody

Problem 226. What are the odds?

Solution 2758201

Submitted on 30 Jul 2020 by Rafael S.T. Vieira
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
assert(abs(prob_puzz(1/3)-0.544569326033014)<100*eps)

2   Pass
assert(abs(prob_puzz(1)-0.596573590279973)<100*eps)

3   Pass
assert(abs(prob_puzz(2)-0.637326536083514)<100*eps)

4   Pass
HINT = fzero(@(x)((x.^2-1)*log(x+1)+(x.^2-1)*log(x-1)-x.^2)./(x.^3-x.^5),2); assert(abs(prob_puzz(HINT)-0.639232271380537)<100*eps)

5   Pass
assert(abs(prob_puzz(10)-0.522975599250673)<100*eps)

6   Pass
assert(abs(prob_puzz(flintmax)-0.5)<100*eps)

[Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 5.7e+14. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.] [> In integralCalc/iterateScalarValued (line 372) In integralCalc/vadapt (line 132) In integralCalc (line 75) In integral (line 88) In prob_puzz (line 17) In ScoringEngineTestPoint6 (line 1) In solutionTest (line 13)] [Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 5.3e+14. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.] [> In integralCalc/iterateScalarValued (line 372) In integralCalc/vadapt (line 132) In integralCalc (line 75) In integral (line 88) In prob_puzz (line 21) In ScoringEngineTestPoint6 (line 1) In solutionTest (line 13)]