taylor(x,x,0,5)/x^2 => 1/x+...
Internally: ((MRAT SIMP ($X) (#:X1942) (($X ((5 . 1)) 0 NIL #:X1942 . 1)) TRUNC) PS
(#:X1942 . 1) ((3 . 1)) ((-1 . 1) 1 . 1))
(taylor(x,x,0,5)/x)/x => 1/x (without ellipses)
Internally: ((MRAT SIMP ($X) (#:X1945) (($X ((5 . 1)) 0 NIL #:X1945 . 1)) TRUNC) PS
(#:X1945 . 1) * (NIL) * ((-1 . 1) 1 . 1))
taylorinfo of both expressions remains [[x,0,5]]
Versions: 5.27.0 2012-04-30 11:59:06 i686-apple-darwin11.3.0 SBCL 1.0.55.0-abb03f9
When dividing twice by x the result is, as you say:
Printing is done by FORM-MRAT, which decides the result is "exact"
(because of the NIL) and intentionally doesn't print a trailing ...
Another way to get the same result is:
Something that definitely appears wrong shows up when you trace
TAYLOR2 in the division
taylor(1, x, 0, 5) / x;
:The
(NIL)
is "<trunc-lvl>" as explained in the comment at the top ofhayat.lisp and I think it should probably be set to
((4 . 1))
notNIL!
Digging into TAYLOR2, and tracing TSTIMES, this looks pretty bogus:
Basically, I think the second call to TAYLOR2 should probably result
in something like
which would say "This is a power series in X, which is 1 up to
x^5". If something like this doesn't get returned, there's no way for
the following code to work out the truncation order.