# [Maxima] solution of system of quadratic eqns.

Krishna Myneni krishna.myneni at ccreweb.org
Sat Jun 23 16:33:22 CDT 2012

```On 06/23/2012 04:09 PM, Richard Fateman wrote:
> On 6/23/2012 9:55 AM, Barton Willis wrote:
>> Surely the bug is related to the fact that the last call to resultant
>> returns  256*(sqrt(7)^2-7)  instead of 0.
> Ah, yes that would account for it.
> I just try typing
> resultant(8*y^2+sqrt(7)-4,8*y^2-8*y-sqrt(7)-2,y);
> and got 0.
>
> However,
>
> resultant(rat(8*y^2+sqrt(7)-4),rat(8*y^2-8*y-sqrt(7)-2),y);
>
> returns 256*(sqrt(7)^2-7).
>
> So the result in CRE  ("rat") form is simplified according to its lights.
>
> Here's a fix:
>
> :lisp  (setf (symbol-function 'oldres)(symbol-function '\$resultant))
> :lisp  (defun \$resultant(a b c)(\$ratsimp(oldres a b c)))
>
> now solve works.
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>

Hmm... Am I applying the fix incorrectly? The redefinition of resultant
fixes the test case, given above, but solve() still doesn't work for me.:

(%i1)  resultant(rat(8*y^2+sqrt(7)-4),rat(8*y^2-8*y-sqrt(7)-2),y);
2
(%o1)/R/                      256 (sqrt(7)  - 7)
(%i2) :lisp  (setf (symbol-function 'oldres)(symbol-function '\$resultant))

#<compiled-function \$RESULTANT>
(%i2) :lisp  (defun \$resultant(a b c)(\$ratsimp(oldres a b c)))

\$RESULTANT
(%i2) resultant(rat(8*y^2+sqrt(7)-4),rat(8*y^2-8*y-sqrt(7)-2),y);
(%o2)                                  0
(%i3) e1: x^2 + y^2 = 1;
2    2
(%o3)                             y  + x  = 1
(%i4) e2: (x-0.5)^2+(y-0.5)^2 = 1;
2            2
(%o4)                     (y - 0.5)  + (x - 0.5)  = 1
(%i5) solve( [e1,e2], [x,y] );

rat: replaced -0.5 by -1/2 = -0.5

rat: replaced -0.5 by -1/2 = -0.5
(%o5)                                 []

Krishna

```