I have reported some work to overcome the problem of wrong
simplifications for the sqrt function. Related bug reports are:
Bug ID 1010768 - sqrt(1/z) - 1/sqrt(z) => 0
Bug ID 2852992 - sqrt(-1/x)-%i/sqrt(x) not zero
In a first step I have modified the routine simpexpt to get the correct
and expected answers, e.g.:
(%i1) assume(x>0);
(%o1) [x > 0]
(%i2) sqrt(1/x)-1/sqrt(x);
(%o2) 0
(%i3) sqrt(1/-x)+1/sqrt(-x);
(%o3) 0
I had no problems with the testsuite and the share testsuite. All works
fine. But because I know that the testsuite often is not very complete I
have written a testfile which does more tests for the sqrt function.
Surprisingly, I have got a problem with the function radcan. It seems to
me that radcan is not able to handle correct expression like sqrt(1/(1
+z)). Such expressions do not occur with the code we have, because
sqrt(1/(1+z)) is always simplified to 1/sqrt(1+z). But when we cut out
this simplification radcan hangs.
This problem can be seen with a call on the Lisp level to radcan1. We
enter the function with an unsimplified expression sqrt(1/(1+z)). The
following call hangs (There are no changes to simpexpt. It hangs with
the code we have.):
(%i4) :lisp (radcan1 '((mexpt) ((mexpt) ((mplus) 1 $z) -1) ((rat) 1 2)))
^C
Maxima encountered a Lisp error:
Ctrl-C: User break
Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.
I have tried to find the problem, but I had no success. The last call I
have found is a call to the function ratexpt:
(%i4) :lisp (trace ratexpt)
;; Tracing function RATEXPT.
(RATEXPT)
(%i4) :lisp (radcan1 '((mexpt) ((mexpt) ((mplus) 1 $z) -1) ((rat) 1 2)))
1. Trace: (RATEXPT '((#:Z21898 1 1 0 1) . 1) '-1)
1. Trace: RATEXPT ==> (1 #:Z21898 1 1 0 1)
1. Trace: (RATEXPT '((#:Z21899 1 1 0 1) . 1) '-1)
1. Trace: RATEXPT ==> (1 #:Z21899 1 1 0 1)
1. Trace: (RATEXPT '((#:Z21900 1 1 0 1) . 1) '-1)
1. Trace: RATEXPT ==> (1 #:Z21900 1 1 0 1)
1. Trace: (RATEXPT '((#:Z21901 1 1 0 1) . 1) '-1)
1. Trace: RATEXPT ==> (1 #:Z21901 1 1 0 1)
1. Trace: (RATEXPT '((#:Z21902 1 1 0 1) . 1) '-1)
1. Trace: RATEXPT ==> (1 #:Z21902 1 1 0 1)
1. Trace: (RATEXPT '((#:|log(z+1)21904| 1 -1 0 (#:|log(1)21903| 1 1)) .
1) '0)
1. Trace: RATEXPT ==> (1 . 1)
1. Trace: (RATEXPT '((#:|log(z+1)21904| 1 -1 0 (#:|log(1)21903| 1 1)) .
1) '0)
1. Trace: RATEXPT ==> (1 . 1)
1. Trace: (RATEXPT '((#:|(z+1)^(1/2)21911| 1 1) . 1) '-1)
1. Trace: RATEXPT ==> (1 #:|(z+1)^(1/2)21911| 1 1)
1. Trace: (RATEXPT '((#:Z21902 1 1 0 1) . 1) '-1)
1. Trace: RATEXPT ==> (1 #:Z21902 1 1 0 1)
1. Trace: (RATEXPT '(1 #:|(z+1)^(1/2)21911| 1 1) '2)
1. Trace: RATEXPT ==> (1 #:|(z+1)^(1/2)21911| 2 1)
1. Trace: (RATEXPT '(1 #:Z21902 1 1 0 1) '8388593)^C
Maxima encountered a Lisp error:
EXT:GC: User break
Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.
I know nothing about the routines for rational functions. Perhaps
someone else has a idea what is going wrong with radcan.
Remark: When we cut out the simplification sqrt(1/x) -> 1/sqrt(x) we get
the same behavior as described above.
Dieter Kaiser