Parent Directory
|
Revision Log
added problem library as webwork/ww_prob_lib with revision tag prob-lib-2
1 ##DESCRIPTION 2 ##KEYWORDS('probability','poisson random variable', 'probability dist') 3 ## 4 ##ENDDESCRIPTION 5 6 DOCUMENT(); # This should be the first executable line in the problem. 7 8 loadMacros( 9 "PG.pl", 10 "PGbasicmacros.pl", 11 "PGchoicemacros.pl", 12 "PGanswermacros.pl", 13 "PGauxiliaryFunctions.pl" 14 ); 15 16 TEXT(beginproblem()); 17 $showPartialCorrectAnswers = 1; 18 19 for ($i=0; $i<4; $i++) { 20 $x[$i] = random(1,9,1); 21 $m[$i] = random(.5,6,.5); 22 } 23 $ans0 = ($m[0]**$x[0])*$E**(-$m[0])/fact($x[0]); 24 25 for ($i=0; $i<4; $i++) { 26 for ($j=0; $j<($x[$i]+1); $j++) { 27 $prob[$i][$j] = ($m[$i]**$j)/$E**($m[$i])/fact($j); 28 29 } 30 } 31 32 $sum1 = 0; 33 for ($j=0; $j<($x[1]+1); $j+=1){ 34 $sum1 = $sum1+$prob[1][$j]; 35 } 36 37 $sum2 = 0; 38 for ($j=0; $j<($x[2]+1); $j+=1){ 39 $sum2 = $sum2+$prob[2][$j]; 40 $ans2 = 1-$sum2; 41 } 42 $sum3 = 0; 43 for ($j=0; $j<$x[3]; $j+=1){ 44 $sum3 = $sum3+$prob[3][$j]; 45 } 46 47 BEGIN_TEXT 48 Given that \(x\) is a random variable having a Poisson distribution, compute the following: $PAR 49 (a) \( \) \( P(x = $x[0])\) when \(\mu = $m[0] \) $BR 50 \(P(x) = \) \{ans_rule(10)\} $PAR 51 (b) \( \) \( P(x \leq $x[1]) \)when \(\mu = $m[1] \) $BR 52 \(P(x) = \) \{ans_rule(10)\} $PAR 53 (c) \( \) \( P(x > $x[2])\) when \(\mu = $m[2] \) $BR 54 \(P(x) = \) \{ans_rule(10)\} $PAR 55 (d) \( \) \( P(x < $x[3])\) when \(\mu = $m[3] \) $BR 56 \(P(x) = \) \{ans_rule(10)\} 57 END_TEXT 58 ANS(num_cmp($ans0)); 59 ANS(num_cmp($sum1)); 60 ANS(num_cmp($ans2, tol=>0.000001)); 61 ANS(num_cmp($sum3)); 62 63 ENDDOCUMENT(); # This should be the last executable line in the problem.
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |