Answer test Completed Square with fractions

Re: Answer test Completed Square with fractions

by Stephan Bach -
Number of replies: 0
Hello Chris,
thanks for your quick reply. It will helps to understand the whole thing and will help me to create my own answer test if necessary.

The main cases I would like to cover are

array('CompSquare', 'x', '3/2*(x-1)^2+1', '3/2*(x-1)^2+1', 1, 'ATCompSquare_true.', ''),
array('CompSquare', 'x', '3*(x-1)^2/2+1', '3/2*(x-1)^2+1', 1, 'ATCompSquare_true.', ''),
array('CompSquare', 'x', '-3/2*(x-1)^2+1', '-3/2*(x-1)^2+1', 1, 'ATCompSquare_true.', ''),
array('CompSquare', 'x', '-3*(x-1)^2/2+1', '-3/2*(x-1)^2+1', 1, 'ATCompSquare_true.', ''),
array('CompSquare', 'x', '1-3*(x-1)^2/2', '-3/2*(x-1)^2+1', 1, 'ATCompSquare_true.', '')

(Is this what you are thinking of?)

I don't want to accept the version with the fraction factored out.
(The reason why I tried it out, is that as an example comp_square(2*x^2+4*x+4,x) evaluates to 2*((x+1)^2+1). But I now realized that the anwer test CompletedSquare does not accept this expression for 2*(x+1)^2+2 anyways.)

Stephan