1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

1D Heat Equation BC: Both ends insulated, IC: piecewise function

  1. Oct 26, 2008 #1


    User Avatar

    1. Solve the one dimensional heat equation for a rod of length 1 with the following boundary and initial conditions:

    BC: [tex]\partial[/tex]u(0,t)/[tex]\partial[/tex]t = 0
    [tex]\partial[/tex]u(1,t)/[tex]\partial[/tex]t = 0 these are the wrong boundary conditions (see below)

    Actual BC: [tex]\partial[/tex]u(0,t)/[tex]\partial[/tex]x = 0
    [tex]\partial[/tex]u(1,t)/[tex]\partial[/tex]x = 0

    u(x,0) = { 1 if 0[tex]\leq[/tex]x[tex]\leq[/tex].5
    u(x,0) = { 0 if .5<x[tex]\leq[/tex]1

    2. [tex]\partial[/tex]u/[tex]\partial[/tex]t = a2[tex]\partial[/tex][tex]^{2}[/tex]u/[tex]\partial[/tex]x[tex]^{2}[/tex]


    I used separation of variables and applied the boundary conditions to get the following:
    u(x,t) = e(-(a2)(n*Pi)2*t) * (B*cos(n*Pi*x)) where
    n= 1, 2, 3... and B is an unknown constant.

    To find B I tried applying the initial conditions and thats where I got stuck because I got.

    u(x,0) = 0 = B*cos(n*Pi*x) if 0[tex]\leq[/tex]x[tex]\leq[/tex].5
    u(x,0) = 1 = B*cos(n*Pi*x) if .5<x[tex]\leq[/tex]1

    Does this mean that B has two values depending on x? And if is so are those values:

    B = 0 for 0[tex]\leq[/tex]x[tex]\leq[/tex].5
    B = 1/cos(n*Pi*x) for .5<x[tex]\leq[/tex]1

    As a follow-up, will the steady state of this heat equation problem be a piecewise function?
    Last edited: Oct 26, 2008
  2. jcsd
  3. Oct 26, 2008 #2


    User Avatar
    Homework Helper
    Gold Member

    Shouldn't it be a sine instead of a cosine? (take a look at your BCs cos(0)=1 not 0)

    Also, since that solution satisfies the heat equation and your boundary conditions for any integer value of n, shouldn't the general solution be a linear combination of each of your solutions, namely:

    [itex]u(x,t)=\sum_{n=0}^{\infty} u_n(x,t)=\sum_{n=0}^{\infty}B_ne^{-a^2n^2 \pi^2 t}sin(n \pi x)[/itex]


    Remember, your B_n's are constants so they cannot depend on x. Use Fourier's method to determine them.
  4. Oct 26, 2008 #3


    User Avatar

    Sorry, I miss-typed the boundary conditions, the boundary conditions are supposed to be:

    [tex]\partial[/tex]u(0,t)/[tex]\partial[/tex]x = 0
    [tex]\partial[/tex]u(1,t)/[tex]\partial[/tex]x = 0

    I'll edit it to the correct version in the original post too.

    So I think that the solution is the linear combination:

    [tex]u_{n}(x,t) = [/tex][tex]\sum(B_{n}e^{-a^2n^2\pi^2t}cos(n\pi\\x))[/tex] going from n = 1 to infinity

    So now I set the sum equal to initial condition right?

    I get:

    [tex]u_{n}(x,0) = 1 = \sum(B_{n}cos(n\pi\\x))[/tex] for 0<=x<=1/2

    I use fouriers method to find the B's in each interval:

    [tex]B_{n} = 2 \int^{1/2}_{0}cos(n\pi\\x)= 2 sin(n\pi\\x)/(n\pi)\right|^{1/2}_{0}
    = 2(sin(n\pi/2)/(n\pi) = 2(-1)^n/(n\pi)[/tex]

    Unfortunately I'm stuck again, when I try to solve for the B's in the interval 1/2<x<=1

    I get:

    [tex]u_{n}(x,0) = 0 = \sum(B_{n}cos(n\pi\\x))[/tex]

    [tex]B_{n} = 2 \int^{1}_{1/2} 0*cos(n\pi\\x) = 0 [/tex]

    Is this correct? Are the B's for 1/2<x<=1 all 0?

    And sorry again about giving the wrong boundary conditions!
  5. Oct 26, 2008 #4


    User Avatar
    Homework Helper
    Gold Member

    Okay, so doesn't that mean that

    [itex] \sum_{n=0}^{\infty} B_n cos(n \pi x)=u(x,0)=\left\{ \begin{array}{lr} 1, & 0 \leq x \leq 0.5 \\ 0, & 0.5< x \leq 1 \end{array}[/itex]

    [itex]\Rightarrow \sum_{m=0}^{\infty} \int_0^1 B_m cos(m \pi x) cos(n \pi x)dx = \int_0^1 u(x,0) cos(n \pi x) dx=\int_0^{0.5} (1)cos(n \pi x) dx+ \int_{0.5}^1 (0)cos(n \pi x) dx[/itex]


    Remember, your B_n's are constant so they must be the same for all values of x.
  6. Oct 26, 2008 #5


    User Avatar


    so [tex]\int^{1}_{0}cos(n\pi\\x)*cos(m\pi\\x) = 0[/tex] if [tex] m \neq n[/tex]

    so, I've taken the integral of


    And assuming n = positive integer I get

    [tex]\int^{1}_{0}cos(n\pi\\x)^2dx = 1/2 [/tex]

    and I know that [tex]\int^{1}_{0}u(x,0)cos(n\pi\\x)dx = -1^n/(n\pi) [/tex]

    So I get

    [tex]\sum^{\infty}_{n=1}B_{n}(1/2) = (-1)^n/(n\pi) [/tex]

    Reading from my textbook and online I am guessing I should multiply both sides by 2 (or divide by 1/2) which would yield the same answer as in my previous post:

    [tex]B_{n} = 2(-1)^n/(n\pi)[/tex]

    But I am confused by this last step: How does multiplying by both sides by 2 "remove" the [tex]B_{n}[/tex] from out of the summation? Wouldn't it just remove the 2 from the summation and the left hand side of the equation would just be


    I realize that I am expected to know these things before I enter a partial differential equations course, but after taking 7 college math classes I still haven't learned these basic principles of sums and it's really holding me back.

    Oh, and thanks for the help so far gabbagabbahey, but I still have much to learn.
  7. Oct 26, 2008 #6


    User Avatar
    Homework Helper
    Gold Member

    The summation sign is removed when you integrate [itex]\sum_{m=0}^{\infty} \int_0^1 B_m cos(m \pi x) cos(n \pi x)dx[/itex], because the only term that is non-zero is m=n

    [itex]\Rightarrow \sum_{m=0}^{\infty} \int_0^1 B_m cos(m \pi x) cos(n \pi x)dx=\frac{B_n}{2}+ \sum_{m \neq n} (0)B_m=\frac{B_n}{2}[/itex]

    [itex]\Rightarrow \frac{B_n}{2}=\frac{(-1)^n}{n \pi}[/itex]


    [itex]B_n=\frac{2(-1)^n}{n \pi}[/itex]
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: 1D Heat Equation BC: Both ends insulated, IC: piecewise function