## PREP 2014 Question Authoring - Archived

### Re: disabling functions

by Joel Trussell -
Number of replies: 0
I wrote my real problem using a list of angles that I choose randomly, than I calculate the sin/cos/tan - I realize the answer would not be in a form that the students could type, as I wrote the solution. Given the real problem - below - is there a way to get the fractional answer without creating another array of answers that match the angles array ? I was putting off that part until later.

# DESCRIPTION
# Problem from H. J. Trussell for ECE200
# ENDDESCRIPTION

## DBsubject(Trigonometry)
## DBchapter(Trigonometric functions)
## DBsection(Trigonometric functions of special angles)
## Institution(Loyola University Chicago)
## Author(n/a)
## Level(2)
## KEYWORDS('tangent','sine','cosine')

DOCUMENT();

"PGcourse.pl",
"PGstandard.pl",
"PGbasicmacros.pl",
"PGchoicemacros.pl", # needed for NchooseK(24,6)
#"PGauxiliaryFunctions.pl",
);

TEXT(beginproblem());

Context("Numeric");
Parser::Number::NoDecimals();
$showPartialCorrectAnswers = 1; @text_angle = ("\frac{\pi}{6}" , "\frac{\pi}{4}" , "\frac{\pi}{3}", "\frac{2 \pi}{3}" , "\frac{3 \pi}{4}" , "\frac{5 \pi}{6}", "\frac{7 \pi}{6}" , "\frac{5 \pi}{4}" , " \frac{4 \pi}{3}", "\frac{5 \pi}{3}" , "\frac{7 \pi}{4}" , "\frac{11 \pi}{6}", "\frac{-\pi}{6}" , "\frac{-\pi}{4}" , "\frac{-\pi}{3}", "\frac{-2 \pi}{3}" , "\frac{-3 \pi}{4}" , "\frac{-5 \pi}{6}", "\frac{-7 \pi}{6}" , "\frac{-5 \pi}{4}" , " \frac{-4 \pi}{3}", "\frac{-5 \pi}{3}" , "\frac{-7 \pi}{4}" , "\frac{-11 \pi}{6}",); @angle = (pi/6 , pi/4 , pi/3, 2*pi/3 , 3*pi/4 , 5*pi/6, 7*pi/6 , 5*pi/4 , 4*pi/3, 5*pi/3, 7*pi/4,11*pi/6, -1*pi/6 ,-1* pi/4 , -1*pi/3, -2*pi/3 , -3*pi/4 , -5*pi/6, -7*pi/6 , -5*pi/4 , -4*pi/3, -5*pi/3, -7*pi/4,-11*pi/6,); @pick = NchooseK(24,6);$ans1 = sin($angle[$pick[0]]);
$ans2 = sin($angle[$pick[1]]);$ans3 = cos($angle[$pick[2]]);
$ans4 = cos($angle[$pick[3]]);$ans5 = tan($angle[$pick[4]]);
$ans6 = tan($angle[$pick[5]]); Context()->functions->disable("Trig"); BEGIN_TEXT Practice finding the exact values of trig functions of common angles$BR
$SPACE$BR
Find the exact value of each without using a calculator. You may not enter decimals or use the trig functions in your answers. You can use fractions that contain integers and square roots.
$BR$SPACE
$BR a) $$\sin{ \left( text_angle[pick[0]] \right) }$$ = \{ ans_rule(20) \}$BR
b)  $$\sin{ \left( text_angle[pick[1]] \right) }$$ = \{ ans_rule(20) \}
$BR c) $$\cos{ \left( text_angle[pick[2]] \right) }$$ = \{ ans_rule(20) \}$BR
d)  $$\cos{ \left( text_angle[pick[3]] \right) }$$ = \{ ans_rule(20) \}
$BR e) $$\tan{ \left( text_angle[pick[4]] \right) }$$ = \{ ans_rule(20) \}$BR
f)  $$\tan{ \left( text_angle[pick[5]] \right) }$$ = \{ ans_rule(20) \}
$BR END_TEXT ANS($ans1->cmp(tol=>0.00000000000001 ) );
ANS( $ans2->cmp(tol=>0.00000000000001) ); ANS($ans3->cmp(tol=>0.00000000000001 ) );
ANS( $ans4->cmp(tol=>0.00000000000001 ) ); ANS($ans5->cmp(tol=>0.00000000000001 ) );
ANS($ans6->cmp(tol=>0.00000000000001 ) ); SOLUTION(EV3(<<'END_SOLUTION'));$BR $SPACE$BR
$BBOLD SOLUTION$EBOLD
Note that answers are in decimal for now, will correct  to fraction later
$BR a)$SPACE $$\sin{ \left( text_angle[pick[0]] \right) } = ans1$$
$BR$SPACE $BR b)$SPACE $$\sin{ \left( text_angle[pick[1]] \right) } = ans2$$
$BR$SPACE $BR c)$SPACE $$\cos{ \left( text_angle[pick[2]] \right) } = ans3$$
$BR$SPACE $BR d)$SPACE $$\cos{ \left( text_angle[pick[3]] \right) } = ans4$$
$BR$SPACE $BR e)$SPACE $$\tan{ \left( text_angle[pick[4]] \right) } = ans5$$
$BR f)$SPACE $$\tan{ \left( text_angle[pick[5]] \right) } = ans6$$
\$BR
END_SOLUTION

COMMENT('MathObject version');
ENDDOCUMENT();