From 6bf4b90c90f15f4ab60833bddf5b5756d1a6b1f6 Mon Sep 17 00:00:00 2001 From: Elizabeth Alexander Hunt Date: Thu, 2 Jul 2026 11:55:17 -0700 Subject: Init --- .../math4610/deprecated-cl/approx,derivative.lisp | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Homework/math4610/deprecated-cl/approx,derivative.lisp (limited to 'Homework/math4610/deprecated-cl/approx,derivative.lisp') diff --git a/Homework/math4610/deprecated-cl/approx,derivative.lisp b/Homework/math4610/deprecated-cl/approx,derivative.lisp new file mode 100644 index 0000000..631a5c0 --- /dev/null +++ b/Homework/math4610/deprecated-cl/approx,derivative.lisp @@ -0,0 +1,25 @@ +(in-package :lizfcm.approx) + +(defun central-derivative-at (f x &optional (delta 0.01)) + (let* ((x2 (+ x delta)) + (x1 (- x delta)) + (y2 (apply f (list x2))) + (y1 (apply f (list x1)))) + (/ (- y2 y1) + (- x2 x1)))) + +(defun forward-derivative-at (f x &optional (delta 0.01)) + (let* ((x2 (+ x delta)) + (x1 x) + (y2 (apply f (list x2))) + (y1 (apply f (list x1)))) + (/ (- y2 y1) + (- x2 x1)))) + +(defun backward-derivative-at (f x &optional (delta 0.01)) + (let* ((x2 x) + (x1 (- x delta)) + (y2 (apply f (list x2))) + (y1 (apply f (list x1)))) + (/ (- y2 y1) + (- x2 x1)))) -- cgit v1.3