From 43f06890e2689af2ef54c4480fe5790692a24f65 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Wed, 11 Oct 2023 10:04:04 -0600 Subject: deprecate common lisp solutions and write c; it's too much effort to keep up with the requirements for an archive. --- src/main.lisp | 60 ----------------------------------------------------------- 1 file changed, 60 deletions(-) delete mode 100644 src/main.lisp (limited to 'src/main.lisp') diff --git a/src/main.lisp b/src/main.lisp deleted file mode 100644 index 7a8b455..0000000 --- a/src/main.lisp +++ /dev/null @@ -1,60 +0,0 @@ -(load "lizfcm.asd") -(ql:quickload :lizfcm) - -;; this is a collection showcasing the library developed for math4610, required -;; from the Shared Library definition - -(defun smaceps () - (cadar (last (lizfcm.approx:compute-maceps - (lambda (x) x) 1.0 1.0)))) - -(defun dmaceps () - (cadar (last (lizfcm.approx:compute-maceps - (lambda (x) x) 1.0d0 1.0d0)))) - -(defun l2-norm (v) - (let ((2-norm (lizfcm.vector:p-norm 2))) - (funcall 2-norm v))) - -(defun l1-norm (v) - (let ((1-norm (lizfcm.vector:p-norm 1))) - (funcall 1-norm v))) - -(defun linf-norm (v) - (lizfcm.vector:max-norm v)) - -(defun l2-distance (v1 v2) - (let ((2-norm (lizfcm.vector:p-norm 2))) - (lizfcm.vector:distance v1 v2 2-norm))) - -(defun l1-distance (v1 v2) - (let ((1-norm (lizfcm.vector:p-norm 1))) - (lizfcm.vector:distance v1 v2 1-norm))) - -(defun linf-distance (v1 v2) - (lizfcm.vector:distance v1 v2 'lizfcm.vector:max-norm)) - -(defun f (x) - (/ (- x 1) (+ x 1))) - -(defun fprime (x) - (/ 2 (expt (+ x 1) 2))) - -(defmacro showcase (s-expr) - `(format t "~a = ~a~%" ,(format nil "~a" s-expr) ,s-expr)) - -(defun main () - (showcase (smaceps)) - (showcase (dmaceps)) - (showcase (l2-norm '(1 2))) - (showcase (l1-norm '(1 2))) - (showcase (linf-norm '(1 2))) - (showcase (l1-distance '(1 2) '(-3 4))) - (showcase (l2-distance '(1 2) '(-3 4))) - (showcase (linf-distance '(1 2) '(-3 4))) - (showcase (lizfcm.vector:least-squares-reg '(1 2 3 4 5 6 7) - '(0.5 3 2 3.5 5 6 7.5))) - (showcase (lizfcm.approx:forward-derivative-at 'f 1 0.00001)) - (showcase (lizfcm.approx:central-derivative-at 'f 1 0.00001)) - (showcase (lizfcm.approx:backward-derivative-at 'f 1 0.00001))) - -- cgit v1.3