WeBWorK Problems

implicit equation

implicit equation

by Gabriela Sanchis -
Number of replies: 1
Hi.

I'm trying to write a problem in which I give a graph of an ellipse, and the student must come up with an equation. I'm following the code from http://webwork.maa.org/wiki/EquationEvaluators#.T2tcA3lLeuI

When I code this answer as

$eqn = ImplicitEquation("(x-$a)^2/$c^2+(y-$b)^2/$d^2 =1");
ANS( $eqn->cmp() );

it seems to work, but if I try to give it specific points to check, e.g.

$eqn = ImplicitEquation("(x-$a)^2/$c^2+(y-$b)^2/$d^2 =1",
solutions=>[[$a,$b-$d],[$a,$b+$d],[$a-$c,$b],[$a+$c,$b],[$a+3*$c/5,$b+4*$d/5]],tolerance=>0.0001);

it marks the correct answer wrong. Do I need to give it specific points to check, and if so is there something wrong with my code?

Thanks in advance.

Gabriela

In reply to Gabriela Sanchis

Re: implicit equation

by Paul Pearson -
Hi,

In the POD documentation

http://webwork.maa.org/pod/pg_TRUNK/macros/parserImplicitEquation.pl.html

the issues you're dealing with are explained in some detail. In general, parserImplicitEquation.pl is not as reliable as we would like, and does not work well when all of the quantities in the equation are always positive. In this particular case, there is one preferred form of the answer, so I would recommend that you ask the question in the form

___________ = 1

where ____________ represents the answer blank. Giving them the right side of the equation would allow you to use a MathObject Formula for the answer instead of a MathObject ImplicitEquation.

Good luck!

Paul Pearson