## Forum archive 2000-2006

### Barbra Bannon - Accepting answers only as factors

by Arnold Pizer -
Number of replies: 0
 Accepting answers only as factors topic started 7/17/2001; 12:21:11 PMlast post 8/23/2001; 7:15:08 PM
 Barbra Bannon - Accepting answers only as factors  7/17/2001; 12:21:11 PM (reads: 2087, responses: 5) Question... is there a way that I can only accept answers in their factored form... For example instead of x^5 + 3x^5 +2x... they would have to input x(x-i)(x+i)(x-(2^(1/2))i)(x+(2^(1/2))i). I don't want to simply specify that they need to enter it that way... because if they entered it the non-factored way they would still get credit. Thank you for your help! -Barbra Bannon <| Post or View Comments |>

 Zbigniew Fiedorowicz - Re: Accepting answers only as factors  7/17/2001; 3:05:07 PM (reads: 2425, responses: 0) Something along these lines is possible using the NAMED_ANS() construction. I attach an example below. Zig Fiedorowicz #DESCRIPTION #Simplify expression involving trig and inverse trig functions #ENDDESCRIPTION #KEYWORDS('Trigonometric Functions', 'Inverse Functions') DOCUMENT(); loadMacros( $showPartialCorrectAnswers = 1;$a = random(3,6,1); TEXT(&beginproblem); TEXT(EV2(<<{first_answer};));>));> $firstAnswer = '' unless defined($firstAnswer); if (($firstAnswer =~ /tan/) || ($firstAnswer =~ /cos/) || ($firstAnswer =~ /sin/)) {NAMED_ANS(first_answer,strict_str_cmp("2*x*sqrt($a^2-x^2)/(2*x^2-$a^2)"));} else {NAMED_ANS(first_answer,function_cmp("2*x*sqrt($a^2-x^2)/ (2*x^2-\$a^2)"));} ENDDOCUMENT(); <| Post or View Comments |>

 Zbigniew Fiedorowicz - Re: Accepting answers only as factors  7/17/2001; 4:19:34 PM (reads: 2358, responses: 0) However there is an additional issue: >x(x-i)(x+i)(x-(2^(1/2))i)(x+(2^(1/2))i) I don't believe WeBWorK currently supports complex expressions. If you wanted to do this, you would need to modify WeBWorK's parser. Zig Fiedorowicz <| Post or View Comments |>