I'm interested in finding the general solution $f(x)$ of the equation: $(1+x)f'(x)+(f(x/2)-f(x))=-1$, $x\ge0$. Can Mathematica help here? For instance, it is easy to verify that the (slightly different) equation $(1+x)f'(x)+2(f(x/2)-f(x))=-1$ is solved by $f(x)=C-x$ where $C$ is an arbitrary constant. Can Mathematica help reach this conclusion?

  • $\begingroup$ Did you check RSolve? $\endgroup$ Apr 10, 2017 at 1:29
  • $\begingroup$ Yes, to no avail. It doesn't seem to understand derivatives. $\endgroup$
    – Alex
    Apr 10, 2017 at 1:34
  • $\begingroup$ I had no luck with either DSolve or NDSolve. DSolve[(1 + x) f'[x] + f[x/2] - f[x] == -1, f, x] gave DSolve::litarg error. NDSolve[{(1 + x) f'[x] + f[x/2] - f[x] == -1, f[0] == 1}, f, {x, 0, 1}] gave NDSolve::cdelay error, saying "the method currently implemented for delay differential equations does not support delays that depend directly on the time variable or dependent variables." $\endgroup$
    – Chris K
    Apr 10, 2017 at 2:27
  • $\begingroup$ @ChrisK: I had exactly the same issues. $\endgroup$
    – Alex
    Apr 10, 2017 at 15:06

1 Answer 1


A small number of Taylor coefficients in $x=0$ is enough for FindSequenceFunction to provide the whole Taylor series:

n = 10;
res = First[# /. Solve[Thread[Table[SeriesCoefficient[(1 + x) f'[x] + f[x/2] - f[x],
        {x, 0, i}], {i, 0, n}] == Table[SeriesCoefficient[-1, {x, 0, i}], {i, 0, n}]],
            #] &[Table[Derivative[i + 1][f][0], {i, 0, n}]]]
Sum[x^i/i! FindSequenceFunction[res, i], {i, 0, m}] + C[1]

$C[1] + \sum _{i=0}^m -\frac{x^i \prod _{K[1]=1}^{i-1} -2^{-K[1]} \left(2^{K[1]} K[1]-2^{K[1]}+1\right)}{i!}$

If f is replaced by this series in the equation, it is not hard to see that summing up to some m yields something with the form $c\ x^m$. (First include in each of the sums only the 1 or 2 terms that adds some $x^{m-1}$ and expand to see that $x^{m-1}$ disappears, hence after summing the first $m$ terms, there is only $c\ x^m$ that can have a non-zero coefficient). Now sum to $m$, discard all but the $x^m$ terms and simplify to see that $|c\ x^m|$ equals $$|x|^m\prod _{K[1]=1}^m \frac{2^{-K[1]} \left(2^{K[1]} K[1]-2^{K[1]}+1\right)}{K[1]}$$

The factors in the product are all less than one, so the error of the Taylor series decrease to $0$ as $m\to \infty$ if (and probably only if) $|x|\leq 1$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.