solution of system of quadratic eqns.



I think that sqrt denesting is a possibly expensive operation.  How 
expensive is it if there
are no square roots?  In fact, there are no nested sqrts in this 
expression, so it should
not be necessary even here.

RJF
On 6/23/2012 7:59 PM, Krishna Myneni wrote:
> 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)
>>                           '$radcan))))
>>       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:
>
> -- 
> (%i1) load(sqdnst);
> (%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
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima