Skip to content

Commit 49cb4dc

Browse files
committed
Fix taylor log normalization
1 parent d243ec6 commit 49cb4dc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/core/taylor.rkt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,9 @@
510510

511511
(define (taylor-log var arg)
512512
;(-> symbol? term? term?)
513-
(match-define (cons shift coeffs) (normalize-series arg))
513+
(define normalized (normalize-series arg))
514+
(define shift (series-offset normalized))
515+
(define coeffs (series-function normalized))
514516
(define negate? (and (number? (deref (coeffs 0))) (not (positive? (deref (coeffs 0))))))
515517
(define (maybe-negate x)
516518
(if negate?
@@ -560,7 +562,7 @@
560562
[add (λ (x) (batch-add! batch x))])
561563
(define brfs* (map (expand-taylor! batch) brfs))
562564
(define brf (car brfs*))
563-
(match-define fn (zero-series ((taylor 'x batch) brf)))
565+
(define fn (zero-series ((taylor 'x batch) brf)))
564566
(map batch-pull (build-list n fn))))
565567
(check-equal? (coeffs '(sin x)) '(0 1 0 -1/6 0 1/120 0))
566568
(check-equal? (coeffs '(sqrt (+ 1 x))) '(1 1/2 -1/8 1/16 -5/128 7/256 -21/1024))

0 commit comments

Comments
 (0)