From 1d7f312a8602b70ca0bac41cc1f661fd16989c19 Mon Sep 17 00:00:00 2001 From: Sasserisop Date: Mon, 27 Nov 2023 00:51:56 -0700 Subject: [PATCH] revised convolution (finally!) --- content/Convolution (lec 19-20).md | 80 ++++++++++++++++++------------ content/_index.md | 2 +- 2 files changed, 49 insertions(+), 33 deletions(-) diff --git a/content/Convolution (lec 19-20).md b/content/Convolution (lec 19-20).md index cfbedaa..7a68bb5 100644 --- a/content/Convolution (lec 19-20).md +++ b/content/Convolution (lec 19-20).md @@ -1,11 +1,15 @@ # Convolution -A convolution is an operation of function, we take two functions, convolute them and get a new function. -Definition of convolution between f and g: +#convolution +A convolution is an operation on two functions, we take two functions, convolute them and get a new function. +Definition of convolution between $f$ and $g$: $$(f*g)(t):=\int _{0} ^t f(t-v)g(v)\, dv$$ + property 1) $f*g=g*f$ proof: -$f*g=\int _{0} ^t f(t-v)g(v)\, \underset{ t-v=u }{ dv }=-\int _{t} ^0 f(u)g(t-u) \, du$ -$=\int _{0} ^t g(t-u)f(u)\, du=g*f \quad \Box$ +$f*g=\int _{0} ^t f(t-v)g(v)\, dv$ +u substituiton: $t-v=u \quad du=-dv$ +$f*g=-\int _{t} ^0 f(u)g(t-u) \, du$ +$f*g=\int _{0} ^t g(t-u)f(u)\, du=g*f \quad \Box$ property 2) $(f+g)*h=f*h+g*h$ property 3) $(f*g)*h=f*(g*h)$ @@ -14,47 +18,59 @@ property 5) $\mathcal{L}\{f*g\}=F(s)G(s)$ #end of lec 19 #start of lec 20 lets try proving property 5: recall property 5: $\mathcal{L}\{f*g\}=F(s)G(s)$ -$\mathcal{L}\{f*g\}=\int _{0} ^t \left( e^{-st}\int_{0} ^t f(t-v)g(v) \, dv \right)\, dt$ -$\mathcal{L}\{f*g\}=\int _{0} ^t \left( e^{-st}\int_{0} ^\infty u(t-v)f(t-v)g(v) \, dv \right)\, dt$ +$\mathcal{L}\{f*g\}=\int _{0} ^\infty \left[ e^{-st}\int_{0} ^t f(t-v)g(v) \, dv \right]\, dt$ +$\mathcal{L}\{f*g\}=\int _{0} ^\infty \left[ e^{-st}\int_{0} ^\infty u(t-v)f(t-v)g(v) \, dv \right]\, dt$ two nested integrals! -using math 209, if both integrals exist, we can exchange the two integrals: -$=\int _{0}^\infty ( g(v)\underbrace{ \int _{0}^\infty e^{-st}f(t-v)u(t-v)\, dt }_{ \mathcal{L}\{f(t-v)u(t-v)\}=e^{-vs}F(s) } )\, dv$ -$=F(s)\int _{0} ^\infty e^{-rs}g(v)\, dv=F(s)G(s) \quad \Box$ +Using math 209, if both integrals exist, we can exchange the two integrals: +$=\int _{0}^\infty [ g(v)\underbrace{ \int _{0}^\infty e^{-st}f(t-v)u(t-v)\, dt }_{ \mathcal{L}\{f(t-v)u(t-v)\}=e^{-vs}F(s) } ]\, dv$ +$=F(s)\int _{0} ^\infty e^{-vs}g(v)\, dv=F(s)G(s) \quad \Box$ This is a very useful fact. We will see how it helps us solve differential equations. -ex: +#ex #convolution #inv_LT +Computing the following: $$\mathcal{L}^{-1}\left\{ \frac{1}{s^2+1}\frac{1}{s^2+1} \right\}$$ -we know the inverse LT of $\frac{1}{s^2+1}$ is $\sin(t)$: -then, using property 5: $\mathcal{L}\{f*g\}=F(s)G(s)$ +We know the inverse LT of $\frac{1}{s^2+1}$ is $\sin(t)$ +Then, using property 5: $\mathcal{L}\{f*g\}=F(s)G(s)$ $f*g=\mathcal{L}^{-1}\{F(s)G(s)\}=(\sin*\sin)(t)$ -$\mathcal{L}^{-1}\{\frac{1}{s^2+1} \frac{1}{s^2+1}\}=(\sin*\sin)(t)$ -using the definition of convolution: +$$\mathcal{L}^{-1}\{\frac{1}{s^2+1} \frac{1}{s^2+1}\}=(\sin*\sin)(t)$$ +This is pretty good but we can simplify it more. +Using the definition of convolution: $\mathcal{L}^{-1}\left\{ \frac{1}{s^2+1} \frac{1}{s^2+1} \right\}=\int _{0}^t \sin(t-v)\sin(v)\, dv$ -use trig identity: $\sin \alpha \sin \beta=\frac{1}{2}(\cos(\alpha-\beta)-\cos(\beta+\alpha)$ +use trig identity: $\sin \alpha \sin \beta=\frac{1}{2}(\cos(\alpha-\beta)-\cos(\beta+\alpha))$ $=\frac{1}{2}\int _{0} ^t (\cos(t-2v)-\cos(t))\, dv$ $=\frac{1}{2}\left( -\frac{1}{2}\sin(t-2v)|^t_{0}-t\cos t \right)=\frac{1}{2}\left( \frac{1}{2}\sin(t)+\frac{1}{2}\sin(t)-t\cos t \right)$ -$$=\frac{1}{2}(\sin t-t\cos t)$$ -#ex -solve the problem: -$$y'+y-\int _{0} ^t y(v)\sin(t-v) \, dv =-\sin t,\qquad y(0)=1$$ -this is called an integral-differential equation. -we can convert it to a differential equation by taking the derivative of both sides (wrt to dt.): -$y''+y'-y\sin(t-v)=-\cos t$ -ew thats a gross second order linear equation. lets solve using laplace. +$$\mathcal{L}^{-1}\{\frac{1}{s^2+1} \frac{1}{s^2+1}\}=\frac{1}{2}(\sin t-t\cos t)$$ +Note that if you tried using #partial_fractions you would fail: +$\frac{1}{(s^2+1)(s^2+1)}=\frac{A+Bs}{s^2+1}+\frac{{C+Ds}}{(s^2+1)^2}$ <- sad trombone plays +But sometimes, both convolution and partial fractions can work on the same problem. And sometimes partial fractions is easier or faster than using convolution. Keep that in mind for your exams. #remember +One last thing, this problem could have also been solved faster and without convolution using property 30 from the [big LT table](drawings/bigLTtable.png). +#ex #convolution #IVP #integral-differential +solve for $y(t)$: +$$y'+y-\int _{0} ^t y(v)\sin(t-v) \, dv =-\sin t,\qquad y(0)=1$$ +This is called an integral-differential equation. +We can convert it to a differential equation by taking the derivative of both sides (wrt to $t$.): +$y''+y'-y\sin(t-v)=-\cos t$ +ew that's a gross second order linear equation. Laplace is the only tool we've learned so far that has a chance at defeating this problem. +But let's solve instead by taking the LT of the original equation, since that integral can be expressed as a convolution. +Hit it with the LT! $sY-1+Y-\mathcal{L}\{(y*\sin)(t)\}=-\frac{1}{s^2+1}$ +using property 5, $\mathcal{L}\{f*g\}=F(s)G(s)$: +$sY-1+Y-Y \frac{1}{s^2+1}=-\frac{1}{s^2+1}$ +isolate $Y(s)$: $\left( s+1-\frac{1}{s^2+1}\right)Y(s)=1-\frac{1}{s^2+1}=\frac{s^2}{s^2+1}$ $\frac{(s^2+1)(s+1)-1}{s^2+1}Y(s)=\frac{s^2}{s^2+1}$ $\frac{s^3+s^2+s+\cancel{ 1 }-\cancel{ 1 }}{s^2+1}Y(s)=\frac{s^2}{s^2+1}$ $Y(s)=\frac{s}{s^2+s+1}$ -$y(t)=\mathcal{L}^{-1}\left\{ \frac{s}{s^2+s+1} \right\}=\mathcal{L}^{-1}\{\frac{s}{\left( s+\frac{1}{2} \right)^2+\left( \frac{\sqrt{ 3 }}{2} \right)^2}\}$ +This cant be solved with partial fractions, but if you remember from lecture 16, it can be solved by completing the square. +$y(t)=\mathcal{L}^{-1}\left\{ \frac{s}{s^2+s+1} \right\}=\mathcal{L}^{-1}\left\{\frac{s}{\left( s+\frac{1}{2} \right)^2+\left( \frac{\sqrt{ 3 }}{2} \right)^2}\right\}$ $=\mathcal{L}^{-1}\left\{ \frac{s+\frac{1}{2}-\frac{1}{2}}{\left( s+\frac{1}{2} \right)^2+\left( \frac{\sqrt{ 3 }}{2} \right)^2} \right\}$ -$=e^{-t/2}\cos\left( \frac{\sqrt{ 2 }}{2}t \right)-\frac{1}{2} \frac{2}{\sqrt{ 3 }}\mathcal{L}^{-1}\left\{ \frac{\frac{\sqrt{ 3 }}{2}}{\left( s+\frac{1}{2} \right)^2+\left( \frac{\sqrt{ 3 }}{2} \right)^2} \right\}$ +$=e^{-t/2}\cos\left( \frac{\sqrt{ 3 }}{2}t \right)-\frac{1}{2} \frac{2}{\sqrt{ 3 }}\mathcal{L}^{-1}\left\{ \frac{\frac{\sqrt{ 3 }}{2}}{\left( s+\frac{1}{2} \right)^2+\left( \frac{\sqrt{ 3 }}{2} \right)^2} \right\}$ $$y(t)=e^{-t/2}\left( \cos \frac{\sqrt{ 3 }}{2}t-\frac{1}{\sqrt{ 3 }} \sin \frac{\sqrt{ 3 }}{2}t\right)$$ -this is a good algorithmic method now for solving differential equations in software, for example solving circuits. +This is a good algorithmic method now for solving differential equations in software, for example solving circuits. ## Transfer function -imagine we have the equation: +Imagine we have the equation: $$ay''+by'+cy=g(t), \qquad y(0)=y_{0},\ y'(0)=y_{1}$$ 1) $ay''+by'+cy=g(t)$ @@ -70,15 +86,15 @@ $y=y_{*}+y_{**}$ solving 1) gives us: $as^2Y+bsY+cY=G(s)$ -$Y(s)=\frac{1}{as^2+bs+c}G(s)$ the limit approaches 0 for large s so its a legitimate Laplace transform +$Y(s)=\frac{1}{as^2+bs+c}G(s)$ the limit approaches 0 for large s so it's a legitimate Laplace transform let $Y(s)=H(s)G(s)$ where $H(s)=\frac{1}{as^2+bs+c}$ and called the transfer function -we put in $g(t)$ and we get out $Y(s)$. So it "transfers". +we put in $g(t)$ into this system and we get out $Y(s)$. So it "transfers". $H(s)=\frac{Y(s)}{G(s)}$ $\mathcal{L}^{-1}\{H\}=h(t)$ called the impulse response function. We will see why its called that later. -$y_{*}(t)=(h*g)(t)$ +$y_{*}(t)=(h*g)(t)$ (the first * only denotes a name, it doesn't mean convolution) $y(t)=(h*g)(t)+c_{1}y_{1}+c_{2}y_{2}$ - -he's finished 8 minutes early, lets go! +What does this mean? It means the particular solution for a linear second order equation is composed of the convolution between $g(t)$, which is the force applied to the system, and the impulse response function. But don't know what this means physically yet. +He's finished 8 minutes early, lets go! #end of lec 20 \ No newline at end of file diff --git a/content/_index.md b/content/_index.md index 584d334..b71f5f4 100644 --- a/content/_index.md +++ b/content/_index.md @@ -19,7 +19,7 @@ I have written these notes for myself, I thought it would be cool to share them. [Solving IVP's using Laplace transform (lec 17-18)](solving-ivps-using-laplace-transform-lec-17-18.html) [(Heaviside) Unit step function (lec 18)](heaviside-unit-step-function-lec-18.html) [Periodic functions (lec 19)](periodic-functions-lec-19.html) -[Convolution (lec 19-20)](convolution-lec-19-20.html) (raw notes, not reviewed or revised yet.) +[Convolution (lec 19-20)](convolution-lec-19-20.html) [Dirak δ-function (lec 21)](dirak-δ-function-lec-21.html) (raw notes, not reviewed or revised yet.) [Power series (lec 22-25)](power-series-lec-22-25.html) (raw notes, not reviewed or revised yet.) [Separation of variables & Eigen value problems (lec 26-28)](separation-of-variables-eigen-value-problems-lec-26-28.html) (raw notes, not reviewed or revised yet.)