Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 223372

Submitted on 26 Mar 2013 by Jean-Marie SAINTHILLIER

Correct

97Size
Leading solution size is 34.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
assert(abs(prob_puzz(1/3)-0.544569326033014)<100*eps)
[Warning: Function /users/msssystem1/eps.m has the same name as a MATLAB builtin. We suggest you
rename the function to avoid a potential name conflict.]
[> In prob_puzz at 6
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14]
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(bitmax)-0.5)<100*eps)