Here are two examples where Taylor contagion fails:
(%i1) xxx : exp(-(x-1)^2) - exp(-(x+1)^2);
(xxx) %e^(-(x-1)^2)-%e^(-(x+1)^2)
(%i2) substitute(x=taylor(x,x,inf,2),%);
Maxima encountered a Lisp error:
The variable #:G530 is unbound.
Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.
And a similar case with an asksign:
(%i1) zzz : exp(-(x-a)^2) - exp(-(x+a)^2);
(zzz) %e^(-(x-a)^2)-%e^(-(x+a)^2)
(%i2) substitute(x=taylor(x,x,inf,2),zzz);
"Is "a" positive, negative or zero?"z;
debugger invoked on a SIMPLE-CONDITION in thread
#<THREAD tid=8388 "main thread" RUNNING {1100038003}>:
bad singular datum
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [CONTINUE ] Return from COMMON-LISP:BREAK.
1: [MACSYMA-QUIT] Maxima top-level
2: Ignore runtime option --eval "(progn (load (maxima::$sconcat (namestring (pathname (maxima::maxima-getenv \"MAXIMA_PREFIX\"))) \"/bin/win_signals.lisp\")) (cl-user::run))".
3: [ABORT ] Skip rest of --eval and --load options.
4: Skip to toplevel READ/EVAL/PRINT loop.
5: [EXIT ] Exit SBCL (calling #'EXIT, killing the process).
(ADJOIN-SING-DATUM (((MEXPT) $%E ((MTIMES RATSIMP) $A $X)) ((2 . 1)) $ZEROA NIL))
error finding frame source: Bogus form-number: the source file has probably
changed too much to cope with.
source: NIL
0]
Maxima 5.49 + SBCL 2.6.0.
Bizarrely, it seems to be the negation that is responsible for the problem:
Even simpler case (getting 20 taylor terms to make sure it's not a truncation issue):
And more:
Tested in Maxima 5.49.0 SBCL 2.6.0
Last edit: Stavros Macrakis 3 days ago
It's any multiplication, not just negation. And we don't need
subst:Last edit: David Scherfgen 1 day ago
It works correctly when we use a finite expansion point, e.g.
taylor(x, x, 0, 2).The same bug exists for addition:
This is not a bug in the simplifier (
simptimes,simplus), but in the Taylor code: