MATH201/content/Heat equation (lec 30-33).md

280 lines
19 KiB
Markdown
Raw Normal View History

2023-12-18 19:37:07 -07:00
Let's revisit the heat equation:
The first time the heat equation was introduced, we figured out that it's solution was of the form $u(t,x)=\sum_{n=1}^\infty c_{n}e^{-(n\pi/L)^2Dt}\sin\left( \frac{n\pi x}{L} \right)$
Now that we learned about Fourier series, we can compute the values of $c_{n}$ and finally solve it!
#ex #PDE
Solve the following PDE (find $u(t,x)$)
IBVP of heat eq:
$$\begin{cases}\frac{ \partial u }{ \partial t }=D\frac{ \partial^{2} u }{ \partial x^{2} } \text{ for } 0\leq x\leq L, \quad t>0\\u(t,0)=u(t,L)=0, \quad t>0\\u(0,x)=f(x), \quad 0\leq x\leq L\quad\end{cases}$$
where:
$$D=1$$
$$L=\pi$$
$$f(x)=\begin{cases}-x & 0\leq x\leq \frac{\pi}{2} \\x-\pi & \frac{\pi}{2}<x\leq \pi\end{cases}$$
>Psst, There's a shortcut, we have the same boundary conditions, the exact same IBVP that we solved for a general case. We can just plug in using the formula we derived earlier.
>$u(t,x)=\sum_{n=1}^\infty c_{n}e^{-(n\pi/L)^2Dt}\sin\left( \frac{n\pi x}{L} \right)$
>$u(t,x)=\sum_{n=1}^\infty c_{n}e^{-n^2t}\sin(nx)$
>All you have to do now is compute the Fourier transform of $f(x)$ to find the $c_{n}$ coefficients.
>Besides, the computations below for finding the eigen values and eigen function follow the exact same steps we had in lectures 26 and 27. So if you saw that and understood it, feel free to skip ahead to where we compute $c_{n}$
The initial temperature of the tube (at $t=0$) looks like this:
![draw](drawings/Drawing-2023-11-24-13.42.29.excalidraw.png)
So we have a non-uniformly heated rod with both ends held at zero temperature. What happens to the temperature inside the rod over time? <i>"[...]. Very interesting problem."</i> -Prof (I agree.)
If we expressed $f(x)$ as a Fourier series, where would it converge? Well it's continuous from $0$ to $\pi$ and its windowed form when repeated will be continuous on $(-\infty,\infty)$ furthermore, the derivative of this function is piecewise continuous on $[-\pi,\pi]$ therefore, it will be convergent everywhere (second convergence theorem). This is good news for us.
We do separation of variables as we did before: $u(t,x)=T(t)X(x)$
There's a theorem that this will give a unique solution. (Not proved in class.)
Plug into $\frac{ \partial u }{ \partial t }=D\frac{ \partial^{2} u }{ \partial x^{2} }$ where in this case, $D=1$
$T'X=DTX''$
$\frac{T'}{DT}=\frac{X''}{X}=-\lambda$
LHS is a function of $t$ only , RHS is function of $x$ only. The only time they can ever equate to each other if both of them equal some constant value(s) $\lambda$. The reason it's $-\lambda$ is because it doesn't matter, it's a constant and making it negative helps make rearranging the equation easier.
<i>"I don't know what is time, I know space, I can take a step and see the step I take, but can you see time? Can you see the future? Some can but I can't."</i> -prof.
We will continue the problem in the next lecture.
#end of lec 30
#start of lec 31
"Can we skip the assignment?"
Petar replies:
You have a choice, not just in math but in life,
Confucius says there's three things you cant take back:
opportunity to do something, time, and your word
so do your last assignment and don't pass up the opportunity!
Recall last lec:
$\frac{ \partial u }{ \partial t }=\frac{ \partial u^2 }{ \partial x^2 } \qquad 0\leq x\leq \pi \qquad t>0$
$u(t,0)=u(t,\pi)=0 \quad t>0$ <- Called a Dirichlet boundary condition
$u(0,x)=f(x) \quad 0\leq x<\pi$
$f(x)=\begin{cases}-x & 0\leq x\leq \frac{\pi}{2} \\x-\pi & \frac{\pi}{2}{\leq x\leq \pi}\end{cases}$
</br>
$u(t,x)=T(t)X(x)$
plug into equation:
$T'X=DTX''$
$\frac{T'}{DT}=\frac{X''}{X}=-\lambda$
$X''+\lambda X=0, \quad X(0)=X(\pi)=0$
characteristic equation: $r^2+\lambda=0 \implies r_{1,2}=\pm\sqrt{ -\lambda }$
</br>
Case 1) $\lambda<0 \implies$ $r_{1,2}=\pm \sqrt{ -\lambda }$
$X(x)=c_{1}e^{\sqrt{ -\lambda }x}+c_{2}e^{-\sqrt{ -\lambda }x}$
$X(0)=0=c_{1}+c_{2} \implies c_{1}=-c_{2}$
$X(\pi)=0=c_{1}e^{\sqrt{ -\lambda }\pi}+c_{2}e^{-\sqrt{ -\lambda }\pi}=-c_{2}e^{\sqrt{ -\lambda }\pi}+c_{2}e^{-\sqrt{ -\lambda }\pi}$
$0=c_{2}(e^{\sqrt{ -\lambda }\pi}-e^{-\sqrt{ -\lambda }\pi})$
either $c_2=0$ which gives a trivial solution, or
$e^{\sqrt{ -\lambda }\pi}-e^{-\sqrt{ -\lambda }\pi}=0\implies \sqrt{ -\lambda }=-\sqrt{ -\lambda } \implies\lambda=0$
but then $X(x)=c_{1}e^{\sqrt{ -0 }x}+c_{2}e^{-\sqrt{ -0 }x}=c_{1}+c_{2}=0 \implies X(x)=0$ Trivial solution again.
</br>
Case 2) $\lambda=0 \quad r_{1}=r_{2}=0$
$X(x)=c_{1}e^{0x}+c_{2}xe^{0x}=c_{1}+c_{2}x$
$X(0)=0=c_{1}$
$X(\pi)=0=c_{2}\pi$
$\implies X(x)=0$ Trivial solution.
</br>
Case 3) $\lambda>0 \implies r_{1,2}=0\pm i\sqrt{ \lambda }$
$X(x)=c_{1}\cos(\sqrt{ \lambda }x)+c_{2}\sin(\sqrt{ \lambda }x)$
$X(0)=c_{1}=0$
$X(\pi)=0=c_{2}\sin(\sqrt{ \lambda }\pi)\implies \sqrt{ \lambda }\pi=n\pi\quad n=1,2,\dots$
</br>
$\lambda_{n}=n^2$ <- a countable infinitely many lambdas (it's countably infinite because each lambda is taggable with an index, real numbers are uncountable.)
"What is a point? A point on a screen, on a piece of paper?" Loosy quote, and I can't recall what the intention behind this quote was unfortunately.
$X_{n}(x)=c_{2}\sin(nx)$
but obviously, we don't need the multiples of an eigen value, so we set $c_{2}=1$ (or any arbitrary non zero constant)
$X_{n}(x)=\sin(nx)$
Using $\frac{T'}{T}=\frac{X''}{X}=-\lambda$ we plug in the value we got for $\lambda$:
$\frac{T'}{T}=-n^2$
Integrate both sides:
$\int \frac{1}{T}\,dT=\int -n^2 \, dt$
$T_{n}(t)=c_{n}e^{-n^2t}$
> ^Side note, he uses $b_{n}$ in this lecture, but I want it to be consistent with previous lectures where he uses $c_{n}$
$u(x,t)=X(x)T(t)$
$u_{n}(t,x)=c_{n}e^{-n^2t}\sin(nx) \qquad n=1,2,\dots$
$u(t,x)=\sum_{n=1}^\infty c_{n}e^{-n^2t}\sin(nx)$
> THIS IS WHERE WE START TO COMPUTE THE FOURIER COEFFICIENTS :D
bring in the initial condition babyyy:
$u(0,x)=f(x)=\sum_{n=1}^\infty c_{n}\sin(nx)$
$c_{n}=\frac{2}{\pi}\int _{0}^\pi f(x)\, dx$
recall the definition of $f \quad$ $f(x)=\begin{cases}-x & 0\leq x\leq \frac{\pi}{2} \\x-\pi & \frac{\pi}{2}{\leq x\leq \pi}\end{cases}$
$c_{n}=\frac{2}{\pi}[-\int _{0} ^\frac{\pi}{2} x\sin(nx) \, dx+\int _{\frac{\pi}{2}} ^\pi x\sin(nx) \, dx-\pi \int _{\frac{\pi}{2}} ^\pi \sin(nx)\, dx]$
Integrate by parts:
$\int \underbrace{x}_{ u }\underbrace{ \sin(nx) }_{ v' } \, dx=x\frac{-\cos(nx)}{n}-\int 1\cdot\frac{-\cos(nx)}{n} \, dx$
$=-\frac{1}{n} x\cos(nx)+\frac{\sin(nx)}{n^2} =\frac{\sin(nx)}{n^2}-\frac{x\cos(nx)}{n}$
$c_{n}=\frac{2}{\pi}\left[ -\frac{\sin(nx)}{n^2}+\frac{x\cos(nx)}{n}|_{0}^{\frac{\pi}{2}}+\frac{\sin(nx)}{n^2}-\frac{x\cos(nx)}{n}|_{\frac{\pi}{2}}^\pi+\frac{\pi \cos(nx)}{n}|_{\frac{\pi}{2}}^\pi \right]$
$c_{n}=\frac{2}{\pi}\left[ -\frac{1}{n^2}\sin \frac{n\pi}{2}+\cancel{ \frac{\pi}{2n}\cos \frac{n\pi}{2} } \quad +\quad0-\frac{\pi}{n}(-1)^n-\frac{1}{n^2}\sin \frac{n\pi}{2} +\cancel{ \frac{\pi}{2n}\cos \frac{n\pi}{2} }\quad+\quad\frac{\pi}{n}(-1)^n-\cancel{ \frac{\pi}{n}\cos \frac{n\pi}{2} } \right]$
$c_{n}=-\frac{4}{n^2\pi}\sin \frac{n\pi}{2}, \quad n=1,2,\dots$
$n=2k\implies c_{2k}=0, \quad k=1,2,\dots$
$n=2k-1\implies c_{2k-1}=-\frac{4}{(2k-1)^2\pi}(-1)^{k+1}, \quad k=1,2,\dots$
$c_{2k-1}=\frac{4}{(2k-1)^2\pi}(-1)^{k}$
plug it in:
$u(t,x)=\sum_{n=1}^\infty c_{n}e^{-n^2t}\sin(nx)$
$$u(t,x)=\sum_{k=1}^\infty \frac{4(-1)^k}{\pi(2k-1)^2}e^{-(2k-1)^2t}\sin((2k-1)x)$$
Notice that the limit of the sum as $t\to \infty$ is $0$. The bar cools down eventually.
Graph time! But oh no! He forgot the plot from the last lecture, I went to grab it for him.
(Image below is shown with explicit permission granted. I like how it captures the ambiance of being in a lecture. I feel like it makes my notes feel more real. And look at my prof!!! He looks killer in that knitted argyle sweater.)
![image](drawings/heat.jpg)
While I was gone, I heard he shared stories about his family. Unfortunately I missed it.
You can see that the original spike quickly gets rounded over as the temperature across the tube smooths out and eventually approaches $0$ everywhere. Energy is not conserved in this system as it is not a closed system. The outside world is holding the two ends at a constant $0$ temperature.
If you imagine the plot was showing the concentration of CO$_{2}$ in a room, it follows a similar curve as time goes on and the gas diffuses. Isn't that neat?
By the way, there are only 5 more lectures left.
</br>
Imagine instead of holding the two ends of the rod with a temperature of zero, we insulated the two ends.
How do we insulate the ends? Set the heat flux at the ends to $0$:
$k\frac{ \partial u }{ \partial x }(t,0)=k\frac{ \partial u }{ \partial x }(t,L)=0$ <- $k$ is the thermal conductivity of the tube.
This gives a new equation type: Neumann type. (Neumann type means information about the derivative is specified, rather than the actual value.)
$$\frac{ \partial u }{ \partial t }=D\frac{ \partial^2 u }{ \partial x^2 }, \quad 0\leq x\leq L, \quad t>0$$
$$\frac{ \partial u }{ \partial x }(t,0)=\frac{ \partial u }{ \partial x }(t,L)=0, \quad t>0$$
$$u(0,x)=f(x) \quad 0\leq x\leq L$$
#end of lec 31
#start of lec 32
Let's solve the Neumann problem, start with separation of variables.
assume we can separate the variable into two different functions:
$u(t,x)=T(t)X(x)$
plug into: $\frac{ \partial u }{ \partial t }=D\frac{ \partial^2 u }{ \partial x^2 }$
$T'X=DTX''$
$\frac{T'}{DT}=\frac{X''}{X}=-\lambda$
$X''+\lambda X=-\lambda$ <- second order DE.
$\frac{ \partial u }{ \partial x }(0,t)=0 \implies$ $\underbrace{ X'(0) }_{ =0 }T(t)=0$
Obviously the above is only true if we set $X'(0)=0$
Had we set $T(t)=0$ then you get $u(x,t)=0$, the trivial solution.
Same goes for $\frac{ \partial u }{ \partial x }(L,t)=0 \implies$ $\underbrace{ X'(L) }_{ =0 }T(t)=0$
Then, the boundary conditions are:
$X''+\lambda X=0 \quad X'(0)=0 \quad X'(L)=0$
Characteristic equation is:
$r^2+\lambda=0 \implies r_{1,2}=\pm\sqrt{-\lambda}$
</br>
case 1) $\lambda<0 \implies X(x)=c_{1}e^{\sqrt{ -\lambda }x}+c_{2}e^{-\sqrt{ -\lambda }x}$
$X'(0)=0=c_{1}\sqrt{ -\lambda }-c_{2}\sqrt{ -\lambda } \implies c_{1}=c_{2}$
$X'(L)=0=c_{1}\sqrt{ -\lambda }e^{\sqrt{ -\lambda }L}-c_{2}\sqrt{ -\lambda }e^{-\sqrt{ -\lambda }L}$
$0=c_{1}\sqrt{ -\lambda }(e^{\sqrt{ -\lambda }L}-e^{-\sqrt{ -\lambda }L})$
$\sqrt{ -\lambda }L=-\sqrt{ -\lambda }L \implies 2\sqrt{ \lambda } L=0$
Take your pick, set $\lambda=0$ or $c_{1}=0$, either way you get the trivial solution. ($L\ne0$ because then your tube is $0$ in length.)
</br>
case 2) $\lambda=0$
$X(x)=c_{1}e^{0x}+c_{2}xe^{0x}=c_{1}+c_{2}x$
$X'(0)=c_{2}=0$
$X'(L)=c_{2}=0$
$\implies X_{0}(x)=c_{1}$ is an eigen function corresponding to $\lambda_{0}=0$ where $c_{1}$ is a constant.
</br>
case 3) $\lambda>0$
$X(x)=c_{1}\cos(\sqrt{ \lambda }x)+c_{2}\sin(\sqrt{ \lambda }x)$
$X'(0)=0=-c_{1}\sqrt{ \lambda }\sin(0)+c_{2}\sqrt{ \lambda }\cos(\sqrt{ \lambda }0) \implies c_{2}=0$
$X'(L)=0=-c_{1} \sqrt{ \lambda }\sin(\sqrt{ \lambda }L) \implies c_{1}\sin(\sqrt{ \lambda }L)=0$
$$\implies \lambda_{n}=\left( \frac{n\pi}{L} \right)^2 \qquad n=1,2,\dots$$
$$ \implies X_{n}(x)=c_{n}\cos\left( \frac{n\pi x}{L} \right)$$
>This is a different result than what we got last time, for comparison, the Dirichlet problem gave us the same expression for $\lambda_{n}$ however the $X_{n}(x)$ was $X_{n}(x)=c_{n}\sin\left( \frac{n\pi x}{L} \right)$
</br>
plug $\lambda$ into: $\frac{T'}{DT}=\frac{X''}{X}=-\lambda$
$\frac{T_{n}'}{DT_{n}}=-(\frac{n\pi}{L})^2$ for $n=0,1,2,\dots$
integrate both sides:
$T_{n}(t)=a_{n}e^{-D(n\pi/L)^2t}$
$u_{n}(t,x)=X_{n}(x)T_{n}(t)=a_{n}e^{-D(n\pi/L)^2t}c_{n}\cos\left( \frac{n\pi x}{L} \right)$
merge constant coefficients into a new one:
$u_{n}(t,x)=X_{n}(x)T_{n}(t)=a_{n}e^{-D(n\pi/L)^2t}\cos\left( \frac{n\pi x}{L} \right)$ for $n=0,1,2,\dots$
apply super position (sum of any solutions is also a solution):
$u(t,x)=\sum_{n=0}^\infty a_{n}e^{-D(n\pi/L)^2t}\cos\left( \frac{n\pi x}{L} \right)$
Now, make it look like a Fourier expansion (take out constant term and redefine $a_{0}$):
$u(t,x)=\frac{a_{0}}{2}+\sum_{n=1}^\infty a_{n}e^{-D(n\pi/L)^2t}\cos\left( \frac{n\pi x}{L} \right)$
Boundary condition says:
$u(0,x)=f(x)=\frac{a_{0}}{2}+\sum_{n=1}^\infty a_{n }\cos\left( \frac{n\pi x}{L} \right)$
This is a Fourier $\cos$ series, last time we had a Fourier $\sin$ series.
$a_{0}=\frac{2}{L}\int _{0}^Lf(x) \, dx$
$a_{n}=\frac{2}{L}\int _{0}^L f(x)\cos\left( \frac{n\pi x}{L} \right)\, dx$
Plug these into the solution
Kaboom we have a solution to the problem in the form of a Fourier series.
$$u(t,x)=\frac{a_{0}}{2}+\sum_{n=1}^\infty a_{n}e^{-D(n\pi/L)^2t}\cos\left( \frac{n\pi x}{L} \right)$$^and this is called a formal solution.
Where will it converge? Well that depends of your $f(x)$
Do you remember the two rules for convergence of a Fourier series?
Theorems are not rules, they are not axioms. A rule is given, you don't prove it, theorems are what you prove.
</br>
Let's try taking an example:
#ex
$$\begin{cases}D=1\\L=\pi\\f(x)=\begin{cases}1, & 0\leq x\leq \frac{\pi}{2} \\0, & \frac{\pi}{2}<x\leq \pi\end{cases}\end{cases}$$
![draw](drawings/2023-12-18-16.29.58.excalidraw.png)
$u(t,x)=\frac{a_{0}}{2}+\sum_{n=1}^\infty a_{n}e^{-n^2t}\cos\left({n x} \right)$
$u(0,x)=\frac{a_{0}}{2}+\sum_{n=1}^ \infty a_{n}\cos\left( \frac{n\pi x}{L} \right)=f(x)$
$a_{0}=\frac{2}{\pi}\int _{0} ^{\pi/2} 1\, dx=1$
$a_{n}=\frac{2}{\pi}\int _{0} ^{\pi/2} 1\cdot\cos(nx) \, dx=\frac{2}{n\pi}\sin(nx)|_{0} ^\frac{\pi}{2}=\frac{2}{n\pi}\sin\left( \frac{n\pi}{2} \right) \quad n=1,2,\dots$
We can take out the zero terms:
$a_{2k}=0 \qquad a_{2k-1}=\frac{2}{(2k-1)\pi}(-1)^{k+1}$
$u(t,x)=\frac{1}{2}+\frac{2}{\pi}\sum_{k=1}^\infty \frac{(-1)^{k+1}}{2k-1}e^{-(2k-1)^2t}\cos((2k-1)x)$
We are done, and we didn't need to take out the zero terms but if you want to be diligent, then there you go.
Plot (only showing 100 harmonics, that's why the red line looks a lil' wiggly):
![plot](drawings/insulatedheat.png)
"Can we just memorize the formula and plug in the values?"
His reply was something along the lines of:
No! Please don't, you'll put in some arbitrary values with the wrong boundary conditions and arrive with some crap result. You would need to redo the calculations and get completely new eigen values and eigen functions. I know how much you guys love formulas. But you need to understand what's happening, I don't know who thought it would be a good idea to make people memorize formulas, certainly not my idea. I want to be confident in the future engineers and the bridges that are built.
...
Reminds me of what he said when he was talking about George Green/Stokes, and how nowadays everything is McDonalds style, even our education. Maybe this is what he is referring to.
#end of lec 32
#start of lec 33 (Dec 1)
#ex
Imagine along the wire we produce some heat somehow:
$$\frac{ \partial u }{ \partial t }=\frac{ \partial^2 u }{ \partial x^2 }+\underbrace{ e^x }_{\text{ heat} } \quad 0\leq x\leq 1 \quad t>0$$
$$u(t,0)=-1 \quad u(t,1)=-e \qquad t>0 \quad\text{(Dirichlet problem)}$$
$$u(0,x)=\sin(\pi x)+e^x, \qquad 0\leq x\leq 1$$
$e^x$ is called a source term, a source of heat.
we expect that the solution is two solutions, that are summed together due to superposition.
where one of the terms does not depend on time.
ie: $u(t,x)=w(t,x)+v(x)$
$v$ is the steady state term, $w$ is transient.
plug in:
$\frac{ \partial w }{ \partial t }=\frac{ \partial^2 w }{ \partial x^2 }+v''(x)+e^x$ <- $v$ double prime because $v$ is a function of one variable.
$w(t,0)+v(0)=-1 \qquad w(t,1)+v(1)=-e$
and $w(t,x)\underset{ _{t\to \infty} }{ \longrightarrow }0$ (transient term decays to zero.)
Which implies the derivatives also equal zero: $\frac{ \partial w }{ \partial t }, \frac{ \partial w }{ \partial x }\underset{ t\to \infty }{ \longrightarrow }0$
$\frac{ \partial w }{ \partial t }=\frac{ \partial^2 w }{ \partial x^2 }+v''(x)+e^x\underset{ t\to \infty }{ \longrightarrow } v''(x)+e^x=0$
$\implies v''(x)=-e^x$
and the boundary conditions as $t\to\infty$ give: $v(0)=-1$ $v(1)=-e$
Do you agree? Please be awake this is an important class.
plugging those values into the equations $w(t,0)+v(0)=-1$ and $w(t,1)+v(1)=-e$ gives:
$w(t,0)=w(t,1)=0 \qquad \text{for}\quad t>0$
</br>
integrate $v''$ twice:
$v(x)=-e^x+c_{1}x+c_{2}$
$v(0)=-1=-1+c_{2}$
$\implies c_{2}=0$
$v(1)=-e=-e+c_{1}$
$\implies c_{1}=0$
$\implies v(x)=-e^x$
</br>
$u(0,x)=\sin(\pi x)+e^x$
$w(0,x)-e^x=\sin(\pi x)+e^x$
$w(0,x)=\sin(\pi x)+2e^x$ <- a new initial condition.
Lastly, notice that $u(t,x)=w(t,x)+v(x)=w(t,x)-e^x$
$\implies \frac{ \partial w }{ \partial t }=\frac{ \partial^2 w }{ \partial x^2 }-\cancel{ e^x }+\cancel{ e^x }$
We have thus transformed the problem to a problem we can solve with previous tools:
$\frac{ \partial w }{ \partial t }=\frac{ \partial^2 w }{ \partial x^2 } \quad 0\leq x\leq 1 \quad t>0$
$w(t,0)=w(t,1)=0\quad t>0$
$w(0,x)=\sin(\pi x)+2e^x, \quad 0\leq x\leq 1$
>Solve this with separation of variables, then solve the eigen value problem just like we have done before. Alternatively, this IBVP matches the general IBVP formula we derived earlier, so we can just plug in:
>$w(t,x)=\sum_{n=1}^\infty c_{n}e^{-(n\pi/L)^2Dt}\sin\left( \frac{n\pi x}{L} \right)$
>$w(t,x)=\sum_{n=1}^\infty c_{n}e^{-(n\pi)^2t}\sin(n\pi x)$
</br>
"Each time we introduce the heat equation, we are adding one extra step at a time, really everything else is the same and after you practice 2 or 3 times you'll get it."
$w(t,x)=\sum_{n=1}^\infty b_{n}e^{-(n\pi)^2t}\sin(n\pi x)$
$w(0,x)=\sin \pi x+2e^x=\sum_{n=1}^\infty b_{n}\sin(n\pi x)$
That series is nothing but: $b_{1}\sin(\pi x)+b_{2}\sin(2\pi x)+\dots$
move $\sin(\pi x)$ to RHS:
$2e^x=(b_{1}-1)\sin(\pi x)+b_{2}\sin(2\pi x)+b_{3}\sin(3\pi x)+\dots$
or you could say:
$2e^x=\sum_{n=1}^\infty c_{n}\sin(\pi x)$
$c_{1}=b_{1}-1$ $c_{k}=b_{k}, \quad k=2,3,\dots$
We do this because by combining the $\sin$ term we get to skip an integral to compute.
"If you start panicking on the exams you're done. You're fried."
Now we need the Fourier $\sin$ series of $2e^x$
$c_{n}=2\cdot\frac{2}{1}\int_{0}^1 e^x\sin(n\pi x) \, dx$ we have to solve this by integration by parts
How's math 209 going? "[...] Stokes theorem, I mean for electrical engineers it's a must."
let $u=\sin(n\pi x), \quad v'=e^x$
$c_{n}=4(e^x\cancelto{ 0 }{ \sin(n\pi x) }|_{0} ^1-n\pi \int _{0}^1 e^x\cos(n\pi x)\, dx$
$c_{n}=-4n\pi\left( e^x\cos(n\pi x)|_{0}^1+n\pi \int _{0}^1 e^x\sin(n\pi x)\, dx \right)$
$c_{n}=-4n\pi(e(-1)^n-1)-\underbrace{ 4n^2\pi^2\int _{0}^1 e^x\sin(n\pi x)\, dx }_{ =n^2\pi^2c_{n} }$
$(1+n^2\pi^2)c_{n}=-4n\pi(e(-1)^n-1)$
$c_{n}=\frac{4n\pi(1-e(-1)^n)}{1+(n\pi)^2}$
$b_{1}=c_{1}+1=\frac{4\pi(1+e)}{1+\pi^2}+1$
$b_{n}=\frac{4n\pi(1-e(-1)^n)}{1+(n\pi)^2}, \quad n=2,3,\dots$
$$u(t,x)=-e^x+w(t,x)=-e^x+\sum_{n=1}^\infty b_{n}e^{-(n\pi)^2t}\sin(n\pi x)$$
That took 41 minutes to solve, maybe 5 minutes more if we solved the eigen value part. Overall, it might take 15 on an exam setting.
Back in the day, written exams were 4 hours long, with 2 to 3 questions and then there was an oral exam with your professor to explain what you wrote. One time he stayed for 8 hours, being cycled back and forth through the line until the professor was satisfied with Minev's answer.
Almost everyone would take above undergrad degree, 3yrs to finish undergrad +2 more years total. (if I didn't mishear him)
"First year was the most difficult by far, a massacre, half of us would fail. Your chances in an exam were 1 of 2."
Ok I spent 5 minutes talking nonsense but you complaining that your exams are hard, they're not hard. I'm talking about 40 years ago, no computers, no cellphones, and it wasn't so bad because we had to use our brain more.