Question:
Solve the Poisson equation
Include your code.
Answer:
The different right hand side does not change the Green’s function of the one-dimensional Poisson equation. However, the exact solution is of course different; you find it is .
To numerically find that solution, you might consider adapting the program used to produce the example in the text. That program consisted of the matlab or octave files gf1d_run.m, gf1d_f.m, gf1d_sumgf.m, and gf1d_u_exa.m.
You may want to experiment with the size of the interval outside of which you can ignore the right hand side in your Poisson equation. However, the right hand side does fortunately become negligible quickly.
Another thing you could try is evaluate exactly, rather than approximate it as . I suspect that this will give much better results when using small numbers of wide spikes.