Cody

Problem 43126. Probabilities - Balls and urns - 01

Solution 1680148

Submitted on 25 Nov 2018
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
R=4; B=8; N=50; K=25; p = 0.0059; assert( abs(probability(R,B,N,K)-p)<1e-04 );

Undefined function 'kroneckerDelta' for input arguments of type 'double'. Error in probability (line 2) p = kroneckerDelta(K,R); Error in Test1 (line 4) assert( abs(probability(R,B,N,K)-p)<1e-04 );

2   Fail
R=22; B=6; N=32; K=23; p = 0.1042; assert( abs(probability(R,B,N,K)-p)<1e-04 );

Undefined function 'kroneckerDelta' for input arguments of type 'double'. Error in probability (line 2) p = kroneckerDelta(K,R); Error in Test2 (line 4) assert( abs(probability(R,B,N,K)-p)<1e-04 );

3   Fail
R=2; B=4; N=25; K=2; p = 0.0030; assert( abs(probability(R,B,N,K)-p)<1e-04 );

Undefined function 'kroneckerDelta' for input arguments of type 'double'. Error in probability (line 2) p = kroneckerDelta(K,R); Error in Test3 (line 4) assert( abs(probability(R,B,N,K)-p)<1e-04 );

4   Fail
R=0; B=4; N=25; K=2; assert( isequal(probability(R,B,N,K),0) );

Undefined function 'kroneckerDelta' for input arguments of type 'double'. Error in probability (line 2) p = kroneckerDelta(K,R); Error in Test4 (line 3) assert( isequal(probability(R,B,N,K),0) );

5   Fail
R=9; B=0; N=25; K=2; assert( isequal(probability(R,B,N,K),0) );

Undefined function 'kroneckerDelta' for input arguments of type 'double'. Error in probability (line 2) p = kroneckerDelta(K,R); Error in Test5 (line 3) assert( isequal(probability(R,B,N,K),0) );

6   Fail
R=9; B=0; N=25; K=25; assert( isequal(probability(R,B,N,K),1) );

Undefined function 'kroneckerDelta' for input arguments of type 'double'. Error in probability (line 2) p = kroneckerDelta(K,R); Error in Test6 (line 3) assert( isequal(probability(R,B,N,K),1) );