diff options
| author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2023-10-11 10:04:04 -0600 |
|---|---|---|
| committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2023-10-11 10:04:04 -0600 |
| commit | 43f06890e2689af2ef54c4480fe5790692a24f65 (patch) | |
| tree | b933f3e05aad81d780c0c94646676efa1bbad22d /src/main.lisp | |
| parent | a74a732b27fb610133190e89a91b2d42d0cf78b3 (diff) | |
| download | math-4610-43f06890e2689af2ef54c4480fe5790692a24f65.tar.gz math-4610-43f06890e2689af2ef54c4480fe5790692a24f65.zip | |
deprecate common lisp solutions and write c; it's too much effort to keep up with the requirements for an archive.
Diffstat (limited to 'src/main.lisp')
| -rw-r--r-- | src/main.lisp | 60 |
1 files changed, 0 insertions, 60 deletions
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))) - |
