Forum archive 2000-2006

Ben Pollina - exact_no_trig with select_list

Ben Pollina - exact_no_trig with select_list

by Arnold Pizer -
Number of replies: 0
inactiveTopicexact_no_trig with select_list topic started 11/18/2004; 12:04:04 AM
last post 11/18/2004; 12:02:52 PM
userBen Pollina - exact_no_trig with select_list  blueArrow
11/18/2004; 12:04:04 AM (reads: 887, responses: 2)
I've written the following problem using the select_list construction, and I would like to force students to respond with the exact values of the answers. Is there a way I can get John Jones exact_no_trig filter to work here? Or is there some other way to accomplish this?

Ben Pollina

 

DOCUMENT();        # This should be the first executable line in the problem.



loadMacros(
PG.pl,
PGbasicmacros.pl,
PGchoicemacros.pl,
PGanswermacros.pl,
PGauxiliaryFunctions.pl,
PGasu.pl
);



TEXT(&beginproblem);
$showPartialCorrectAnswers = 1;



$sl = new_select_list();
$sl->qa(
" \( \sin (0) \) ", 0,
" \( \cos (0) \) ", 1,
" \( \sin (\pi) \) ", 0,
" \( \cos (\pi) \) ", -1,
" \( \sin (-\pi) \) ", 0,
" \( \cos (-\pi) \) ", -1,
" \( \cos (\frac{\pi}{6}) \) ", sqrt(3)/2,
" \( \cos (\frac{5 \pi}{6}) \) ", -sqrt(3)/2,
" \( \sin (\frac{\pi}{2}) \) ", 1,
" \( \sin (\frac{3 \pi}{2}) \) ", -1,
" \( \sin (\frac{7 \pi}{6}) \) ", -1/2,
" \( \cos (\frac{7 \pi}{6}) \) ", -sqrt(3)/2,
" \( \cos (\frac{\pi}{2} ) \) ", 0,
" \( \cos (\frac{5 \pi}{2}) \) ", 0,
" \( \sin (\frac{5 \pi}{6} )\) ", 1/2,
" \( \sec (\frac{5 \pi}{6} ) \) ", -2/sqrt(3),
" \( \cos (\frac{7 \pi}{3} ) \) ", 1/2,
" \( \sec (\frac{7 \pi}{3} )\) ", 2,
" \( \sin (\frac{3 \pi}{4} )\) ", sqrt(2)/2,
" \( \cos (\frac{3 \pi}{4}) \) ", -sqrt(2)/2,
" \( \cos (\frac{\pi}{3} )\) ", 1/2,
" \( \cos (-\frac{\pi}{3}) \) ", 1/2,
" \( \sin (\frac{\pi}{6}) \) ", 1/2,
" \( \sin (-\frac{\pi}{6}) \) ", -1/2,
" \( \tan (\frac{\pi}{6} ) \) ", sqrt(3)/3,
" \( \tan (- \frac{\pi}{6}) \) ", -sqrt(3)/3,
" \( \tan (\frac{\pi}{3} )\) ", sqrt(3),
" \( \cot (\frac{\pi}{3} ) \) ", sqrt(3)/3,
" \( \sec (\frac{11 \pi}{3} )\) ", 2,
" \( \csc (\frac{11 \pi}{3}) \) ", -2/sqrt(3),
" \( \sec (\frac{13 \pi}{6} )\) ", 2/sqrt(3),
" \( \sec (- \frac{13 \pi}{6} )\) ", 2/sqrt(3),
" \( \sin (\frac{9 \pi}{4} )\) ", sqrt(2)/2,
" \( \csc (\frac{9 \pi}{4}) \) ", sqrt(2),
" \( \sec (\pi) \) ", -1,
" \( \csc (\frac{\pi}{2}) \) ", 1,
" \( \tan (- \frac{\pi}{4} ) \) ", -1,
" \( \cot (- \frac{\pi}{4} ) \) ", -1,
" \( \tan ( \frac{3 \pi}{4} )\)", -1,
" \( \tan (\frac{11 \pi}{4} )\) ", -1,
);



$sl->choose(10);
$sl->ans_rule_len(15);



BEGIN_TEXT



Find the exact value of the following.
{ $sl->print_q }



END_TEXT



ANS(num_cmp( $sl->ra_correct_ans)) ;




ENDDOCUMENT(); # This should be the last executable line in the problem.

<| Post or View Comments |>


userJohn Jones - Re: exact_no_trig with select_list  blueArrow
11/18/2004; 11:05:11 AM (reads: 1088, responses: 0)
You probably know the first few things I will say, but I thought I would add them as background.

There currently isn't a way to tell num_cmp to also use some filter, so you pretty much have to call exact_no_trig yourself.

The problem then is that you are feeding it a list of answers which num_cmp can handle but exact_no_trig cannot. So, to work around this, you can call exact_no_trig in a loop:

for $j (@{$sl->ra_correct_ans}) {
ANS(exact_no_trig($j)) ;
}
This goes in place of your one ANS line. The function $sl->ra_correct_ans returns a pointer to an array, so we have to dereference it to get the actually array. Then we are running through each of those and calling ANS with it.

You would also want to quote the correct answers which are not integers. Then when the answer date has passed and students ask to see the correct answers, the correct answers will follow the rules of exact_no_trig as well.

John

<| Post or View Comments |>


userArnold K. Pizer - Re: exact_no_trig with select_list  blueArrow
11/18/2004; 12:02:52 PM (reads: 1060, responses: 0)
Hi Ben,

You might notice that I edited your original message putting the html tags

 and 
around the code of your problem. This makes it much easier to read.

Arnie

<| Post or View Comments |>