Cody

Problem 226. What are the odds?

Solution 2807455

Submitted on 7 Aug 2020
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   Fail
assert(abs(prob_puzz(1/3)-0.544569326033014)<100*eps)

Error in solution: Line: 4 Column: 35 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

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

Error in solution: Line: 4 Column: 35 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

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

Error in solution: Line: 4 Column: 35 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

4   Fail
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)

Error in solution: Line: 4 Column: 35 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

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

Error in solution: Line: 4 Column: 35 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

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

Error in solution: Line: 4 Column: 35 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.