# Assignment 4

Due on November 16 at 11:59pm electronically via email.

## How to submit the assignment

Use a word-processor like Microsoft Word or LibreOffice (free), or $$\LaTeX$$ (also free) to create a single PDF file with all of your answers. If you want to include code, do not put them in this file. This file should include your graphs, equations, tables, and explanations. The name of this file should have the following format: LASTNAME_STUDENTNUMBER_4.pdf. You can hand-write your answers, but you will have to scan your papers, or take a picture of them. In any case, send me one PDF file. I will not accept paper submissions.

If you want to include multiple code files (.m or .py files), put them all in one folder, zip the folder, and send me only one zip file. The name of this file should look like this: LASTNAME_STUDENTNUMBER_A4.zip

Attach both files to an email and send it to msamani[at]fields.utoronto.ca. Make sure the title of the email starts with MATH3090.

Question 1: Use the finite difference method to solve the following elliptic partial differential equation: $$\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} = 4 \; , \; 0 < x < 1 \; , \; 0 < y < 2 \\ u(x,0) = x^2 , \; u(x,2) = (x-2)^2 , \; 0 \le x \le 1 \\ u(0,y) = y^2 , \; u(1,y) = (y-1)^2 , \; 0 \le y \le 2$$ Use $$h = k = \frac{1}{2}$$ (mesh-spacing in $$x$$ and $$y$$ directions) and compare the results to the actual solution $$u(x,y) = (x-y)^2$$ in a table.

Question 2: Use the implicit method to solve the following partial differential equation: $$\frac{\partial u}{\partial t} - \frac{\partial^2 u}{\partial x^2} = 0 \; , \; 0 < x < 2 \; , \; 0 < t \\ u(0,t) = u(2,t) = 0 , \; 0 \le t \\ u(x,0) = \sin (\pi x /2) , \; 0 \le x \le 2$$ Use $$m=4$$ (this means your grid point indices should run from $$x_i = 0h, 1h, ..., mh\$$ where $$mh=2$$). Also final time $$T=0.1$$ and the number of time steps $$N=2$$. Compare the results with the exact solution $$u(x,t) = e^{-\pi^2t/4}\sin(\pi x/2)$$ in a table.

Questions from the textbook:

8.7 (elnino)