# Heat equation with boundary conditions

Hi. I'm trying to solve the heat equation with the initial boundary conditions:

$$u(0,t)=f_1(t)$$
$$u(x_1,t)=f_2(t)$$
$$u(x,0)=f(x)$$
$$0<x<x_1$$
$$t>0$$

And the heat equation: $$\frac{\partial u}{\partial t}-k\frac{\partial^2 u}{\partial x^2}=0$$

So when I make separation of variables I get:
$$\nu=X(x)T(t)$$
$$\frac{T'(t)}{T(t)}=k\frac{X''(x)}{X(x)}$$

Then I have to solve for X
$$kX''(x)-\lambda X(x)=0$$
With the initial boundary conditions
$$X(0)=f_1(t)$$
$$X(x_1)=f_2(t)$$

And for T:
$$T'(t)-\lambda T(t)=0$$
With initial value:
$$T(0)=f(x)$$

How should I proceed from here? I'm not sure how to make this accomplish the boundary conditions.

Bye, thanks.

Last edited:

Have you heard of the solution method called Variation of Parameters?

Yes, I've used it before for ordinary differential equations, but never with partial differential equations. I've seen in weinberger book that in the case of Laplace equation in a rectangle, with boundary conditions like this, but in space, lets say:
$$\frac{\partial^2 u}{\partial x^2}+\frac{\partial^2 u}{\partial x^2}=0$$
$$0<x<\pi$$
$$0<y<A$$

With boundary conditions:
$$u(x,0)=f_1(x)$$
$$u(\pi,y)=f_2(y)$$
$$u(x,A)=f_3(x)$$
$$u(B,y)=f_4(y)$$

The book says that four different differential equations must be solved, in each of which all but one of the four functions $$f_i$$ is replaced by zero and adding the four solutions. There are no examples, just mention it, and I think the problem I'm dealing with is quiet different, because I have the boundary condition like mixed.

I'm trying to solve this, because I've made my laboratory work about this equation on a copper bar, and we made the foolish mistake of forgiving to measure the temperature on the boundaries. So we decided to take as the boundary conditions the one on the first thermocouple, which is a temperature in function of time for that position, which is taken as the boundary. And I haven't given my final exam on partial differential equation yet, I saw on the last semester the methods of resolution for some partial differential equations, fourier series, fourier transform, orthogonal functions, eigenvalues, etc, but I haven't make many exercises on partial differential equations yet, so I'm not really familiar with these methods.

Thanks for posting LawrenceC.

Last edited:
Looks like you are thinking of superposition. I've used variation of parameters for the Fourier equation (which is what you have). A good reference on it is Analytical Methods In Conduction Heat Transfer by Glen E. Myers. Initially you set all boundary conditions to zero which makes the problem homogeneous. Eigenfunctions become sin(n*pi*x) due to BC's. Then you assume a solution t(x,theta)= summation over n of (An(theta)*sin(n*pi*x)). Differentiate WRT theta and solve ODE for An using boundary conditions.

Thanks LawrenceC, I'll see what I can do, and I'll be back later.

I think I found the solution in Carslaw, conduction of heat in solids.

This is the solution given by the book, tell me if its right, and I've got a few questions to ask you about it:

$$\frac{\partial u}{\partial t}-k\frac{\partial^2 u}{\partial x^2}=0$$
$$u(0,t)=\phi_1(t)$$
$$u(l,t)=\phi_2(t)$$
$$u(x,0)=f(x)$$
$$0<x<l$$
$$t>0$$

The solution:
$$u=\frac{2}{l} \sum_{0}^{\infty} e^{\frac{-kn^2 \pi^2 t}{l^2}} \sin \frac{n \pi x}{l} \left[ \int_0^l f(x') \sin {n \pi x'}{l}dx'+\frac{nk\pi}{l} \int_0^t e^{\frac{kn^2\pi^2\lambda}{l^2}} \left( \phi_1 (\lambda) -(-1)^n \phi_2(\lambda) \right) d\lambda \right]$$

The book effectively uses some kind of superposition, as you said.

Last edited: