PeriodicAnswers1

From WeBWorK_wiki
Revision as of 16:29, 3 January 2012 by Paultpearson (talk | contribs)
Jump to navigation Jump to search

Periodic Answers

Click to enlarge

This PG code shows how to check student answers that are periodic.

  • Download file: File:PeriodicAnswers1.txt (change the file extension from txt to pg when you save it)
  • File location in NPL: FortLewis/Authoring/Templates/Trig/PeriodicAnswers1.pg



Templates by Subject Area

PG problem file Explanation

Problem tagging data

Problem tagging:

DOCUMENT();

loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"AnswerFormatHelp.pl",
);

TEXT(beginproblem());

Initialization:

Context("Numeric");

$answer = Real("pi/2")->with(period=>pi);

Setup: This is self-explanatory.

Context()->texStrings;
BEGIN_TEXT
Enter a solution to \( \cos(\theta) = 0 \).
$BR
$BR
\( \theta = \)
\{ ans_rule(10) \}
\{ AnswerFormatHelp("angles") \}
END_TEXT
Context()->normalStrings;

Main Text:

$showPartialCorrectAnswers = 1;

ANS( $answer->cmp() );

Answer Evaluation:


Context()->texStrings;
BEGIN_SOLUTION
The cosine of an angle is zero when 
the angle is an integer multiple of \( \pi \).
END_SOLUTION
Context()->normalStrings;

ENDDOCUMENT();

Solution:

Templates by Subject Area