Difference between revisions of "SeriesTest1"

From WeBWorK_wiki
Jump to navigation Jump to search
(PGML example link)
(add historical tag and give links to newer problems.)
 
Line 1: Line 1:
  +
{{historical}}
  +
  +
<p style="font-size: 120%;font-weight:bold">This problem has been replaced with [https://openwebwork.github.io/pg-docs/sample-problems/Sequences/SeriesTest.html a newer version of this problem]</p>
  +
 
<h2>Requiring Students to Justify Series Tests</h2>
 
<h2>Requiring Students to Justify Series Tests</h2>
   

Latest revision as of 06:45, 18 July 2023

This article has been retained as a historical document. It is not up-to-date and the formatting may be lacking. Use the information herein with caution.

This problem has been replaced with a newer version of this problem

Requiring Students to Justify Series Tests

Click to enlarge

This PG code shows how to require students to justify series tests.


Templates by Subject Area

PG problem file Explanation

Problem tagging data

Problem tagging:

DOCUMENT();

loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"unionTables.pl",
"parserPopUp.pl",
"PGgraders.pl",
"parserMultiAnswer.pl",
);

TEXT(beginproblem());

Initialization: We load unionTables.pl to create a table in which answer blanks are stacked on top of each other to form a fraction. We use PGgraders.pl to give partial credit incrementally. We use parserMultiAnswer.pl for the fraction answer so that we can accept two correct answers, depending on how much a student has simplified their answer.

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 $multians to allow students to enter one of two correct answers. We could have also accomplished this using two custom answer checkers.

We display the answerblanks nicely as a fraction in HTML and TeX modes by how we constructed $showfraction.

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:

Templates by Subject Area