Here's one way to use your original idea of central differences to get a numerical solution by solving a linear system.
Imagine that our domain for $f(x)$ is to be $[0,1]$, and that $f(0)=0$ is specified as the initial condition. For a grid we will choose $n$ equally spaced points, $x_k = k/n$ for $k=0,\ldots,n$.
Now we assemble the following linear system based on the central difference approximation to the derivative:
$$ \frac{f(x_k) - f(x_{k-1})}{x_k - x_{k-1}} = b\left( \frac{x_k + x_{k-1}}{2} \right) $$
for $k = 1,\ldots,n$. Since $x_k - x_{k-1} = 1/n$, the above simplifies to:
$$ f(x_k) - f(x_{k-1}) = (1/n)\cdot b\left( \frac{x_k + x_{k-1}}{2} \right) $$
Now the system of unknowns $f(x_k), k=0,1,\ldots,n$ has a unique solution. Since $f(x_0) = f(0) = 0$ is known, the remaining unknowns are expressed as summations:
$$ f(x_k) = \sum_{i=1}^k (1/n)\cdot b\left( \frac{x_i + x_{i-1}}{2} \right) $$
In other words the solution is just keeping a running sum of the indicated terms. In a calculus course this would be called using the Midpoint Rule to approximate the integral.
Possibly you will object to evaluating the given function $b(x)$ at the midpoints of the intervals $[x_{k-1},x_k]$ on the grounds that these are not grid points. In that case we could replace the values of $b(x)$ at the midpoints with the average of values at the endpoints of intervals:
$$ b\left( \frac{x_k + x_{k-1}}{2} \right) \approx \frac{b(x_k) + b(x_{k-1})}{2} $$
With this substitution in the system of linear equations we obtain the numerical quadrature scheme known as the Trapezoid Rule. Since only right-hand side of the linear system is changed by this replacement, our sketch of an explicit solution is still valid with the necessary substitution inside the running summation.
I dont really understand for what I need to specify inital values and how this turns into an additional equation in my system. Specifying an initial condition for $f(x)$ would mean that I need to specify an additional equation for each element of my grid as far as I understand.
– dkoerner Mar 15 '17 at 12:19The problem for me is, that I have a delta distribution within the domain and therefore can not provide dirichlet-BC. Maybe your approach could be extended. It seems that we then would get something akin to the fast marching method.
– dkoerner Mar 15 '17 at 13:41