Final solution to Poisson's equation: ``poisson.m''

With the operators coded, you are one line away from the solution to Poisson's equation!

Uncomment the remaining lines in ``poisson.m'' and replace the ``...'' on the line labeled ``CODE INSERTION # 2'' with your single line solution to Poisson's equation. You may then run ``poisson.m'' to check your results!

To confirm your solution, ``poisson.m'' first takes the real part (due to rounding errors and that fact that the Fourier transformation is complex, tiny imaginary parts creep into your solution), and then plots slices of your solution through planes passing through the center point of the cell. Finally, ``poisson.m'' compares the known analytic result with the integral for the total Coulomb energy, $U=(1/2)\int\, n\phi$, obtained with your numerical solution for $\phi$.

Hint: The comparison of energies should agree to four significant figures.



Tomas Arias 2004-04-08