From e302757edc043f86c477ece7ba3d200c5cd6523b Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Sat, 1 Dec 2018 15:16:49 +0000 Subject: [PATCH] Recursively integrate after substitution. The declarations in this context may have changed. This way, you can get a lot of straight-line floating-point arithmetic like so: (define (flo:sinh-taylor19 x) (declare (no-type-checks)) (let* ((x^2 (flo:* x x)) (t8 (flo:/ 1. 121645100408832000.)) (t7 (flo:+ (flo:/ 1. 355687428096000.) (flo:* x^2 t8))) (t6 (flo:+ (flo:/ 1. 1307674368000.) (flo:* x^2 t7))) (t5 (flo:+ (flo:/ 1. 6227020800.) (flo:* x^2 t6))) (t4 (flo:+ (flo:/ 1. 39916800.) (flo:* x^2 t5))) (t3 (flo:+ (flo:/ 1. 362880.) (flo:* x^2 t4))) (t2 (flo:+ (flo:/ 1. 5040.) (flo:* x^2 t3))) (t1 (flo:+ (flo:/ 1. 120.) (flo:* x^2 t2))) (t0 (flo:+ (flo:/ 1. 6.) (flo:* x^2 t1)))) (declare (integrate t0 t1 t2 t3 t4 t5 t6 t7 t8 x^2)) (flo:* x (flo:+ 1. (flo:* x^2 t0))))) Previously, the number of variables in this sequence that would be integrated depended on the number of surrounding integrated calls in the body of the let (!). --- src/sf/subst.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sf/subst.scm b/src/sf/subst.scm index cb4233a55..db073f59d 100644 --- a/src/sf/subst.scm +++ b/src/sf/subst.scm @@ -334,7 +334,9 @@ USA. (integrate/name expression expression info environment))) (if new-expression (begin (variable/integrated! variable) - new-expression) + (integrate/expression operations + environment + new-expression)) (dont-integrate)))) ((integrate-operator) -- 2.25.1