[npl] / trunk / NationalProblemLibrary / LoyolaChicago / Precalc / Chap7Sec2 / Connally3-7-2-36-Trig-identities.pg Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww

# View of /trunk/NationalProblemLibrary/LoyolaChicago/Precalc/Chap7Sec2/Connally3-7-2-36-Trig-identities.pg

Fri Sep 17 02:14:29 2010 UTC (2 years, 8 months ago) by pearson
File size: 4136 byte(s)
Changed AnSwEr1 to ANS_NUM_TO_NAME(1), etc.

    1 ## DESCRIPTION
2 ## Trigonometric Identities
3 ## ENDDESCRIPTION
4
5 ## KEYWORDS('trig')
6
7 ## DBsubject('Precalculus')
8 ## DBchapter('Trigonometry')
9 ## DBsection('Trigonometric Identities')
10 ## Date('01/01/10')
11 ## Author('Paul Pearson')
12 ## Institution('Fort Lewis College')
13 ## TitleText1('Functions Modeling Change')
14 ## EditionText1('3')
15 ## AuthorText1('Connally')
16 ## Section1('7.2')
17 ## Problem1('36')
18
19
20 DOCUMENT();
21
23 "PGstandard.pl",
24 "MathObjects.pl",
26 "parserPopUp.pl",
27 "unionTables.pl",
29 );
30
31 TEXT(beginproblem());
32
33 $showPartialCorrectAnswers = 1; 34 35 36 ################################### 37 # Setup 38 39 Context("Numeric")->variables->are(x=>"Real"); 40 41 Context()->functions->remove("cos"); 42 package NewFunc; 43 # this next line makes the function a 44 # function from reals to reals 45 our @ISA = qw(Parser::Function::numeric); 46 sub cos { 47 shift; my$x = shift;
48   return CORE::exp(-$x*3.1415926535); 49 } 50 package main; 51 # Make it work on formulas as well as numbers 52 #sub cos {Parser::Function->call('cos',@_)} # if uncommented, this line will generate error messages 53 # Add the new functions to the Context 54 Context()->functions->add( cos => {class => 'NewFunc', TeX => '\cos'}, ); 55 56 57 Context()->functions->remove("sin"); 58 package NewFunc; 59 # this next line makes the function a 60 # function from reals to reals 61 our @ISA = qw(Parser::Function::numeric); 62 sub sin { 63 shift; my$x = shift;
64   return CORE::exp($x*3.1415926535); 65 } 66 package main; 67 # Make it work on formulas as well as numbers 68 #sub cos {Parser::Function->call('cos',@_)} # if uncommented, this line will generate error messages 69 # Add the new functions to the Context 70 Context()->functions->add( sin => {class => 'NewFunc', TeX => '\sin'}, ); 71 72 73 74$popup = PopUp(["Choose","Identity","Not an identity"],"Identity");
75
76 $ans_eval1 =$popup->cmp();
77 $ans_eval2 = Formula("sin(x)/cos(x)")->cmp()->withPostFilter(AnswerHints( 78 Formula("tan(x)") => "Hint: Rewrite tangent in terms of sine and cosine", 79 )); 80$ans_eval3 = Formula("cos(x)/sin(x)")->cmp()->withPostFilter(AnswerHints(
81   Formula("1/tan(x)") => "Hint: Rewrite tangent in terms of sine and cosine",
82 ));
83 $ans_eval4 = Formula("(cos(x))^2+(sin(x))^2")->cmp()->withPostFilter(AnswerHints( 84 Formula("1") => "Use a trig identity to rewrite 1 in terms of sines and cosines", 85 )); 86 87 88 ################################### 89 # Main text 90 91 92 ########## 93 # PART 1 94 95 BEGIN_TEXT 96${BBOLD}Part 1 of 3:${EBOLD} 97$BR
98 $BR 99 This is a multi-part problem. Use a graph to decide whether the equation 100$BCENTER
101 $$\displaystyle \tan(x) + \frac{ 1 }{ \tan(x) } = \frac{ 1 }{ \cos(x) \sin(x) }$$
102 $ECENTER 103$BR
104 is an identity or not.  \{ $popup->menu() \} 105 END_TEXT 106 107 ANS($ans_eval1 );
108
109
110
111 #############
112 #   PART 2
113
114 $ans_hash1 =$ans_eval1->evaluate($inputs_ref->{ANS_NUM_TO_NAME(1)}); 115 116 if (1 ==$ans_hash1->{score}) {
117
118 BEGIN_TEXT
119 $PAR 120$HR
121 ${BBOLD}Part 2 of 3:${EBOLD}
122 $BR 123$BR
124 Now, let's prove that the equation above is an identity.
125 Using trigonometric identities, fill in the following answer blanks.
126 $BR 127$BR
128 $$\displaystyle \tan(x) + \frac{ 1 }{ \tan(x) } =$$
129 \{ ans_rule(15) \} + \{ ans_rule(15) \}
130 END_TEXT
131
132 ANS($ans_eval2 ); 133 ANS($ans_eval3 );
134
135 }
136
137
138 #############
139 #   PART 3
140
141 $ans_hash2 =$ans_eval2->evaluate($inputs_ref->{ANS_NUM_TO_NAME(2)}); 142$ans_hash3 = $ans_eval3->evaluate($inputs_ref->{ANS_NUM_TO_NAME(3)});
143
144 if ( ($ans_hash1->{score}==1) && ($ans_hash2->{score}==1) && ($ans_hash3->{score}==1) ) { 145 146 BEGIN_TEXT 147$PAR
148 $HR 149${BBOLD}Part 3 of 3:${EBOLD} 150$BR
151 $BR 152 By finding a common denominator, we obtain 153$BR
154 $BR 155 \{ 156 ColumnTable( 157 "$$\displaystyle \frac{\sin(x)}{\cos(x)} + \frac{\cos(x)}{\sin(x)} =$$ ", 158 ans_rule(20).$HR."$$\cos(x) \sin(x)$$",
159 indent=>"0", valign=>"MIDDLE", separation=>"10",
160 );
161 \}
162 $BR 163 Using a trigonometric identity, this equals $$\displaystyle \frac{1}{\cos(x)\sin(x)}$$, and therefore we've proved the original identity. 164 END_TEXT 165 166 ANS($ans_eval4 );
167
168 }
169
170
171
172 COMMENT("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).");
173
174
175 COMMENT('MathObject version');
176 ENDDOCUMENT();