summaryrefslogtreecommitdiff
path: root/homeworks/hw-2.tex
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-09-27 10:10:33 -0600
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-09-27 10:10:33 -0600
commitb35e3998333e8190bf07ade51dba30773b3a3d0b (patch)
treebded796a9cc809073a90b170d420e93f5377f2b7 /homeworks/hw-2.tex
parent4584437d432a0fdd787f376273d948ca3f9fcea0 (diff)
downloadcmath-b35e3998333e8190bf07ade51dba30773b3a3d0b.tar.gz
cmath-b35e3998333e8190bf07ade51dba30773b3a3d0b.zip
fix bug in which err = 0
Diffstat (limited to 'homeworks/hw-2.tex')
-rw-r--r--homeworks/hw-2.tex37
1 files changed, 19 insertions, 18 deletions
diff --git a/homeworks/hw-2.tex b/homeworks/hw-2.tex
index 5155448..e0aa172 100644
--- a/homeworks/hw-2.tex
+++ b/homeworks/hw-2.tex
@@ -1,4 +1,4 @@
-% Created 2023-09-25 Mon 09:52
+% Created 2023-09-27 Wed 10:09
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
@@ -29,15 +29,16 @@
\setlength\parindent{0pt}
\section{Question One}
-\label{sec:orga203815}
+\label{sec:orga21c813}
Computing \(\epsilon_{\text{mac}}\) for single precision numbers
\begin{verbatim}
-(load "../cl/lizfcm.asd")
+(load "../lizfcm.asd")
(ql:quickload :lizfcm)
-(let ((domain-values (lizfcm.approx:compute-maceps 1.0
- (lambda (x) x))))
+(let ((domain-values (lizfcm.approx:compute-maceps (lambda (x) x)
+ 1.0
+ 1.0)))
(lizfcm.utils:table (:headers '("a" "h" "err")
:domain-order (a h err)
:domain-values domain-values)))
@@ -52,24 +53,25 @@ a & h & err\\[0pt]
1.0 & 0.25 & 0.25\\[0pt]
1.0 & 0.125 & 0.125\\[0pt]
1.0 & 0.0625 & 0.0625\\[0pt]
+1.0 & 0.03125 & 0.03125\\[0pt]
1.0 & 1.9073486e-06 & 1.9073486e-06\\[0pt]
1.0 & 9.536743e-07 & 9.536743e-07\\[0pt]
1.0 & 4.7683716e-07 & 4.7683716e-07\\[0pt]
1.0 & 2.3841858e-07 & 2.3841858e-07\\[0pt]
1.0 & 1.1920929e-07 & 1.1920929e-07\\[0pt]
-1.0 & 5.9604645e-08 & 0.0\\[0pt]
\end{tabular}
\end{center}
-\(\epsilon_{\text{mac}}\) \(\approx\) 5.9604 \(\cdot\) 10\textsuperscript{-8}
+\(\epsilon_{\text{mac single precision}}\) \(\approx\) 1.192(10\textsuperscript{-7})
\section{Question Two}
-\label{sec:orgdd79be1}
+\label{sec:org06c4a23}
Computing \(\epsilon_{\text{mac}}\) for double precision numbers:
\begin{verbatim}
-(let ((domain-values (lizfcm.approx:compute-maceps 1.0d0
- (lambda (x) x))))
+(let ((domain-values (lizfcm.approx:compute-maceps (lambda (x) x)
+ 1.0d0
+ 1.0d0)))
(lizfcm.utils:table (:headers '("a" "h" "err")
:domain-order (a h err)
:domain-values domain-values)))
@@ -94,14 +96,13 @@ a & h & err\\[0pt]
1.0d0 & 8.881784197001252d-16 & 8.881784197001252d-16\\[0pt]
1.0d0 & 4.440892098500626d-16 & 4.440892098500626d-16\\[0pt]
1.0d0 & 2.220446049250313d-16 & 2.220446049250313d-16\\[0pt]
-1.0d0 & 1.1102230246251565d-16 & 0.0d0\\[0pt]
\end{tabular}
\end{center}
-Thus, \(\epsilon_{\text{mac}}\) \(\approx\) 1.1102 \(\cdot\) 10\textsuperscript{-16}
+Thus, \(\epsilon_{\text{mac double precision}}\) \(\approx\) 2.220 \(\cdot\) 10\textsuperscript{-16}
\section{Question Three - |v|\textsubscript{2}}
-\label{sec:org04608d9}
+\label{sec:orgf181ba7}
\begin{verbatim}
(let ((vs '((1 1) (2 3) (4 5) (-1 2)))
(2-norm (lizfcm.vector:p-norm 2)))
@@ -123,7 +124,7 @@ x & y & 2norm\\[0pt]
\end{center}
\section{Question Four - |v|\textsubscript{1}}
-\label{sec:orgfb57f3a}
+\label{sec:org2196087}
\begin{verbatim}
(let ((vs '((1 1) (2 3) (4 5) (-1 2)))
(1-norm (lizfcm.vector:p-norm 1)))
@@ -145,7 +146,7 @@ x & y & 1norm\\[0pt]
\end{center}
\section{Question Five - |v|\textsubscript{\(\infty\)}}
-\label{sec:org7bbdf04}
+\label{sec:org11b8894}
\begin{verbatim}
(let ((vs '((1 1) (2 3) (4 5) (-1 2))))
(lizfcm.utils:table (:headers '("x" "y" "max-norm")
@@ -166,7 +167,7 @@ x & y & infty-norm\\[0pt]
\end{center}
\section{Question Six - ||v - u|| via |v|\textsubscript{2}}
-\label{sec:orge36996c}
+\label{sec:orga2324b2}
\begin{verbatim}
(let* ((vs '((1 1) (2 3) (4 5) (-1 2)))
(vs2 '((7 9) (2 2) (8 -1) (4 4)))
@@ -192,7 +193,7 @@ v1 & v2 & 2-norm\\[0pt]
\end{center}
\section{Question Seven - ||v - u|| via |v|\textsubscript{1}}
-\label{sec:orgd1577f0}
+\label{sec:org388fbc7}
\begin{verbatim}
(let* ((vs '((1 1) (2 3) (4 5) (-1 2)))
(vs2 '((7 9) (2 2) (8 -1) (4 4)))
@@ -218,7 +219,7 @@ v1 & v2 & 1-norm-d\\[0pt]
\end{center}
\section{Question Eight - ||v - u|| via |v|\textsubscript{\(\infty\)}}
-\label{sec:org2661676}
+\label{sec:org6e77f76}
\begin{verbatim}
(let* ((vs '((1 1) (2 3) (4 5) (-1 2)))
(vs2 '((7 9) (2 2) (8 -1) (4 4))))