summaryrefslogtreecommitdiff
path: root/notes
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-10-30 19:07:43 -0600
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-10-30 19:07:43 -0600
commit562ba9a9b6efd8cc27fc506f83b1125c2cfa4619 (patch)
treef801276f9332462084966ee731e2e90c0f180cb2 /notes
parent81979f09cf100db32deb0e1917dabb1fe435194c (diff)
downloadcmath-562ba9a9b6efd8cc27fc506f83b1125c2cfa4619.tar.gz
cmath-562ba9a9b6efd8cc27fc506f83b1125c2cfa4619.zip
hw 5
Diffstat (limited to 'notes')
-rw-r--r--notes/Oct-27.org26
-rw-r--r--notes/Oct-30.org34
2 files changed, 60 insertions, 0 deletions
diff --git a/notes/Oct-27.org b/notes/Oct-27.org
new file mode 100644
index 0000000..6d23576
--- /dev/null
+++ b/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/notes/Oct-30.org b/notes/Oct-30.org
new file mode 100644
index 0000000..7d6ee03
--- /dev/null
+++ b/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