## Forum archive 2000-2006

### Ben Pollina - equation_cmp ### Ben Pollina - equation_cmp

by Arnold Pizer -
Number of replies: 0 equation_cmp topic started 3/26/2004; 1:08:08 PMlast post 3/24/2005; 5:05:21 PM Ben Pollina - equation_cmp 3/26/2004; 1:08:08 PM (reads: 1630, responses: 5) I'm trying to use equation_cmp to check an equation of the form "x/$a =$b/y".  It tells me my answer is correct, if I enter the string exactly as specified.  If I enter something equivalent, like $a/x = y/$b or x*y = $a*$b, it says incorrect. Anybody know how to do this?     <| Post or View Comments |> John Jones - Re: equation_cmp 3/26/2004; 3:29:08 PM (reads: 1929, responses: 0) Hi, These variations are beyond the scope of equation_cmp.  It does not try to implement computer algeba system type capabilities when doing its work, and I think that is the direction this example is going.  It does a function comparison of LHS-RHS, up to non-zero scalar multiple.  This is sufficient for checking equations of lines (in 2 variables), planes (in 3 variables), circles, and other geometric objects.  In all these cases, there are still ways to write the equation which are technically correct and will be marked wrong by equation_cmp, but generally they don't come up. Your example is different - those are reasonable equations for the same curve.  equation_cmp would probably do what you want if you insisted that the answer be a polynomial equation which would rule out dividing by x or y, but probably your best bet is to solve for y and have students fill in the blank for y = ...... John<| Post or View Comments |> Davide P. Cervone - Re: equation_cmp 3/20/2005; 8:31:14 AM (reads: 1704, responses: 0) Ben: I have just posted an experimental answer checker to the CVS repository in pg/macros/parserImplicitEquation.pl that should handle the situation you are interested in. It attempts to compare two implicitly defined equations to see if they have the same solutions. The check is not perfect, but it might be worth trying out. Read the comments at the top of the file for some caveats about what can go wrong. Because of the algorithm used to check the answers, there are always ways for the student to write correct answers that will not be marked correct, and incorrect answers that will pass. For example, if f(x,y) = 0, then for large n the algorithm will mark (f(x,y))^n = 0 as incorrect, and it will not be able to locate the solutions for even n at all (the algorithm needs sign changes to identify solutions). It will also mark (x^2+y^2-.01)f(x,y)=0 as correct, since the algorithm is unlikely to notice the additional zeros introduced by the small circle. But it WILL recognize xy=4, x/2=2/y, x=4/y, x-4/y=0, (x^2+y^2)(xy-4)=0, and so on as being the same thing. It will also get x^2-y^2=0 as |x|=|y|, and x^2-y^2=1 as |y|=sqrt(x^2-1). So it has some promise. Try it out and see what you think. If you DO use it, you might want to view past answers on the problems that you use it on, and see whether it is marking things wrong. Davide <| Post or View Comments |> Bob Byerly - Re: equation_cmp 3/24/2005; 8:52:01 AM (reads: 1709, responses: 0) Hi, It might also be worth pointing out that since there are only a small number of ways of writing this particular equation in a reasonable fashion, one could simply use John Jones' pc_evaluator (in PGasu.pl) together with "equation_cmp" to check them all. This is an ad hoc solution of course. Bob <| Post or View Comments |> John Jones - Re: equation_cmp 3/24/2005; 1:39:04 PM (reads: 1681, responses: 0) Hi, On one hand, I agree with Bob's response, I know it runs somewhat counter to webwork's philosophy. A basic feature of webwork is that problem writers don't have to anticipate the different forms in which an answer may appear. Thinking about it more, it may be good to have both apporaches. One factor which might decide which approach to use in a given situation is what forms of the equation do you want to mark correct. In the example above of xy=4, you would probably always want variations such as x/2=2/y and y-4/x=0 to be correct. But, you may not want (x^2+y^2)(xy-4)=0 since it has a different solution set over R (because of (0,0)). Some people may also not want to accept (x^2+y^2+3)(xy-4)=0. While it has the same set of real solutions it rubs me the wrong way - to use a quartic equation for a hyperbola. Then again, it is unlikely a student will happen on an answer like that so worrying about it is probably moot. John <| Post or View Comments |> Davide P. Cervone - Re: equation_cmp 3/24/2005; 5:05:21 PM (reads: 1718, responses: 0) I agree with John about not really liking (x^2+y^2+3)(xy-4)=0 and other such constructions as correct answers for this, but (as he points out), it is a pretty unlikely answer. Mostly, I wrote this answer checker as an experiment to see how well it could be made to work. I'm not sure it is really all that successful, but I do think it is worth having around as an idea of how this kind of problem could be approached. It would be possible to analyze the parsed version of the student's answer to make a more careful study of the form (for example, looking for factors that never seem to be zero, etc), but that would probably lead to other problems. (It would only help if one side were 0, for example.) Anyway, it seemed like an idea worth trying. Davide <| Post or View Comments |>