Skip to content
Browse files

symbols and symbolic differentiation

  • Loading branch information...
1 parent d8119c2 commit 1bc538952ab4ea0dee33db9bfb0c1ce1a795ef96 @sarabander committed Nov 11, 2011
Showing with 9 additions and 3 deletions.
  1. +3 −0 2.3/2.54.scm
  2. +1 −1 2.3/2.56.scm
  3. +5 −2 2.3/2.57.scm
View
3 2.3/2.54.scm
@@ -27,3 +27,6 @@
(my-equal? 7 12) ; false
(my-equal? 3 +3) ; true
+
+(my-equal? '(23 4 (5 (72)) (14)) '(23 4 (5 (72)) (14))) ; true
+(my-equal? '(23 4 (5 (70)) (14)) '(23 4 (5 (72)) (14))) ; false
View
2 2.3/2.56.scm
@@ -78,4 +78,4 @@
(deriv '(+ (** x 3) (* 5 x)) 'x) ; '(+ (* 3 (** x 2)) 5)
-(deriv '(+ 3 x x 4 7) 'x)
+(deriv '(+ 3 x x 4 7) 'x) ; 1 (can't handle sums with more than 2 arguments)
View
7 2.3/2.57.scm
@@ -59,6 +59,9 @@
(else (list '* m1 m2))))
;; Tests
-(deriv '(* x y (+ x 3)) 'x)
-(deriv '(+ (* 4 x) (* 7 (** x 3)) (* x 5)) 'x)
+(deriv '(* x y (+ x 3)) 'x) ; '(+ (* x y) (* y (+ x 3)))
+(deriv '(+ (* 4 x) (* 7 (** x 3)) (* x 5)) 'x)
+; '(+ 4 (+ (* 7 (* 3 (** x 2))) 5))
(deriv '(* 4 x (** (+ x (* 6 y) 2) 3) z) 'y)
+; '(* 4 (* x (* (* (* 3 (** (+ x (* 6 y) 2) 2)) 6) z)))
+

0 comments on commit 1bc5389

Please sign in to comment.
Something went wrong with that request. Please try again.