# Assignment 3

As every grade school child knows, the solution to the initial value problem for the heat equation \begin{align} u_t =u_{xx}\quad &0\lt x\lt 2\pi,\ t>0\\ \quad u_x(0,t) &= 0 = u_x(0,2\pi)\\ u(x,0) &= e^{x/\pi}-1 \end{align} has the form $u(x,t) = \frac{a_0}2+ \sum_{n=1}^\infty a_n\exp\left(-\frac{n^2t}4\right) \cos\left(\frac{nx}2\right),$ where $a_n = \frac1\pi \int_0^{2\pi} \left(e^{x/\pi}-1\right)\cos\left(\frac{nx}2\right)\,dx \ \text{for}\ n=0,1,2,\dots.$ Write a function that uses Sympy to compute the coefficients $$a_n$$ for $$n=0,1,2,\dots,N$$, for any $$N$$ we specify. Use that function to make two plots. The first is just the first two terms of the solution to the given heat equation at times $$t=0,2,4,6,$$ and $$8$$, together with the initial condition function $$e^{x/\pi}-1$$. To be clear, this is a 2D plot with 6 curves on it, representing slices of the solution at different times, together with the initial condition. The second plot is the same thing using terms of the series solution up to $$n=12$$.

You will email the Python script file to the instructor to turn the assignment in. The assignment is worth 25 points and is due in the instructor's email inbox by 9:00 AM on Monday, 30 April.

Assignment 3 is posted.

Department of Mathematics, PO Box 643113, Neill Hall 103, Washington State University, Pullman WA 99164-3113, 509-335-3926, Contact Us
Copyright © 2009-15 Kevin Cooper