Math Help - Using the Heat equation.

1. Using the Heat equation.

Question: Find the temperature u(x,t) in a rod of length L if the initial temp is f(x) throughout and the ends are x=0 and x=L are insulated.

Solve if L=2 and f(x) = {x , 0 < x <1
{0 , 1 < x <2

attempt:
k d^2(u)/dx^2 = du/dt ; 0<x<L, t>0
Insulated ends means: u(0,t)=0 u(L,t) = 0
u(x,0)= f(x) ; 0 <x<L
let u(x,t) = X(x)T(t)

d^2(u)/d(x)^2 = TX'' ; du/dt = XT'
kTX'' = XT'

X''/X = T'/(kT) = -λ^2
X'' + λ^2X = 0
T' + λ^2kt = 0
X'(0)=0 X'(L)=0

for λ=0 , X(x) = ax+b
but from the boundary condition a=0 , X(x)=b

for λ^2 > 0
X= acosλx + bsinλx
X' = λ(-asinλx +bcosλx)

this is where i am getting stuck. any help would be great, thanks

2. Originally Posted by linalg123
Question: Find the temperature u(x,t) in a rod of length L if the initial temp is f(x) throughout and the ends are x=0 and x=L are insulated.

Solve if L=2 and f(x) = {x , 0 < x <1
{0 , 1 < x <2

attempt:
k d^2(u)/dx^2 = du/dt ; 0<x<L, t>0
Insulated ends means: u(0,t)=0 u(L,t) = 0
u(x,0)= f(x) ; 0 <x<L
let u(x,t) = X(x)T(t)

d^2(u)/d(x)^2 = TX'' ; du/dt = XT'
kTX'' = XT'

X''/X = T'/(kT) = -λ^2
X'' + λ^2X = 0
T' + λ^2kt = 0
X'(0)=0 X'(L)=0

for λ=0 , X(x) = ax+b
but from the boundary condition a=0 , X(x)=b

for λ^2 > 0
X= acosλx + bsinλx
X' = λ(-asinλx +bcosλx)

this is where i am getting stuck. any help would be great, thanks
You just need to keep going

$X'(0)=0=\lambda (a\cdot 0 +b) \implies b=0$

Now using the other condition gives

$X'(L)=0=\lambda(-a \sin(\lamba L) \iff 0 = \sin(\lambda L) \iff \pi n = \lambda L \iff \lambda =\frac{\pi n}{L}, n \in \mathbb{N}$

Can you finish from here?

3. Is this from a course in fourier analysis? I can provide a solution, but it involves expanding f(x) in a fourier series with the basis $e_n(x)=\sin(n\pi x/L)$

4. so X(x)= acos(nπx/L)

for λ=0 T'=0 so T=c
u=bc

for λ= nπ/L
T' + n^2π^2/L = 0
so T= ce^-(n^2π^2t/L)
u= [sum of] a*c*e^-(n^2π^2t/L)cos(nπx/L)

u(x,t) = bc + [sum of] a*c*e^-(n^2π^2t/L)cos(nπx/L)

what about the second part where L=2
and f(x) = {x , 0 < x <1
{0 , 1 < x <2

5. Originally Posted by linalg123
so X(x)= acos(nπx/L)

for λ=0 T'=0 so T=c
u=bc

for λ= nπ/L
T' + n^2π^2/L = 0
so T= ce^-(n^2π^2t/L)
u= [sum of] a*c*e^-(n^2π^2t/L)cos(nπx/L)

u(x,t) = bc + [sum of] a*c*e^-(n^2π^2t/L)cos(nπx/L)

what about the second part where L=2
and f(x) = {x , 0 < x <1
{0 , 1 < x <2
So what you have is

$u_0(x,t)=A_0$

$u_n(x,t)=A_n\exp\left( -\frac{n^2\pi^2t}{2}\right)\cos\left( \frac{ n \pi x}{2} \right)$

Now use the inner product to find the constants $A_n$. So mutliply both sides by

$\cos(\left( \frac{n \pi x}{2}\right)$ evaluate at t=0 and integrate to get

$A_n\int_{0}^{2} \cos\left( \frac{ n \pi x}{2} \right)\cos\left( \frac{ n \pi x}{2} \right)dx=\int_{0}^{2} \cos\left( \frac{ n \pi x}{2} \right)f(x)dx$

This gives

$A_n=\int_{0}^{1} x\cos\left( \frac{ n \pi x}{2} \right)dx$

6. Both $X(0)=0$ and $X'(0)= 0$ can't be true though.

We have that $u(x,t)=X(x)T(t)$, so $u(0,t)=0 \implies u(0,t)=X(0)T(t)=0 \implies X(0)=0$ since we have assumed that $T(t)\neq 0$

$X(0)=0=A\cos(\lambda \cdot 0)+B\sin(\lambda \cdot 0) = A \implies A=0\implies X(x)=B\sin(\lambda x)$
and
$X'(0)=\lambda B \cos(\lambda \cdot 0)=\lambda B \neq 0$ unless B=0 which is a useless solution.

7. you lost me there. multiply both sides of which equation by cos(nπx/2)? and where did the exponential go.

(p.s sorry if this is really obvious and i just can't see it)

8. Originally Posted by linalg123
you lost me there. multiply both sides of which equation by cos(nπx/2)? and where did the exponential go.

(p.s sorry if this is really obvious and i just can't see it)

$u_n(x,t)=A_n\exp\left( -\frac{n^2\pi^2t}{2}\right)\cos\left( \frac{ n \pi x}{2} \right)$

Now use the initial condition

$u_n(x,0)=A_n\cos\left( \frac{ n \pi x}{2} \right)=f(x)$

Since your basis is a complete orthonormal set use the inner product

$=\int_{0}^{2}f(x)g(x)dx$

and the fact that

$\bigg<\cos\left( \frac{ n \pi x}{2} \right),\cos\left( \frac{ n \pi x}{2} \right) \bigg>=\int_{0}^{2}\cos\left( \frac{ n \pi x}{2} \right)\cos\left( \frac{ n \pi x}{2} \right)dx=1$

9. when i do this i get:

Ao= ∫x dx from 0 to 1 = 1/2

An= ∫xcos(nπx/2)dx
= 2/nπ ∫x(sin(nπx/2))'dx
= [2x/nπsin(nπx/2)] from 0 to 1 - 2/nπ ∫x'sin(nπx/2)dx
= 0 + 4cos(nπx/2)/(n^2π^2)
= 0
this doesn't seem right.. have i made an error?

10. Originally Posted by linalg123
when i do this i get:

Ao= ∫x dx from 0 to 1 = 1/2

An= ∫xcos(nπx/2)dx
= 2/nπ ∫x(sin(nπx/2))'dx
= [2x/nπsin(nπx/2)] from 0 to 1 - 2/nπ ∫x'sin(nπx/2)dx
= 0 + 4cos(nπx/2)/(n^2π^2)
= 0
this doesn't seem right.. have i made an error?
I can really follow what you typed but I get the anti derivative

integrate x&#42;cos&#40;n&#42;Pi&#42;x&#47;2&#41; from x&#61;0 to x&#61;1 - Wolfram|Alpha

11. ok i saw my mistake. i got

An= 2sin(nπ/2)/πn - 4/(π^2n^2) , i think this is the same as yours because the cos(πn/2) term =0

can sin(nπ/2) be simplified? i can't think of a way.

12. Originally Posted by linalg123
ok i saw my mistake. i got

An= 2sin(nπ/2)/πn - 4/(π^2n^2) , i think this is the same as yours because the cos(πn/2) term =0

can sin(nπ/2) be simplified? i can't think of a way.
You should analyze the even and odd terms separately.

$\cos\left( \frac{n\pi}{2}\right)=0, \text{ when } n \text{ is odd and } \pm 1 \text{ when n is even}$

You will ge something similar with sine

13. ah, of course...

so for even n,
An= 4[(-1)^(n/2)-1]/(π^2n^2)

and for odd n,
An= 2[πn(-1)^((n-1)/2)-2]/(π^2n^2)

how do i use proper notation to write this?

(promise that's the last question i'll ask,lol)