I"m writing a series of probability problems and would like to use the n choose k function C(n,k) but I get an error. the problem works if I use the factorial n!, k! etc.
can I use Cn,k) in this case?
DOCUMENT();
loadMacros(
"PGstandard.pl", # Standard macros for PG language
"MathObjects.pl",
#"source.pl", # allows code to be displayed on certain sites.
"PGcourse.pl", # Customization file for the course
"parserPopUp.pl",
"AnswerFormatHelp.pl",
"PGauxiliaryFunctions.pl",
);
# sampling rate problem with aliasing
TEXT(beginproblem());
# Show which answers are correct and which ones are incorrect
$showPartialCorrectAnswers = 1;
##############################################################
#
# Setup
#
#
Context("Numeric");
Context()->variables->are(m=>'Real',n=>'Real',k=>'Real');
#$test = Formula("1-C(k,n)/C(k,m+n)");
#$test = Formula("(fact(n)/(fact(n-k)*fact(k))");
$test = Formula("1-(n!/((n-k)!*k!))/((m+n)!/((m+n-k)!*k!))")->reduce;
$test->{test_points} = [[4,3,1],[5,4,3],[6,4,3]]; # remember set all 3 variables
##############################################################
#
# Text
#
#
Context()->texStrings;
BEGIN_TEXT
This problem is related to ECE514, HW1 Problem 4.
$PAR
There are \(m\) white balls and \(n\) black balls in a box. We draw \(k\) balls from the box. What is the probability of drawing at least one white ball?
$BR
P(at least one white ball) = \{ans_rule(40)\} \{ AnswerFormatHelp("formulas") \}
END_TEXT
Context()->normalStrings;
##############################################################
#
# Answers
#
#
ANS($test->cmp());
loadMacros(
"PGstandard.pl", # Standard macros for PG language
"MathObjects.pl",
#"source.pl", # allows code to be displayed on certain sites.
"PGcourse.pl", # Customization file for the course
"parserPopUp.pl",
"AnswerFormatHelp.pl",
"PGauxiliaryFunctions.pl",
);
# sampling rate problem with aliasing
TEXT(beginproblem());
# Show which answers are correct and which ones are incorrect
$showPartialCorrectAnswers = 1;
##############################################################
#
# Setup
#
#
Context("Numeric");
Context()->variables->are(m=>'Real',n=>'Real',k=>'Real');
#$test = Formula("1-C(k,n)/C(k,m+n)");
#$test = Formula("(fact(n)/(fact(n-k)*fact(k))");
$test = Formula("1-(n!/((n-k)!*k!))/((m+n)!/((m+n-k)!*k!))")->reduce;
$test->{test_points} = [[4,3,1],[5,4,3],[6,4,3]]; # remember set all 3 variables
##############################################################
#
# Text
#
#
Context()->texStrings;
BEGIN_TEXT
This problem is related to ECE514, HW1 Problem 4.
$PAR
There are \(m\) white balls and \(n\) black balls in a box. We draw \(k\) balls from the box. What is the probability of drawing at least one white ball?
$BR
P(at least one white ball) = \{ans_rule(40)\} \{ AnswerFormatHelp("formulas") \}
END_TEXT
Context()->normalStrings;
##############################################################
#
# Answers
#
#
ANS($test->cmp());