# [Maxima] solution of system of quadratic eqns.

Krishna Myneni krishna.myneni at ccreweb.org
Sat Jun 23 21:59:28 CDT 2012

```On 06/23/2012 09:20 PM, Barton Willis wrote:
> I think the function ebaksubst (defined in algsys.lisp) doesn't try hard enough to simplify to zero. It only uses radcan, and that just
> isn't sufficient for this case. Try this:
>
> (defun ebaksubst (solnl lhsl)
>    (mapcar #'(lambda (s) (cadr (ratf (\$radcan (mfuncall '\$sqrtdenest (\$substitute (cons '(mlist) solnl) (pdis s))))))) lhsl))
>
> Current ebaksubst (macro what-to-\$ev calls \$ev .... yikes)
>
> (defun ebaksubst-old (solnl lhsl)
>    (mapcar #'(lambda (q) (cadr (ratf (what-the-\$ev (pdis q)
> 						  (cons '(mlist) solnl)
> 	  lhsl))
>
> You'll need to load(sqdnst) to test:
>
>    (%i11) algsys([x^2+y^2-1,(x-1/2)^2+(y-1/2)^2-1],[x,y]);
>    (%o11) [[x=-(sqrt(7)-1)/4,y=(sqrt(2)*sqrt(4-sqrt(7))+2)/4],[x=(sqrt(7)+1)/4,y=-(sqrt(2)*sqrt(sqrt(7)+4)-2)/4]]
>
> The fact that resultant returns  256*(sqrt(7)^2-7) instead of zero, seems to be a venial bug.
>
> --Barton
>
>
>
>

This works for me:

--
(%o1)      /usr/share/maxima/5.24.0/share/simplification/sqdnst.mac
(%i2) :lisp (defun ebaksubst (solnl lhsl) (mapcar #'(lambda (s) (cadr
(ratf (\$radcan (mfuncall '\$sqrtdenest (\$substitute (cons '(mlist) solnl)
(pdis s))))))) lhsl))

EBAKSUBST
(%i2) e1: x^2 + y^2 = 1;
2    2
(%o2)                             y  + x  = 1
(%i3) e2: (x-1/2)^2 + (y-1/2)^2 = 1;
1 2        1 2
(%o3)                       (y - -)  + (x - -)  = 1
2          2
(%i4) solve( [e1,e2], [x,y] );
sqrt(7) - 1      sqrt(2) sqrt(4 - sqrt(7)) + 2
(%o4) [[x = - -----------, y = -----------------------------],
4                         4
sqrt(7) + 1        sqrt(2) sqrt(sqrt(7) +
4) - 2
[x = -----------, y = -
-----------------------------]]
4                           4

--

Krishna

```