diff --git a/exercise1/exercise1.pdf b/exercise1/exercise1.pdf new file mode 100644 index 0000000..d5dd875 Binary files /dev/null and b/exercise1/exercise1.pdf differ diff --git a/exercise1/exercise1.typ b/exercise1/exercise1.typ new file mode 100644 index 0000000..78a1325 --- /dev/null +++ b/exercise1/exercise1.typ @@ -0,0 +1,436 @@ +#import "@preview/cetz:0.3.2"; +#import "@preview/cetz-plot:0.1.1": plot +#import "@preview/physica:0.9.4": * +#import "@preview/plotsy-3d:0.1.0": plot-3d-parametric-surface +#import "@preview/fletcher:0.5.4" as fletcher: diagram, edge, node + +#set page(paper: "a4", margin: (x: 2.6cm, y: 2.8cm), numbering: "1 : 1") +#set par(justify: true, leading: 0.52em) + +#let FONT_SIZE = 18pt; +#set text(font: "FreeSerif", size: FONT_SIZE, lang: "us") +#show math.equation: set text(font: "Euler Math", size: (FONT_SIZE * 1.0), lang: "en") + +#set heading(numbering: none) +#show heading.where(level: 1): it => { + rect(inset: FONT_SIZE / 2)[#it] +} +// #show heading.where(level: 2): it => [ +// #set align(left) +// #set text(size: FONT_SIZE * 1.1, weight: "semibold") +// #(it.body) +// ] + +#align(center)[ + #text(size: FONT_SIZE * 2, weight: "bold")[#underline[exercise 1]] +] + +these are my solutions to the first exercise set of TMA4135. + +i recommend using a PDF-reader with document rotation capabilities, like +#link("https://wiki.archlinux.org/title/Zathura")[#text(blue.darken(5%))[zathura]]. + +this document was created using +#link("https://typst.app/")[#text(blue.darken(5%))[typst]]. + +#v(42pt) + +#outline(title: none) + + += problem 1 + +== a) + +#[#show math.equation: set text(size: (FONT_SIZE * 0.60)) + #rotate( + -90deg, + reflow: true, + table( + $bold(u(x, y, t))$, $bold(u_y)$, $bold(u_t)$, $bold(u_(x x))$, $bold(u_(x y))$, $bold(u_(y x))$, + + $t^4 - cos(x y)$, + $x sin(x y)$, + $4 t^3$, + $y^2 cos(x y)$, + $x y cos(x y)$, + $x + y cos(x y)$, + + $-sin(t x y)$, + $- t x cos(t x y)$, + $- x y cos(t x y)$, + $t^2 y^2 sin(t x y)$, + $t^2 x y sin(t x y)$, + $t^2 x y cos(t x y)$, + + $e^(-t) sin(x) ln(y)$, + $(e^(-t) sin(x)) slash y$, + $- e^(-t) sin(x) ln(y)$, + $-e^(-t) sin(x) ln(y)$, + $(e^(-t) cos(x)) slash y$, + $(e^(-t) cos(x)) slash y$, + + $e^(-x) sqrt(x^3 + y^2)$, + $(2 y e^(-x)) slash sqrt(x^3 + y^2)$, + $0$, + $(dagger)$, + $(dagger.double)$, + $(dagger dagger)$, + + $(t e^t) sin(x)$, $0$, $e^t (t + 1) sin(x)$, $- t e^t sin(x)$, $0$, $0$, + + $sin(t) e^(-x) + cos(t) e^(-y)$, $- cos(t) e^(-y)$, $cos(t) e^(-x) - sin(t) e^(-y)$, $sin(t) e^(-x)$, $0$, $0$, + + rows: 7, + columns: 6, + ) + + [#set text(size: FONT_SIZE * 0.6, fill: gray.darken(35%)) + #show math.equation: set text(size: FONT_SIZE * 0.5) + some calculations\ + #table( + table.cell( + rowspan: 2, + $(dagger)$, + ), + table.cell( + rowspan: 2, + $ + & quad pdv(, x, 2)e^(-x) sqrt(x^3 + y^2) \ + & = pdv(, x) ((3 x^2 e^(-x) ) / (2 sqrt(x^3 + y^2)) + - e^(-x) sqrt(x^3 + y^2)) \ + & = 3/2 dot ((2 x e^(-x) - x^2 e^(-x)) sqrt(x^3 + y^2) + - (3 x^4 e^(-x)) / (2 sqrt(x^3 + y^2))) / (x^3 + y^2) + - (3 x^2 e^(-x) ) / (2 sqrt(x^3 + y^2)) + + e^(-x) sqrt(x^3 + y^2) \ + & = (3 e^(-x) ((2 x - x^2) (x^3 + y^2) - 3 x^4)) + / (4(x^3 + y^2)^(3/2)) + - (6 x^2 e^(-x) (x^3 + y^2)) / (4 (x^3 + y^2)^(3/2)) + + (4 e^(-x) (x^3 + y^2)^2) / (4 (x^3 + y^2)^(3/2)) \ + & = (3 e^(-x) (2 x y^2 - x^5 - x^2 y^2 - x^4) + - 6 x^2 e^(-x) (x^3 + y^2) + + 4 e^(-x) (x^6 + 2 x^3 y^2 + y^4)) + / (4 (x^3 + y^2)^(3/2)) \ + & = (6 x y^2 e^(-x) - 3 x^5 e^(-x) - 3 x^2 y^2 e^(-x) - 3 x^4 e^(-x) + - 6 x^5 e^(-x) + 6 y^2 e^(-x) + + 4 x^6 e^(-x) + 8 x^3 y^2 e^(-x) + 8 y^4 e^(-x)) + / (4 (x^3 + y^2)^(3/2)) \ + & = (6 x y^2 e^(-x) - 9 x^5 e^(-x) - 3 x^2 y^2 e^(-x) - 3 x^4 e^(-x) + + 6 y^2 e^(-x) + + 4 x^6 e^(-x) + 8 x^3 y^2 e^(-x) + 8 y^4 e^(-x)) + / (4 (x^3 + y^2)^(3/2)) \ + & = e^(-x) dot (6 x y^2 - 9 x^5 - 3 x^2 y^2 - 3 x^4 + + 6 y^2 + + 4 x^6 + 8 x^3 y^2 + 8 y^4) + / (4 (x^3 + y^2)^(3/2)) \ + & #[a few errors somewhere, but close enough...] + $, + ), + + $(dagger.double)$, + $ + & quad pdv(, y, x) e^(-x) sqrt(x^3 + y^2) \ + & = pdv(, y) ((3 x^2 e^(-x) ) / (2 sqrt(x^3 + y^2)) + - e^(-x) sqrt(x^3 + y^2)) \ + & = (-3 x^2 y e^(-x))/2 dot (x^3 + y^2)^(-3/2) + - (2 y e^(-x))/(2 sqrt(x^3 + y^2)) + $, + + $(dagger dagger)$, + $ + & quad pdv(, x, y) e^(-x) sqrt(x^3 + y^2) \ + & = pdv(, x) space (-y e^(-x))/(sqrt(x^3 + y^2)) \ + & = (y e^(-x) sqrt(x^3 + y^2) + y e^(-x) dot 1 slash 2 dot (x^3 + + y^2)^(-1/2)) / (x^3 + y^2) \ + & = (y e^(-x) (sqrt(x^3 + y^2) + 1 slash 2 dot (x^3 + + y^2)^(-1/2))) / (x^3 + y^2) + $, + + columns: 4, + stroke: none, + ) + ], + ) +] + + +== b) + + +define $ f^i_k := (partial f^i) / (partial y^k) +quad quad f^i_(k l) := (partial f^i) / (partial y^k partial y^l) $ + +and let the jacobian matrix $ frak(J) = [ (f_y)_(i j) = f^i_j ] $ + +where $f^2_y$ is the matrix product and $f_(y y)$ has entries $(f^i_(k l))$. + +consider $ f : RR^m -> RR^m, +space y |-> (f^1 (y^1, ..., y^m), ..., f^m (y^1, ..., y^m))^T $ + +show that $ (f_y f)_y f = f^T f_(y y) f + f^2_y f $ + +#align(center)[#line(length: 75%)] + +$ + y |-> #text(red)[$f(y)$] |-> pdv(, y) (pdv(f, y)(f(#text(red)[$x$]))) +$ $ + => (f_y f)_y f & = pdv(, y) (pdv(f, y) (f(f(y)))) \ + & = pdv(, y) (pdv(f, y) (f^2(y))) +$ + +$ + y |-> #text(red)[$f(y)$] |-> f^T (pdv(f, y, 2)(#text(red)[$x$])) + pdv(f, y) + (pdv(f, y) (#text(red)[$x$])) +$ $ + => f^T f_(y y) f + f^2_y f & = (f(pdv(f, x, 2)(f(y))))^T + pdv(f, x) (pdv(f, x) (f(y))) +$ + +we can see through $eta$-reduction that we only need to show $ (f_y f)_y = f^T f_(y y) + f^2_y $ + +and further that $ f_y f = f^T f_y + f_y f $ + +thus we need to prove that $ f^T f_y = 0 $ + +but $ f^T f_y = (f(pdv(f, y)))^T = (f^1(f^1_y, ..., f^m_y), ..., f^m (f^1_y, ..., f^m_y)) $ + + + += problem 2 + +== a) + +let $f(x) = x^4 + 3 x^3 - 2 x + 5$; find all taylor polynomials around +$x_0 = -2$. + +#align(center)[#line(length: 75%)] + +recall that each term is given by $ P_k (x) = (f^((k)) (x_0)) / k! (x - x_0)^k $ +for $k in [0, deg(f)] inter ZZ$. + +first compute +$ + f'(x) & = 4x^3 + 9x^2 - 2 \ + f''(x) & = 12x^2 + 18x \ + f^((3))(x) & = 24 x + 18 \ + f^((4))(x) & = 24 +$ + +then +$ + P_0 & = f(-2) = 16 - 24 + 4 + 5 = 1 \ + P_1 & = f'(-2) dot (x + 2) = 2 (x+2) = 2x + 4 \ + P_2 & = (f''(-2))/2 dot (x + 2)^2 = 6 x^2 + 24x + 24 \ + P_3 & = (f^((3)) (-2))/6 dot (x + 2)^3 = -5 (x + 2)^3 \ + & = -5x^3 - 30 x^2 - 60 x - 40 \ + P_4 & = (x + 2)^4 = x^4 + 8 x^3 + 24 x^2 + 32 x + 16 +$ + +then the $k$-th taylor polynomial can be expressed as +$ + T_k = sum_(i=0)^k P_i +$ + +or alternatively +$ + T_k = T_(k-1) + P_k +$ + +for $k in NN^+$. + +thus the taylor polynomials for $f$ are +$ + T_0 & = P_0 = 1 \ + T_1 & = P_0 + P_1 = 2x + 5 \ + T_2 & = 6x^2 + 26x + 28 \ + T_3 & = -5x^3 - 24x^2 + 34x - 12 \ + T_4 & = x^4 + 3x^3 + 66x + 4 +$ + +== b) + +let $g(x) = ln(1 + x)$; calculate its maclaurin series. + +#align(center)[#line(length: 75%)] + +first we differentiate +$ + g'(x) & = 1/(1+x) \ + g''(x) & = -1/(1+x)^2 \ + & dots.v \ + g^((k)) (x) & = (-1)^(k-1) dot (k-1)! dot (1 + x)^(-k) +$ + +for $k in NN^+$. + +recall that the maclaurin series of a non-analytic function $f$ is +$ + f(x) = sum_(i=0)^k (f^((i)) (0))/(i!) x^i + O(x^(k+1)) +$ + +now lucky us, since +$ + g^((k)) (0) = (-1)^(k-1) dot (k - 1)! +$ + +so +$ + g(x) & = sum_(i=1)^k (g^((i)) (0)) / (i!) x^i + O(x^(k+1)) \ + & = sum_(i=1)^k (-1)^(i-1) (i-1)! / (i!) x^i + O(x^(k+1)) \ + & = sum_(i=1)^k ((-1)^(i-1) x^i) / i + O(x^(k+1)) \ + & = x - x^2 / 2 + x^3 / 3 + dots.c + O(x^(k+1)) +$ + +we may choose $O(x^(k+1)) = 0$. + += problem 3 + +== a) + +are $1+x$, $1-x$ and $x-x^2$ linearly independent in $P_2$? + +#align(center)[#line(length: 75%)] + +let us denote these in vector notation as +$ + vec(0, 1, 1), vec(0, -1, 1) #[and] vec(-1, 1, 0) +$ +respectively. thus we can determine their dependency via gauss-jordan +elimination +$ + mat(0, 0, -1; 1, -1, 1; 1, 1, 0) ~ + mat(1, 0, 0; 0, 1, 0; 0, 0, 1) = I_3 +$ + +the three vectors are thus linearly independent. then what is their span? +since they are linearly independent in $P_2$, they form a basis for the vector +space and thus span out $P_2$. of note: $P_2$ is itself isomorphic to $RR^3$. + +== b) + +our affine space has two conditions, $p(1) = 1$ and $p(2) = 2$. + +let +$ + p(x) = a x^3 + b x^2 + c x + d +$ +such that +$ + p(1) = a + b + c + d = 1 +$ +and +$ + p(2) = 8 a + 4 b + 2 c + d = 2 +$ + +we can represent this system with a matrix +$ + mat(1, 1, 1, 1 | 1; 8, 4, 2, 1 | 2) tilde + mat(1, 1, 1, 1 | 1; 7, 3, 1, 0 | 1) +$ + +thus we can see that there are two linearly independent basis vectors that may +form a two-dimensional linear space. + +== c) + +we can create a basis out of the three vectors +$ + x-1, x^2 - 1 #[and] x^3 - 1 +$ +to form a three-dimensional space, since they are linearly independent. + +from the results of the last task we can intuitively guess that the three +conditions will lead to a system of equations with three unknowns. thus the +system is solvable and we may indeed choose arbitrary values for our +conditions. + +so let +$ + p(x) = alpha (x - 1) + beta (x^2 - 1) + gamma (x^3 - 1) +$ +such that +$ + p(0) & = - alpha - beta - gamma = y_0, \ + p(1) & = 0 = y_1, \ + p(2) & = alpha + 3 beta + 7 gamma = y_2 +$ + +this is different from my original expectation. we can tell that $y_1$ must be +0, thus cannot be chosen arbitrarily. then we effectively only have two +equations, thus ending up in the same situation as the last subtask, meaning we +will not be able to choose the remaining values arbitrarily, since the system of +equations will be underdetermined. + + += problem 4 + +== a) + +#let inner(f, g) = $angle.l #f, #g angle.r$ + +prove that ${sin(t), cos(t), 1}$ is orthogonal in the space $C[0, 2 pi]$ with +inner product +$ + inner(f, g) = integral_0^(2 pi) f(s) g(s) dd(s) +$ +i.e. that it is an orthogonal basis for $C[0, 2 pi]$. + +#align(center)[#line(length: 75%)] + +we must compute the pair-wise inner product of each base vector +$ + inner(sin, cos) & = integral_0^(2 pi) sin(t) cos(t) dd(t) = \ + inner(sin, 1) & = integral_0^(2 pi) sin(t) dd(t) = \ + inner(1, cos) & = integral_0^(2 pi) cos(t) dd(t) = 0 +$ +because $sin(t) cos(t)$, $sin(t)$ and $cos(t)$ all have a period of $2 pi$. + +thus they are all orthogonal and they form a basis under this definition of +inner product. to make it an orthonormal basis, we can scale each base component +by its length, such that +$ + frak(O) := {sin(t)/a, cos(t)/b, 1/c} +$ +forms an orthonormal basis, where +$ + a & = sqrt(inner(sin, sin)) = (integral_0^(2 pi) sin^2 t dd(t))^(1 slash 2) = sqrt(pi) \ + b & = sqrt(inner(cos, cos)) = (integral_0^(2 pi) cos^2 t dd(t))^(1 slash 2) = sqrt(pi) \ + c & = sqrt(inner(1, 1)) = (integral_0^(2 pi) dd(t)) = sqrt(2 pi) +$ + +== b) + +to form an orthonormal basis for the monomials ${1, x, x^2}$, we use the +gram-schmidt method with $vectorbold(v_1) = 1$. + +then +$ + vectorbold(v_2) & = x - "proj"_(vectorbold(v_1)) (x) \ + & = x - (inner(vectorbold(v_1), x) / inner( + vectorbold(v_1), + vectorbold(v_1) + )) vectorbold(v_1) \ + & = x - inner(1, x) / inner(1, 1) \ + & = x - 1/2 integral_(-1)^1 x dd(x) \ + & = x +$ + +then similarly for the last vector +$ + vectorbold(v_3) & = x^2 + - "proj"_(vectorbold(v_1))(x^2) + - "proj"_(vectorbold(v_2))(x^2) \ + & = x^2 + - 1/2 integral_(-1)^1 x^2 dd(x) + - (integral_(-1)^1 x^2 dd(x))^(-1) + dot integral_(-1)^1 x^3 dd(x) \ + & = x^2 - 1/3 +$ + +thus we have found an orthonormal base using gram-schmidt +$ + frak(O) := {1/a, x/b, (x^2 - 1/3)/c} +$ + +where $a & := sqrt(2), b & := sqrt(2/3)$ and $c & := sqrt(2/5)$. +