Fix bug #3956: expand(1/((sqrt(2)-1)*(sqrt(2)+1))) => 1/1 (unsimplified)
commit299a7fc42079ac03d7c0d6080712ef8d93fdfba7
authorKris Katterjohn <katterjohn@gmail.com>
Sun, 20 Mar 2022 00:44:52 +0000 (19 20:44 -0400)
committerKris Katterjohn <katterjohn@gmail.com>
Sun, 20 Mar 2022 00:44:52 +0000 (19 20:44 -0400)
treedd32c05d8aa25d6c6eb3dca499a05beead5af22f
parentc9347bd4236c323f22b40e7c781ab2cbd70cd0b9
Fix bug #3956: expand(1/((sqrt(2)-1)*(sqrt(2)+1))) => 1/1 (unsimplified)

This is an ancient bug that was present in Macsyma.

EXPANDTIMES has been constructing MEXPT expressions marked with
the SIMP flag when there is no reason to assume the expressions
are actually simplified.  The expression is of the form
((MEXPT SIMP) E -1) where E is the result of EXPANDTERMS.

(%i1) expand(1/((sqrt(2)-1)*(sqrt(2)+1)));
(%o1) 1/1

(%i2) expand(%);
(%o2) 1

(%i3) expand(1/(-(sqrt(n+1)-1)*(sqrt(n+1)+1)));
(%o3) 1/(-n)

(%i4) expand(%);
(%o4) -1/n

Now we just use INV instead of manually constructing the MEXPT
expressions with bogus SIMP flags.

See also commit eb4bfa5f regarding the similar bug #3934.

No problems with the test suite or share test suite.  New tests
have been added to rtest16.
ChangeLog
src/simp.lisp
tests/rtest16.mac