ProvingTrigIdentities3

From WeBWorK
Jump to: navigation, search

Proving Trig Identities

Click to enlarge

This PG code shows how to write a multi-part question in which each new part is revealed only after the previous part is answered correctly. The parts are revealed sequentially on the same html page instead of each part having its own html page. We also cleverly redefine the sine function to require students to simplify their answers when applying well-known trig identities.


Templates by Subject Area

PG problem file Explanation

Problem tagging data

Problem tagging:

DOCUMENT();

loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"PGML.pl",
"scaffold.pl",
"PGcourse.pl",
);

TEXT(beginproblem());

$showPartialCorrectAnswers = 1;

Initialization: Load the scaffold.pl macro.

Context("Numeric")->variables->are(t=>"Real");

Context("Numeric")->variables->are(t=>"Real");

#
#  Redefine the sin(x) to be e^(pi x)
#
Context()->functions->remove("sin");
package NewFunc;
# this next line makes the function a 
# function from reals to reals
our @ISA = qw(Parser::Function::numeric);
sub sin {
  shift; my $x = shift;
  return CORE::exp($x*3.1415926535);
}
package main;
#  Add the new functions to the Context
Context()->functions->add( sin => {class => 'NewFunc', TeX => '\sin'}, );

Setup: We cleverly redefine the sine function so that when the student enters sin(t), it is interpreted and evaluated internally as exp(pi*t) but displayed to the student as sin(t).

BEGIN_PGML
This problem has three parts.  A part may be open if it is correct or if it is the first incorrect part.
Clicking on the heading for a part toggles whether it is displayed.
END_PGML

Scaffold::Begin(is_open  => "correct_or_first_incorrect");
    
Section::Begin("Part 1");
BEGIN_PGML
In this multi-part problem, we will use algebra to verify 
the identity
>> [` \displaystyle \frac{ \sin(t) }{ 1-\cos(t) } = \frac{ 1+\cos(t) }{ \sin(t) }. `] <<

First, using algebra we may rewrite the equation above as
[` \displaystyle \sin(t) = \left( \frac{1+\cos(t)}{\sin(t)} \right) \cdot \Big( `] [_____________]{"1-cos(t)"} [` \Big) `].
END_PGML
Section::End();
    
Section::Begin("Part 2");
BEGIN_PGML
Using algebra we may rewrite the equation as
[` \sin(t) \cdot \big( `] [______________]{"sin(t)"} [` \big) = \big(1+\cos(t)\big) \cdot \big(1-\cos(t)\big) `].
END_PGML
Section::End();

Section::Begin("Part 3");
BEGIN_PGML
Finally, using algebra we may rewrite the equation as
[` \sin^2(t) = `] [_______________]{"1-(cos(t))^2"}, which is true since
[` \cos^2(t) + \sin^2(t) = 1 .`] Thus, the original identity can be derived by reversing these steps.
END_PGML
Section::End();
  
Scaffold::End();

Main Text: This is where we use the scaffold.

COMMENT("MathObject version.  This is a multi-part problem 
in which the next part is revealed only after the previous 
part is correct.  Prevents students from entering trivial 
identities (entering what they were given).  Uses PGML.");

ENDDOCUMENT();

Comment section:

Templates by Subject Area

follow us