Created
May 17, 2016 01:57
-
-
Save egisatoshi/6241d73568af00bfd5bbd00949645fe9 to your computer and use it in GitHub Desktop.
Multi variate Taylor Expansion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define $∇ | |
(lambda [$f $xs] | |
(generate-tensor | |
1#(∂/∂ f (nth %1 xs)) | |
{(length xs)}))) | |
(define $nabla ∇) | |
(define $taylor-expansion2 | |
(lambda [$f $xs $as] | |
(map2 * | |
(map 1#(/ 1 (fact %1)) nats0) | |
; (map (substitute (zip xs as) $) | |
(iterate (Op.* (∇ $ xs) (V.* (generate-tensor 1#h_%1 {(length xs)}) $)) f)))) | |
(define $taylor-expansion3 | |
(lambda [$f $xs $as] | |
(iterate (Op.* (∇ $ xs) (V.* (generate-tensor 1#h_%1 {(length xs)}) $)) f))) | |
(define $Op.* compose) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment