From 6bf4b90c90f15f4ab60833bddf5b5756d1a6b1f6 Mon Sep 17 00:00:00 2001 From: Elizabeth Alexander Hunt Date: Thu, 2 Jul 2026 11:55:17 -0700 Subject: Init --- Homework/math4610/notes/29-Nov.org | 20 ++++++++ Homework/math4610/notes/4-Dec.org | 2 + Homework/math4610/notes/Nov-27.org | 20 ++++++++ Homework/math4610/notes/Nov-3.org | 62 ++++++++++++++++++++++++ Homework/math4610/notes/Nov-6.org | 25 ++++++++++ Homework/math4610/notes/Oct-11.org | 15 ++++++ Homework/math4610/notes/Oct-13.org | 8 ++++ Homework/math4610/notes/Oct-16.org | 77 ++++++++++++++++++++++++++++++ Homework/math4610/notes/Oct-18.org | 18 +++++++ Homework/math4610/notes/Oct-27.org | 26 ++++++++++ Homework/math4610/notes/Oct-30.org | 34 ++++++++++++++ Homework/math4610/notes/Oct-4.org | 22 +++++++++ Homework/math4610/notes/Oct-6.org | 13 +++++ Homework/math4610/notes/Sep-11.org | 94 +++++++++++++++++++++++++++++++++++++ Homework/math4610/notes/Sep-13.org | 16 +++++++ Homework/math4610/notes/Sep-15.org | 52 ++++++++++++++++++++ Homework/math4610/notes/Sep-15.pdf | Bin 0 -> 123321 bytes Homework/math4610/notes/Sep-15.tex | 88 ++++++++++++++++++++++++++++++++++ Homework/math4610/notes/Sep-20.org | 21 +++++++++ Homework/math4610/notes/Sep-22.org | 45 ++++++++++++++++++ Homework/math4610/notes/Sep-25.org | 48 +++++++++++++++++++ 21 files changed, 706 insertions(+) create mode 100644 Homework/math4610/notes/29-Nov.org create mode 100644 Homework/math4610/notes/4-Dec.org create mode 100644 Homework/math4610/notes/Nov-27.org create mode 100644 Homework/math4610/notes/Nov-3.org create mode 100644 Homework/math4610/notes/Nov-6.org create mode 100644 Homework/math4610/notes/Oct-11.org create mode 100644 Homework/math4610/notes/Oct-13.org create mode 100644 Homework/math4610/notes/Oct-16.org create mode 100644 Homework/math4610/notes/Oct-18.org create mode 100644 Homework/math4610/notes/Oct-27.org create mode 100644 Homework/math4610/notes/Oct-30.org create mode 100644 Homework/math4610/notes/Oct-4.org create mode 100644 Homework/math4610/notes/Oct-6.org create mode 100644 Homework/math4610/notes/Sep-11.org create mode 100644 Homework/math4610/notes/Sep-13.org create mode 100644 Homework/math4610/notes/Sep-15.org create mode 100644 Homework/math4610/notes/Sep-15.pdf create mode 100644 Homework/math4610/notes/Sep-15.tex create mode 100644 Homework/math4610/notes/Sep-20.org create mode 100644 Homework/math4610/notes/Sep-22.org create mode 100644 Homework/math4610/notes/Sep-25.org (limited to 'Homework/math4610/notes') diff --git a/Homework/math4610/notes/29-Nov.org b/Homework/math4610/notes/29-Nov.org new file mode 100644 index 0000000..a478ebf --- /dev/null +++ b/Homework/math4610/notes/29-Nov.org @@ -0,0 +1,20 @@ +Jacobi Iteration (cont.) + +x^{k+1} = D^{-1}(b - (L + U)x^k) + +{ + x^{k+1} = x^k + D^-1 r^k + r^{k} = b - Ax^k +} + +error: || x^{k+1} - x^k ||_2 +residual: || r^k ||_2 + +Gauss-Seidel Iteration: +A = (L + D + U) +\Rightarrow Ax = b + (D + U)x = b - Lx + x = (D + U)^-1 (b - Lx) + +x^{k+1} = (D+U)^{-1}(b - Lx^k) +(D + U)^{-1} x (bsubst) diff --git a/Homework/math4610/notes/4-Dec.org b/Homework/math4610/notes/4-Dec.org new file mode 100644 index 0000000..d148bc8 --- /dev/null +++ b/Homework/math4610/notes/4-Dec.org @@ -0,0 +1,2 @@ + + diff --git a/Homework/math4610/notes/Nov-27.org b/Homework/math4610/notes/Nov-27.org new file mode 100644 index 0000000..ae4ded0 --- /dev/null +++ b/Homework/math4610/notes/Nov-27.org @@ -0,0 +1,20 @@ +x^{k+1} = D^{-1}(b - (L + U) x^k) +x^{k + 1} \rightarrow Ax^k + + +#+BEGIN_SRC c + loop while (err > tol && iter < maxiter) { + for (int i = 0; i < n; i++) { + sum = b[i]; + for (int j = 0; j < i; j++) { + sum = sum - a[i][x] * x_0[i]; + } + for (int j = i; j < n; j++) { + sum = sum + a[i][j] * x_0[j]; + } + x_1[i] = sum / a[i][i]; + } + + err = 0.0; + } +#+END_SRC diff --git a/Homework/math4610/notes/Nov-3.org b/Homework/math4610/notes/Nov-3.org new file mode 100644 index 0000000..5a65d2a --- /dev/null +++ b/Homework/math4610/notes/Nov-3.org @@ -0,0 +1,62 @@ +* eigenvalues \rightarrow power method + +we iterate on the x_{k+1} = A x_k + +y = Av_0 +v_1 = \frac{1}{|| y ||} (y) +\lambda_0 = v_0^T A v_0 = v_0^T y + +Find the largest eigenvalue; + +#+BEGIN_SRC c + while (error > tol && iter < max_iter) { + v_1 = (1 / magnitude(y)) * y; + w = m_dot_v(a, v_1); + lambda_1 = v_dot_v(transpose(v_1), w); + error = abs(lambda_1 - lambda_0); + iter++; + lambda_0 = lambda_1; + y = v_1; + } + + return [lambda_1, error]; +#+END_SRC + +Find the smallest eigenvalue: + +** We know: +If \lambda_1 is the largest eigenvalue of $A$ then \frac{1}{\lambda_1} is the smallest eigenvalue of $A^{-1}$. + +If \lambda_n is the smallest eigenvalue of $A$ then \frac{1}{\lambda_n} is the largest eigenvalue of $A^{-1}$. +*** However, calculating $A^{-1}$ is inefficient +So, transform $w = A^{-1} v_1 \Rightarrow$ Solve $Aw = v_1$ with LU or GE (line 3 of above snippet). + +And, transform $y = A^{-1} v_0 \Rightarrow$ Solve $Ay = v_0$ with LU or GE. + +** Conclusions + +We have the means to compute the approximations of \lambda_1 and \lambda_n. + +(\lambda_1 \rightarrow power method) + +(\lambda_n \rightarrow inverse power method) + +* Eigenvalue Shifting + +If (\lambda, v) is an eigen pair, (v \neq 0) + +Av = \lambdav + +Thus for any \mu \in R + +(Av - \mu I v) = (A - \mu I)v = \lambda v - \mu I v + = (\lambda - \mu)v + \Rightarrow \lambda - \mu is an eigenvalue of (A - \mu I) + +(A - \mu I)v = (\lambda - \mu)v + +Idea is to choose \mu close to our eigenvalue. We can then inverse iterate to +construct an approximation of \lambda - \mu and then add \mu back to get \lambda. + +v_0 = a_1 v_1 + a_2 v_2 + \cdots + a_n v_n +A v_0 = a_1 (\lambda_1 v_1) + \cdots diff --git a/Homework/math4610/notes/Nov-6.org b/Homework/math4610/notes/Nov-6.org new file mode 100644 index 0000000..4a9562f --- /dev/null +++ b/Homework/math4610/notes/Nov-6.org @@ -0,0 +1,25 @@ +* Power Method +v_{k+1} = A v_k, k = 0,1,2 + +** Properties +1. \frac{A v_k}{||v_k||} \rightarrow v_1 +2. \frac{v_k^T A v_k}{v_k^T v_k} \rightarrow \lambda_1 +3. If \lambda is a n eigenvalue of A, then \frac{1}{\lambda} is an eigenvalue of A^-1 +4. Av = \lambda v + Av - \mu v = (\lambda-\mu)v = (A - \mu I)v +5. If \lambda is an eigenvalue of A, then \lambda - \mu is an eigenvalue of A \cdot \mu I + +** Shifting Eigenvalues +1. Partition [\lambda_n, \lambda_1] + + +* Lanczos Algorithm + +#+BEGIN_SRC c + for (int i = 0; i < n; i++) { + sum = a0; + v_dot_v(a[i], x); + + b[i] = sum; + } +#+END_SRC diff --git a/Homework/math4610/notes/Oct-11.org b/Homework/math4610/notes/Oct-11.org new file mode 100644 index 0000000..575ea74 --- /dev/null +++ b/Homework/math4610/notes/Oct-11.org @@ -0,0 +1,15 @@ +* Diagonal Dominance +Suppose that A \in R^{n \times n} is diagonally dominant then Gaussian eliminiation of A produces no zero pivot +elements. + +Def. A \in R^{n \times n} is diagonally dominant if for each i=1,2,...n |a_{i,i}| \geq \Sigma_{j=1}^n |a_i,j| + + +* To test solution code: + [[1] + [1] +Set y = [\cdots] \in R^n + [1]] + +Compute b=Ay +Solve Ax=b diff --git a/Homework/math4610/notes/Oct-13.org b/Homework/math4610/notes/Oct-13.org new file mode 100644 index 0000000..853a6d6 --- /dev/null +++ b/Homework/math4610/notes/Oct-13.org @@ -0,0 +1,8 @@ +* Root Finding +Finx x \in R such that f(x) = 0 + +If g(x) is a function and we want to find x such that g(x) is +extremal then we find x \in R such that g'(x) = 0 + + +Hanging Cable Problem y(x) = c_1 cosh(\frac{x- c_2}{c_2}) diff --git a/Homework/math4610/notes/Oct-16.org b/Homework/math4610/notes/Oct-16.org new file mode 100644 index 0000000..1406737 --- /dev/null +++ b/Homework/math4610/notes/Oct-16.org @@ -0,0 +1,77 @@ +Find x \in R st f(x) = 0 + +if f(x^*) = 0 then define x^* = g(x^*) = x^* + f(x^*) + +Suppose we approximate x^* by x_0. Then Using the fixed point equations: + +x_1 = g(x_0) = x_0 + f(x_0) +x_2 = g(g_1) \cdots x_{k+1} = g(x_k) + +This generates a sequence of approximations to x^* + +{X_k} \rightarrow x^* + +The algorithm is: Given f(x), x_0, compute x_{k+1} = g(x_k), k = 0, 1, 2, \cdots += x_k + f(x_k) + +Examples for g(x) + +1. x_{k+1} = x_k + f(x_k) +2. x_{k+1} = x_k - f(x_k) +3. x_{k+1} = x_k - mf(x_k) +4. x_{k+q} = s_k - sin(f(x_k)) + +x^* = root of f +y^* = solution of y^* = g(y^*) + +| x^* - y^* | = x^* - (y^* - f(y^*)) +|x_{k+1} - x^* | = | g(x_k) - g(x^*) | + = |g(x^*) + g'(x^k)(x_k - x^*) + \cdots) - g(x^*)| + = |g'(x^*)(x_k - x^*) + hot| + \leq | g'(x^*)(x_k - x^*)| + (pos val) + \leq |g'(x^*)| (|x_k - x^*|) + +\Rightarrow |x_{k+1} - x^*| \leq |g'(x^*)| \cdot |x_k - x^*| + +For this to converge, we need |g'(x^*)| \lt 1 + +* Example +f(x) = xe^{-x} + +Then x^* = 0 + +If we construct g(x) = 10x + xe^-x + +Then g'(x) = 10 + (e^-x - xe^-x) \Rightarrow g'(x) = 10 + e^0 - 0 = 11 (this wouldn't converge) + +However if g(x)) = x - (xe^-x), g'(x) = 1 - (e^-x - xe^-x) \Rightarrow g'(x^*) = 0 + +Then assume x_0 = 1/10 +Then x_1 = g(x_0) = 1/10 - 1/10(e^{-1/10}) +\cdots + +* More General, Robust Algorithm +** Theorem: Intermediate Value Theorem +Suppose that f(x) is a continuous function on [a, b] then + +\lim_{x -> x_0} (f(x)) = f(x_0) + +For all x_0 \in (a, b) and at the endpoints: + +\lim_{a^+} f(x) = f(a) +\lim_{x -> b^-} f(x) = f(b) + +Then if s is a number between f(a) and f(b), there exists a point c \in (a, b) such that f(c) = s. + +To use this to ensure there is a root, we just take evaluations f(a) and f(b) that cross 0 + +So the condition we construct is: +f(a) \cdot f(b) \lt 0 + +** Next Step: compute the midpoint of [a, b] +c = 1/2 (a + b) + +do binary search on c by taking this midpoint and ensuring f(a) \cdot f(c) \lt 0 or f(c) \cdot f(b) \lt 0 is met, +choosing the correct interval + + diff --git a/Homework/math4610/notes/Oct-18.org b/Homework/math4610/notes/Oct-18.org new file mode 100644 index 0000000..0104164 --- /dev/null +++ b/Homework/math4610/notes/Oct-18.org @@ -0,0 +1,18 @@ +Error Analysis Of Bisection Root Finding: + +e_0 \le b - a = b_0 - a_0 +e_1 \le b_1 - a_1 = 1/2(b_0 - a_0) +e_2 \le b_2 - a_2 = 1/2(b_1 - a_1) = (1/2)^2(b_0 - a_0) +e_k \le b_k - a_k = 1/2(b_{k-1} - a_{k-1}) = \cdots = (1/2)^k (b_0 - a_0) + + +e_k \le (1/2)^k (b_0 - a_0) = tolerance +\Rightarrow log(1/2^k) + log(b_0 - a_0) = log(tolerance) +\Rightarrow k log(1/2) + log(tolerance) - log(b_0 - a_0) +\Rightarrow k log(1/2) = log(tolerance / (b_0 - a_0)) +\Rightarrow k \ge log(tolerance / (b_0 - a_0)) / log(1/2) + +The Bisection Method applied to an interval [a, b] for a continous function will reduce the error +each time through by at least one half. + +| x_{k+1} - x_k | \le 1/2|x_k - x^* | diff --git a/Homework/math4610/notes/Oct-27.org b/Homework/math4610/notes/Oct-27.org new file mode 100644 index 0000000..6d23576 --- /dev/null +++ b/Homework/math4610/notes/Oct-27.org @@ -0,0 +1,26 @@ +Use a bisection criterion for a start + +Hybrid Method: combine Bisection and Higher Order Method: +- Newton's Method +- Secant Method (Newton's method with secant approx.) + + +#+BEGIN_SRC c +fa = f(a) +fb = f(b) +if (fa * fb >= 0) return + +error = 10 * tol +iter = 0 + +while (error > tol && iter < maxiter) { +x0 = 0.5 * (a + b) +x1 = x0 - f(x0) / f'(x0) +if (abs(x1 - x0) > 0.5 * (b - a)) { +// do bisection +} else{ +// do newton's method +} +} +#+END_SRC + diff --git a/Homework/math4610/notes/Oct-30.org b/Homework/math4610/notes/Oct-30.org new file mode 100644 index 0000000..7d6ee03 --- /dev/null +++ b/Homework/math4610/notes/Oct-30.org @@ -0,0 +1,34 @@ +* Power Method for computing the largest eigenvalue of a square matrix + +An eigenvector, v \in R^n is a nonzero vector such that for some number, \lambda \in C, Av = \lambda v +\Rightarrow || v || = 1 + + +Suppose we start with some vector v and assume, v = \alpha_0 v_0 + \alpha_1 v_1 + \cdots + \alpha_n v_n, where {v_1, \cdots, v_n} +are the eigenvectors of A. Assume {v_1, \cdots, v_n} is a basis for R^n + +We can order the eigenvalues such that \lambda_1 \ge \lambda_2 \ge \lambda_3 \ge \cdots \ge \lambda_n + +Compute u = Av += A(\alpha_1 v_1 + \cdots + \alpha_n v_n) += \alpha_1 Av_1 + A(\cdots) + \alpha_n A v_n += \alpha_1 \lambda_1 v_1 + \alpha_2 \lambda_2 v_2 + \cdots + \alpha_n \lambda_n v_n + +w = A (Av) += \alpha_1 \lambda_1^2 v_1 + \alpha_2 \lambda_2^2 v_2 + \cdots + \alpha_n \lambda_n^2 v_n + +Thus, +A^k v = \alpha_1 \lambda_1^k v_1 + \alpha_2 \lambda_2^k v_2 + \cdots + \alpha_n \lambda_n^k v_n += \lambda_1^k ( \alpha_1 v_1 + \alpha_2 \frac{\lambda_2^k}{\lambda_1^k} v_2 + \cdots + \alpha_n \frac{\lambda_3^k}{\lambda_1^k} v_n) + +As k \rightarrow \infty +A^k v = \lambda_1^k (\alpha_1 v_1) + \text{negligble terms} + +Algorithm: +v \ne 0 with v \in R^n +y = Av = \alpha_1 v_1 + \cdots + \alpha_n v_n + +w = \frac{1}{||y||} \cdot y + +Rayleigh Quotient: +If $v$ is an eigenvector of A with eigenvalue \lambda then \frac{v^T A v}{v^T v} = \lambda diff --git a/Homework/math4610/notes/Oct-4.org b/Homework/math4610/notes/Oct-4.org new file mode 100644 index 0000000..8b8466f --- /dev/null +++ b/Homework/math4610/notes/Oct-4.org @@ -0,0 +1,22 @@ +[[ a_{11} a_{12} \cdots a_{1n} | b_1] + [ 0 (a_{22} - \frac{a_{}_{21}}{a_{22}}a_{11}) \cdots a_{2n} | b_2 - \frac{a_{21}}{a_{11}}b_1 ]] + +#+BEGIN_SRC c + for (int i = 1; i < n; i++) { + float factor = -a[i][0] / a[0][0]; + for (int j = 1; j < n; j++) { + a[i][j] = a[i][j] + factor * a[0][j]; + } + b[i] = b[i] + factor * b[0]; + } + + for (int k = 0; k < (n - 1); k++) { + for (int i = k+1; i < n; i++) { + float factor = -a[i][k] / a[k][k]; + for (int j = k+1; j < n; j++) { + a[i][j] = a[i][j] + factor * a[j][k]; + } + b[i] = b[i] + factor*b[k]; + } + } +#+END_SRC diff --git a/Homework/math4610/notes/Oct-6.org b/Homework/math4610/notes/Oct-6.org new file mode 100644 index 0000000..8cbff29 --- /dev/null +++ b/Homework/math4610/notes/Oct-6.org @@ -0,0 +1,13 @@ +#+BEGIN_SRC c + for (int k = 0; i < (n - 1); k++) { + for (int i = k+1; i< n; i++) { + float factor = a[i][k] / a[k][k]; + for (int j = k+1; j < k; j++) { + a[i][j] = a[i][j] - factor * a[k][j]; + } + b[i] = b[i] - factor * b[k]; + } + } +#+END_SRC + + diff --git a/Homework/math4610/notes/Sep-11.org b/Homework/math4610/notes/Sep-11.org new file mode 100644 index 0000000..3d71f2f --- /dev/null +++ b/Homework/math4610/notes/Sep-11.org @@ -0,0 +1,94 @@ +#+TITLE: Errors +#+AUTHOR: Elizabeth Hunt +#+STARTUP: entitiespretty fold inlineimages +#+LATEX_HEADER: \notindent \notag \usepackage{amsmath} \usepackage[a4paper,margin=1in,landscape]{geometry} +#+LATEX: \setlength\parindent{0pt} +#+OPTIONS: toc:nil + +* Errors +$x,y \in \mathds{R}$, using y as a way to approximate x. Then the +absolute error of in approximating x w/ y is $e_{abs}(x, y) = |x-y|$. + +and the relative error is $e_{rel}(x, y) = \frac{|x-y|}{|x|}$ + +Table of Errors + +#+BEGIN_SRC lisp :results table + (load "../cl/lizfcm.asd") + (ql:quickload 'lizfcm) + + (defun eabs (x y) (abs (- x y))) + (defun erel (x y) (/ (abs (- x y)) (abs x))) + + (defparameter *u-v* '( + (1 0.99) + (1 1.01) + (-1.5 -1.2) + (100 99.9) + (100 99) + )) + + (lizfcm.utils:table (:headers '("u" "v" "e_{abs}" "e_{rel}") + :domain-order (u v) + :domain-values *u-v*) + (eabs u v) + (erel u v)) +#+END_SRC + +#+RESULTS: +| u | v | e_{abs} | e_{rel} | +| 1 | 0.99 | 0.00999999 | 0.00999999 | +| 1 | 1.01 | 0.00999999 | 0.00999999 | +| -1.5 | -1.2 | 0.29999995 | 0.19999997 | +| 100 | 99.9 | 0.099998474 | 0.0009999848 | +| 100 | 99 | 1 | 1/100 | + + +Look at $u \approx 0$ then $v \approx 0$, $e_{abs}$ is better error since $e_{rel}$ is high. + +* Vector spaces & measures +Suppose we want solutions fo a linear system of the form $Ax = b$, and we want to approximate $x$, +we need to find a form of "distance" between vectors in $\mathds{R}^n$ + +** Vector Distances +A norm on a vector space $|| v ||$ is a function from $\mathds{R}^n$ such that: + +1. $||v|| \geq 0$ for all $v \in \mathds{R}^n$ and $||v|| = \Leftrightarrow v = 0$ +2. $||cv|| = |c| ||v||$ for all $c \in \mathds{R}, v \in \mathds{R}^n$ +3. $||x + y|| \leq ||x|| + ||y|| \forall x,y \in \mathds{R}^n$ + +*** Example norms: +$||v||_2 = || [v_1, v_2, \dots v_n] || = (v_1^2 + v_2^2 + \dots + v_n^2)^{}^{\frac{1}{2}}$ + +$||v||_1 = |v_1| + |v_2| + \dots + |v_n|$ + +$||v||_{\infty} = \text{max}(|v_i|)$ (most restriction) + +p-norm: +$||v||_p = \sum_{i=1}^{h} (|v_i|^p)^{\frac{1}{p}}$ + +** Length +The length of a vector in a given norm is $||v|| \forall v \in \mathds{R}^n$ + +All norms on finite dimensional vectors are equivalent. Then exist constants +$\alpha, \beta > 0 \ni \alpha ||v||_p \leq ||v||_q \leq \beta||v||_p$ + +** Distance +Let $u,v$ be vectors in $\mathds{R}^n$ then the distance is $||u - v||$ by some norm: +$e_{abs} = d(v, u) = ||u - v||$ + +The relative errors is: + +$e_{rel} = \frac{||u - v||}{||v||}$ + + +** Approxmiating Solutions to $Ax = b$ +We define the residual vector $r(x) = b - Ax$ + +If $x$ is the exact solution, then $r(x) = 0$. + +Then we can measure the "correctness" of the approximated solution on the norm of the +residual. We want to minimize the norm. + +But, $r(y) = b - Ay \approx 0 \nRightarrow y \equiv x$, if $A$ is not invertible. + diff --git a/Homework/math4610/notes/Sep-13.org b/Homework/math4610/notes/Sep-13.org new file mode 100644 index 0000000..0ebff2b --- /dev/null +++ b/Homework/math4610/notes/Sep-13.org @@ -0,0 +1,16 @@ +* Homework 2 +1. maceps - single precision + +2. maceps - double precision + +3. 2-norm of a vector + +4. 1-norm of a vector + +5. infinity-norm of a vector (max-norm) + +6. 2-norm distance between 2 vectors + +7. 1-norm distance between 2 vectors + +8. infinity-norm distance diff --git a/Homework/math4610/notes/Sep-15.org b/Homework/math4610/notes/Sep-15.org new file mode 100644 index 0000000..8a64089 --- /dev/null +++ b/Homework/math4610/notes/Sep-15.org @@ -0,0 +1,52 @@ +* Taylor Series Approx. +Suppose f has $\infty$ many derivatives near a point a. Then the taylor series is given by + +$f(x) = \Sigma_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}(x-a)^n$ + +For increment notation we can write + +$f(a + h) = f(a) + f'(a)(a+h - a) + \dots$ + +$= \Sigma_{n=0}^{\infty} \frac{f^{(n)}(a)}{h!} (h^n)$ + +Consider the approximation + +$e = |f'(a) - \frac{f(a + h) - f(a)}{h}| = |f'(a) - \frac{1}{h}(f(a + h) - f(a))|$ + +Substituting... + +$= |f'(a) - \frac{1}{h}((f(a) + f'(a) h + \frac{f''(a)}{2} h^2 + \cdots) - f(a))|$ + +$f(a) - f(a) = 0$... and $distribute the h$ + +$= |-1/2 f''(a) h + \frac{1}{6}f'''(a)h^2 \cdots|$ + +** With Remainder +We can determine for some u $f(a + h) = f(a) + f'(a)h + \frac{1}{2}f''(u)h^2$ + +and so the error is $e = |f'(a) - \frac{f(a + h) - f(a)}{h}| = |\frac{h}{2}f''(u)|$ + +- [https://openstax.org/books/calculus-volume-2/pages/6-3-taylor-and-maclaurin-series] + + > Taylor's Theorem w/ Remainder + + +** Of Deriviatives + +Again, $f'(a) \approx \frac{f(a+h) - f(a)}{h}$, + +$e = |\frac{1}{2} f''(a) + \frac{1}{3!}h^2 f'''(a) + \cdots$ + +$R_2 = \frac{h}{2} f''(\xi)$ + +$|\frac{h}{2} f''(\xi)| \leq M h^1$ + +$M = \frac{1}{2}|f'(\xi)|$ + +*** Another approximation + +$\text{err} = |f'(a) - \frac{f(a) - f(a - h)}{h}|$ + +$= f'(a) - \frac{1}{h}(f(a) - (f(a) + f'(a)(a - (a - h)) + \frac{1}{2}f''(a)(a-(a-h))^2 + \cdots))$ + +$= |f'(a) - (f'(a) + \frac{1}{2}f''(a)h)|$ + diff --git a/Homework/math4610/notes/Sep-15.pdf b/Homework/math4610/notes/Sep-15.pdf new file mode 100644 index 0000000..43a4f34 Binary files /dev/null and b/Homework/math4610/notes/Sep-15.pdf differ diff --git a/Homework/math4610/notes/Sep-15.tex b/Homework/math4610/notes/Sep-15.tex new file mode 100644 index 0000000..52610ed --- /dev/null +++ b/Homework/math4610/notes/Sep-15.tex @@ -0,0 +1,88 @@ +% Created 2023-09-29 Fri 10:00 +% Intended LaTeX compiler: pdflatex +\documentclass[11pt]{article} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{graphicx} +\usepackage{longtable} +\usepackage{wrapfig} +\usepackage{rotating} +\usepackage[normalem]{ulem} +\usepackage{amsmath} +\usepackage{amssymb} +\usepackage{capt-of} +\usepackage{hyperref} +\author{Elizabeth Hunt} +\date{\today} +\title{} +\hypersetup{ + pdfauthor={Elizabeth Hunt}, + pdftitle={}, + pdfkeywords={}, + pdfsubject={}, + pdfcreator={Emacs 28.2 (Org mode 9.7-pre)}, + pdflang={English}} +\begin{document} + +\tableofcontents + +\section{Taylor Series Approx.} +\label{sec:orgcc72ed1} +Suppose f has \(\infty\) many derivatives near a point a. Then the taylor series is given by + +\(f(x) = \Sigma_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}(x-a)^n\) + +For increment notation we can write + +\(f(a + h) = f(a) + f'(a)(a+h - a) + \dots\) + +\(= \Sigma_{n=0}^{\infty} \frac{f^{(n)}(a)}{h!} (h^n)\) + +Consider the approximation + +\(e = |f'(a) - \frac{f(a + h) - f(a)}{h}| = |f'(a) - \frac{1}{h}(f(a + h) - f(a))|\) + +Substituting\ldots{} + +\(= |f'(a) - \frac{1}{h}((f(a) + f'(a) h + \frac{f''(a)}{2} h^2 + \cdots) - f(a))|\) + +\(f(a) - f(a) = 0\)\ldots{} and \(distribute the h\) + +\(= |-1/2 f''(a) h + \frac{1}{6}f'''(a)h^2 \cdots|\) + +\subsection{With Remainder} +\label{sec:org7dfd6c7} +We can determine for some u \(f(a + h) = f(a) + f'(a)h + \frac{1}{2}f''(u)h^2\) + +and so the error is \(e = |f'(a) - \frac{f(a + h) - f(a)}{h}| = |\frac{h}{2}f''(u)|\) + +\begin{itemize} +\item\relax [\url{https://openstax.org/books/calculus-volume-2/pages/6-3-taylor-and-maclaurin-series}] +\begin{itemize} +\item > Taylor's Theorem w/ Remainder +\end{itemize} +\end{itemize} + + +\subsection{Of Deriviatives} +\label{sec:org1ec7c9b} + +Again, \(f'(a) \approx \frac{f(a+h) - f(a)}{h}\), + +\(e = |\frac{1}{2} f''(a) + \frac{1}{3!}h^2 f'''(a) + \cdots\) + +\(R_2 = \frac{h}{2} f''(u)\) + +\(|\frac{h}{2} f''(u)| \leq M h^1\) + +\(M = \frac{1}{2}|f'(u)|\) + +\subsubsection{Another approximation} +\label{sec:org16193b9} + +\(\text{err} = |f'(a) - \frac{f(a) - f(a - h)}{h}|\) + +\(= f'(a) - \frac{1}{h}(f(a) - (f(a) + f'(a)(a - (a - h)) + \frac{1}{2}f''(a)(a-(a-h))^2 + \cdots))\) + +\(= |f'(a) - \frac{1}{h}(f'(a) + \frac{1}{2}f''(a)h)|\) +\end{document} \ No newline at end of file diff --git a/Homework/math4610/notes/Sep-20.org b/Homework/math4610/notes/Sep-20.org new file mode 100644 index 0000000..ba067bb --- /dev/null +++ b/Homework/math4610/notes/Sep-20.org @@ -0,0 +1,21 @@ +* Review & Summary +Approx f'(a) with + ++ forward difference $f'(a) \approx \frac{f(a+h) - f(a)}{h}$ + ++ backward difference $f'(a) \approx \frac{f(a) - f(a-h)}{h}$ + ++ central difference $f'(a) \approx \frac{f(a+h) - f(a-h)}{2h}$ + +** Taylor Series +given $C = \frac{1}{2}(|f''(\xi)|) \cdot h^1$ + +with f.d. $e_{\text{abs}} \leq Ch^1$ + +b.d. $e_{\text{abs}} \leq Ch^1$ + +c.d. $e_{\text{abs}} \leq Ch^2$ + +$e_{\text{abs}} \leq Ch^r$ + +$log(e(h)) \leq log(ch^r) = log(C) + log(h^r) = log(C) + rlog(h)$ diff --git a/Homework/math4610/notes/Sep-22.org b/Homework/math4610/notes/Sep-22.org new file mode 100644 index 0000000..b631e3b --- /dev/null +++ b/Homework/math4610/notes/Sep-22.org @@ -0,0 +1,45 @@ +* regression +consider the generic problem of fitting a dataset to a linear polynomial + +given discrete f: x \rightarrow y + +interpolation: y = a + bx + +[[1 x_0] [[y_0] + [1 x_1] \cdot [[a] = [y_1] + [1 x_n]] [b]] [y_n]] + +consider p \in col(A) + +then y = p + q for some q \cdot p = 0 + +then we can generate n \in col(A) by $Az$ and n must be orthogonal to q as well + +(Az)^T \cdot q = 0 = (Az)^T (y - p) + +0 = (z^T A^T)(y - Ax) + = z^T (A^T y - A^T A x) + = A^T Ax + = A^T y + + +A^T A = [[n+1 \Sigma_{n=0}^n x_n] + [\Sigma_{n=0}^n x_n \Sigma_{n=0}^n x_n^2]] + +A^T y = [[\Sigma_{n=0}^n y_n] + [\Sigma_{n=0}^n x_n y_n]] + +a_11 = n+1 +a_12 = \Sigma_{n=0}^n x_n +a_21 = a_12 +a_22 = \Sigma_{n=0}^n x_n^2 +b_1 = \Sigma_{n=0}^n y_n +b_2 = \Sigma_{n=0}^n x_n y_n + +then apply this with: + +log(e(h)) \leq log(C) + rlog(h) + +* homework 3: + +two columns \Rightarrow coefficients for linear regression diff --git a/Homework/math4610/notes/Sep-25.org b/Homework/math4610/notes/Sep-25.org new file mode 100644 index 0000000..b2d63e3 --- /dev/null +++ b/Homework/math4610/notes/Sep-25.org @@ -0,0 +1,48 @@ +ex: erfc(x) = \int_{0}^x (\frac{2}{\sqrt{pi}})e^{-t^2 }dt +ex: IVP \frac{dP}{dt} = \alpha P - \beta P^2 + P(0) = P_0 + +Explicit Euler Method + +$\frac{P(t + \Delta t) - P(t)}{\Delta t} \approx \alpha P(t) - \beta P^2(t)$ + +From 0 \rightarrow T +P(T) \approx n steps + +* Steps +** Calculus: defference quotient +$f'(a) \approx \frac{f(a+h) - f(a)}{h}$ + +** Test. +Roundoff for h \approx 0 + +** Calculus: Taylor Serioes w/ Remainder +$e_{abs}(h) \leq Ch^r$ + +(see Sep-20 . Taylor Series) + +* Pseudo Code +#+BEGIN_SRC python + for i in range(n): + a12 = a12 + x[i+1] + a22 = a22 + x[i+1]**2 + a21 = a12 + b1 = y[0] + b2 = y[0] * x[0] + for i in range(n): + b1 = b1 + y[i+1] + b2 = b2 + y[i+1]*x[i+1] + detA = a22*a11 - a12*a21 + c = (a22*b1 - a12*b2) / detA + d = (-a21 * b1 + a11 * b2) / detA + + return (c, d) +#+END_SRC + +* Error +We want +$e_k = |df(h_kk) - f'(a)|$ + +$= |df(h_k) - df(h_m) + df(h_m) - f'(a)|$ + +$\leq |df(h_k) - df(h_m)| + |df(h_m) - f'(a)|$ and $|df(h_m) - f'(a)|$ is negligible -- cgit v1.3