From f6912cf338500409b3bb71ddd6d27dbf05069d84 Mon Sep 17 00:00:00 2001 From: fredrikr79 Date: Tue, 28 Oct 2025 15:03:09 +0100 Subject: [PATCH] ex10: problem 1 --- exercise10/main.typ | 2 +- exercise10/problem1.typ | 136 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+), 1 deletion(-) diff --git a/exercise10/main.typ b/exercise10/main.typ index 28cadb8..60ac8c5 100644 --- a/exercise10/main.typ +++ b/exercise10/main.typ @@ -21,7 +21,7 @@ link(it.target, it.element.body) } -#lib.title(size: FONT_SIZE)[exercise 9] +#lib.title(size: FONT_SIZE)[exercise 10] these are my solutions to the tenth exercise set of TMA4135. diff --git a/exercise10/problem1.typ b/exercise10/problem1.typ index 617b32c..969499f 100644 --- a/exercise10/problem1.typ +++ b/exercise10/problem1.typ @@ -1,4 +1,140 @@ #import "@preview/physica:0.9.6": * +#import "lib.typ": ccases = problem 1 +== a) + +$ + f(x) := sin(3 x) + 5 cos(2 x) +$ +is already in its fourier series form. + +the coefficients can be read as +$ + a_0 & = 0, \ + a_n & = ccases(5, n = 2, 0) \ + b_n & = ccases(1, n = 3, 0) +$ + +== b) + +let +$ + g(x) = x^2, quad -pi <= x <= pi +$ + +then we can compute the fourier series using the formulas for $2pi$-periodic +functions +$ + a_0 & = 1/pi integral_(-pi)^pi x^2 dd(x) + = 2/pi integral_0^pi x^2 dd(x) \ + & = 2/(3 pi) [x^3]_0^pi = 2/3 pi^2 +$ + +$ + a_n & = 1/pi integral_(-pi)^pi x^2 cos(n x) dd(x) \ + & = 1/pi [x^2/n sin(n x) + (2 x)/n^2 cos(n x) + -2/n^3 sin(n x)]_(-pi)^pi \ + & = 2/(n pi) [x^2 sin(n x) + (2 x)/n cos(n x) + - 2/n^2 sin(n x)]_0^pi \ + & = 2/(n pi) ((2 pi)/n cos(pi n)) \ + & = 4/n^2 (-1)^n +$ + +$ + b_n & = 1/pi integral_(-pi)^pi x^2 sin(n x) dd(x) \ + & = 1/pi [-x^2/n cos(n x) +(2 x)/n^2 sin(n x) + + 2/n^3 cos(n x)]_(-pi)^pi \ + & = 1/pi [(cancel(-pi^2/n cos(pi n)) + (2 pi)/n^2 sin(pi n) + + cancel(2/n^3 cos(pi n))) \ + & - (cancel(-pi^2/n cos(-pi n)) - (2 pi)/n^2 sin(-pi n) + + cancel(2/n^3 cos(-pi n)))] \ + & = 2/n^2 (sin(pi n) + sin(-pi n)) \ + & = 2/n^2 (sin(pi n) - sin(pi n)) = 0 +$ + +the fact that $b_n$ is zero is reassuring, since the oddness that it contributes +with would be undesirable for a function like $x^2$. + +== c) + +show +$ + h(x) & = f(x) * g(x) = integral_(-pi)^pi g(y) f(x - y) dd(y) \ + & = -(4 pi)/9 sin(3 x) + 5 pi cos(2 x) +$ + +#line(length: 100%, stroke: (dash: "dotted")) + +$ + h(x) = integral_(-pi)^pi y^2 [sin(3 (x - y)) + 5 cos(2 (x - y))] dd(y) +$ + +this would be an awful lot of integration by parts, so let's be more clever +about this. + +we can expand the trigonometric terms in $f(x - y)$ to obtain simpler terms that +cancel out under $integral_(-pi)^pi g(y) sin(n y) dd(y) = 0$ + +- $ + sin(3(x - y)) = sin(3x) cos(3y) - cos(3x) sin(3y) + $ +- $ + cos(2(x - y)) = cos(2x) cos(2y) + sin(2x) sin(2y) + $ + +thus we obtain + +$ + h(x) & = sin(3x) integral_(-pi)^pi y^2 cos(3y) dd(y) \ + & - cancel(cos(3 x) integral_(-pi)^pi y^2 sin(3 y) dd(y)) \ + & + 5 cos(2x) integral_(-pi)^pi y^2 cos(2y) dd(y) \ + & + cancel(5 sin(2x) integral_(-pi)^pi y^2 sin(2y) dd(y)) +$ + +but these are simply the coefficients of $y^2$ from b), such that + +$ + 1/pi integral_(-pi)^pi y^2 cos(2y) dd(y) = [4/n^2 (-1)^n]_(n=2) = 1 +$ +$ + 1/pi integral_(-pi)^pi y^2 cos(3y) dd(y) = [4/n^2 (-1)^n]_(n=3) = -4/9 +$ + +which gives + +$ + h(x) = - (4 pi)/9 sin(3x) + 5 pi cos(2x) +$ + +#h(1fr) #math.qed + + +== d) + +$h(n)$ is also made up of basis vectors, such that the coefficients can be +written as +$ + a_0 & = 0 \ + a_n & = ccases(5pi, n = 2, 0) \ + b_n & = ccases(-(4pi)/9, n = 3, 0) +$ + +$ + c_n (f) & = a_n (f) + b_n (f) = ccases(5, n = 2, 1, n = 3, 0) \ + c_n (g) & = ccases(2/3 pi^2, n = 0, 4/n^2 (-1)^n,) \ + c_n (h) & = ccases(5pi, n = 2, -(4 pi)/9, n = 3, 0) +$ + +we can notice that $c_2 (h) = pi c_2 (f)$ and $c_3 (h) = pi c_3 (g)$. + +if we look for a deeper pattern, we can also notice that $c_2 (g) = 1$ and +$c_3 (f) = 1$ such that we could say that +$ + c_2(h) = pi c_2(f) c_2(g) quad and quad c_3(h) = pi c_3(f) c_3(g) +$ + +this is a profound result -- well, the generalized statement is -- and is +related to the fourier transform. we are saying that convolving two functions is +the same as taking their point-wise product at certain frequencies.