I am a physics student, and have had to use Green's function methods prior (in electrodynamics for example), but things were always badly explained. Now I am trying to brush up on things a bit and figured I'd try to solve some very simple ODEs (that can be otherwise integrated).
Problem is I am not getting sensible results, and I don't even know how can I incorporate boundary conditions into the problem.
Example calculation:
Consider the linear ODE $ f'+\alpha f=g $ where $\alpha$ and $g$ are constants. The linear operator is then $$L=\frac{d}{dx}+\alpha,$$ moreover, since this is a translation-invariant operator, we will have $G(x,x')=G(x-x')$.
Let's assume initial conditions are given by $f(0)=Q$.
Then this equation can be integrated to give $$ f(x)=\left(Q-\frac{g}{\alpha}\right)e^{-\alpha x}+\frac{g}{\alpha}. $$
Now I'll try to solve this ODE using a Green's function method. Let $G(x-x')$ be the Green's function satisfying $$ L_{(x)}G(x-x')=\delta(x-x'), \\ \frac{d}{dx}G(x-x')+\alpha G(x-x')=\delta(x-x'). $$
I have no idea how to proceed, so I'm gonna take a Fourier transform. I have no idea if it is even well defined here or not, but physicists have done worse:
$$ G(x-x')=\int G(k)e^{-ik(x-x')}\ dk, \\ \delta(x-x')= \int\frac{1}{2\pi}e^{-ik(x-x')}\ dk.$$
I get the following for Fourier-components: $$ (\alpha-ik)G(k)=\frac{1}{2\pi}, $$ so $$ G(x-x') =\frac{1}{2\pi}\int\frac{1}{\alpha-ik}e^{-ik(x-x')}\ dk.$$
This integral doesn't converge but I don't worry, as $G$ might just be a singular distribution. Instead, we have $$ f(x)=\int G(x-x')g\ dx'=\frac{g}{2\pi}\int dk\frac{1}{\alpha-ik}e^{-ikx}\int dx'e^{ikx'} \\ =g\int dk \frac{1}{\alpha-ik}e^{-ikx}\delta(k)=\frac{g}{\alpha}. $$
This certainly provides a solution of the equation, but not what I want. And I'm not surprised it didn't work, I didn't specify initial/boundary conditions. Probably when I took the Fourier transform, I accidentally gave some bogus boundary conditions, like $f$ should be zero in infinity or something, but I don't know.
Question: What went wrong? I assume initial/boundary conditions, but how can I control them? How can I specify what initial/boundary conditions do I want? How do I find Green's function for proper initial/boundary conditions? Was taking the Fourier transform the wrong move there?
Green's function method requires homogeneous boundary conditions; that's the only way for solutions to form a linear space. So let's consider the condition $f(0)=0$ for now. To solve the equation $$\frac{d}{dx}G(x-x')+\alpha G(x-x')=\delta(x-x')$$ we need a function $G$ that jumps up by $1$ at $0$ (the derivative of such jump is the Dirac delta), and solves $G'+\alpha G=0$ elsewhere. That is, $G(t)=e^{-\alpha t}H(t)$ where $H$ is the Heaviside function. Subsequently, $$ f(x) = \int_0^\infty g e^{-\alpha(x-x')}H(x-x')\,dx' = g\int_0^{x} e^{-\alpha(x-x')}\,dx' = \frac{g}{\alpha}(1-e^{-\alpha x}) $$
But that was for $f(0)=0$. To solve the original problem $f(0)=Q$, write $f = Q + \tilde f$, where $\tilde f$ solves $\tilde f'+\alpha \tilde f = g-\alpha Q$. So the above applies with $g$ replaced by $g-\alpha Q$, and yields $$ \tilde f(x) = \frac{g-\alpha Q}{\alpha}(1-e^{-\alpha x}) = \left(Q-\frac{g}{\alpha}\right) e^{-\alpha x} + \frac{g}{\alpha}-Q $$ Thus $f=Q+\tilde f$ is exactly the solution you expected.