problems



On Sat, 2011-07-09 at 15:11 -0500, Barton Willis wrote:
> -----maxima-bounces at math.utexas.edu wrote: -----
> 
> >assume(b>a); 
> >
> >the calculation of  
> > 
> >conjugate( sqrt(a-b))
> >
> >becomes too difficult. 
> 
> One workaround:
> 
>  (%i1) matchdeclare(e, lambda([x], is(x <= 0)))$
>  (%i2) tellsimpafter(sqrt(e),%i * sqrt(-e))$
>  (%i3) assume(b > a)$
>  (%i5) conjugate(sqrt(a-b));
>  (%o5) -%i*sqrt(b-a)
> 

I'm new to maxima but I had a quick look at some of the code and it
seems to me that the problem arises because there is no version of
$rectform when *complexsign* is set to t, thus causing problems with
$csign and, as a result, the function manifestly-pure-imaginary-p is
coded as follows:

(defun manifestly-pure-imaginary-p (e)
  (let (($inflag t))
    (or 
     (and ($mapatom e)
	  (or
	   (eq e '$%i)
	   (and (symbolp e) (kindp e '$imaginary) (not ($nonscalarp e)))
	   (and ($subvarp e) (manifestly-pure-imaginary-p ($op e)))))
     ;; For now, let's use $csign on constant expressions only; once $csign improves,
     ;; the ban on nonconstant expressions can be removed
     (and ($constantp e) (eq '$imaginary ($csign e))))))

Is this the root of the problem? It's years since I've programmed in
Lisp, but I wouldn't mind looking into this further. Incidentally if you
call rectform yourself you get the right answer:

 (%i1) assume (b>a)$
 (%i2) rectform (sqrt(a-b))$
 (%i3) conjugate(%);
 (%o5) -%i*sqrt(b-a)

 /Bernard