Comparing numerical and analytic solutions to the diffusion eq.
1. Here you will compare the solution to the diffusion equation obtained by numerical methods, to that obtained analytically from separation of variables.
If you look at the hints file Download hints file, you'll see we're discretizing the one dimensional diffusion eq. and applying boundary conditions to the two ends at x = 0 and x = length-1.
- Look at the line labeled A in the hints file. What does this mean? The two boundary conditions are being applied below that line. You should be able to see what they are. Note that in python P[-1] is the same as P[ArrayLength - 1].
- By Taylor expanding this equation in space and time, obtain the diffusion equation and figure out the diffusion coefficient.
- Now calculate the analytic solution to the diffusion equation you found with the same boundary conditions. Boas has section on how to do that.
- Implement that in a function called analytic, as shown in the hints file.
- Run your code and look at the plots you see.
- For what times is the analytic solution most useful, and where does it look like a poor approximation to the actual physics of a diffusing system?
2. Give an example of a system where motion can be characterized by one dimensional diffusion over sufficiently large distances. An example could involve one dimensional structures common in neurobiology. Give an example of a paper that supports this kind of model. Can you think of an experimental situation (can be hypothetical) where the above boundary conditions would be applicable?