SeriesTest1
Requiring Students to Justify Series Tests
This PG code shows how to require students to justify series tests.
- File location in OPL: FortLewis/Authoring/Templates/Sequences/SeriesTest1.pg
- PGML location in OPL: FortLewis/Authoring/Templates/Sequences/SeriesTest1_PGML.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "unionTables.pl", "parserPopUp.pl", "PGgraders.pl", "parserMultiAnswer.pl", ); TEXT(beginproblem()); |
Initialization:
We load |
Context("Numeric")->variables->are(n=>"Real"); $a = random(2,9,1); $b = random(2,9,1); $c = random(5,20,1); $d = random(3,9,1); $e = random(2,9,1); $dm1 = $d - 1; $dm2 = $d - 2; # TeX $series = "\sum_{n=$c}^{\infty} \frac{$a n + $b}{$c n^{$d} + $e}"; $fraction = "\lim_{n\to\infty} \frac{a_n}{b_n} = \lim_{n\to\infty}"; $num1 = Formula("$a n^$d + $b n^$dm1"); $den1 = Formula("$c n^$d + $e"); $num2 = Formula("$a + $b/n"); $den2 = Formula("$c + $e/(n^$d)"); $multians = MultiAnswer($num1, $den1)->with( singleResult => 0, checker => sub { my ( $correct, $student, $ansHash ) = @_; my ( $stu1, $stu2 ) = @{$student}; if (($num1 == $stu1 && $den1 == $stu2) || ($num2 == $stu1 && $den2 == $stu2) ) { return [1,1]; } elsif (($num1 == $stu1 && $den2 == $stu2) || ($num2 == $stu1 && $den1 == $stu2)) { $ansHash->setMessage(1,"Check your algebra"); $ansHash->setMessage(2,"Check your algebra"); return [0,0]; } elsif ($num1 == $stu1 || $num2 == $stu1) { return [1,0]; } elsif ($den1 == $stu2 || $den2 == $stu2) { return [0,1]; } else { return [0,0]; } } ); $limit = Formula("$a/$c"); $popup = PopUp(["Choose","Converges","Diverges","Inconclusive"],"Converges"); # # Display the fraction and answer blanks nicely # Context()->texStrings; if ($displayMode eq 'TeX') { $showfraction = "\[ $fraction ".$multians->ans_rule(10).$multians->ans_rule(10)." \]"; } else { $showfraction = ColumnTable( "\( \displaystyle $fraction \)", $multians->ans_rule(20).$BR.$HR.$multians->ans_rule(20), indent => 0, separation => 10, valign => "MIDDLE" ); } Context()->normalStrings; |
Setup:
We use the MultiAnswer object
We display the answerblanks nicely as a fraction in HTML and TeX modes by how we constructed |
Context()->texStrings; BEGIN_TEXT Use the limit comparison test to determine whether \( \displaystyle \sum_{n=$c}^{\infty} a_n = $series \) converges or diverges. $BR $BR (a) Choose a series \( \displaystyle \sum_{n=$c}^\infty b_n \) with terms of the form \( \displaystyle b_n = \frac{1}{n^p} \) and apply the limit comparison test. Write your answer as a fully reduced fraction. For \( n \geq $c \), $showfraction $BR (b) Evaluate the limit in the previous part. Enter \( \infty \) as ${BITALIC}infinity${EITALIC} and \( -\infty \) as ${BITALIC}-infinity.${EITALIC} If the limit does not exist, enter ${BITALIC}DNE.${EITALIC} $BR$SPACE \( \displaystyle \lim_{n\to\infty} \frac{a_{n}}{b_{n}} \, \) = \{ ans_rule(20) \} $BR $BR (c) By the limit comparison test, does the series converge, diverge, or is the test inconclusive? \{ $popup->menu() \} END_TEXT Context()->normalStrings; |
Main Text: |
$showPartialCorrectAnswers=1; install_problem_grader(~~&custom_problem_grader_fluid); $ENV{'grader_numright'} = [2,4]; $ENV{'grader_scores'} = [0.4,1]; $ENV{'grader_message'} = "You can earn " . "40% partial credit for 2 - 3 correct answers."; ANS( $multians->cmp() ); ANS( $limit->cmp() ); ANS( $popup->cmp() ); |
Answer Evaluation: We use the problem grader fluid to give partial credit incrementally: 0% for 0-1 correct answers, 40% for 2-3 correct answers, and full credit for 4 correct answers. |
Context()->texStrings; BEGIN_SOLUTION Solution explanation goes here. END_SOLUTION Context()->normalStrings; COMMENT('MathObject version.'); ENDDOCUMENT(); |
Solution: |