# Solve $f(x)' + s x f(x) - r f(x) = 0, \quad f(0) =w$ using stream calculus

The ODE $$f(x)' + s x f(x) - r f(x) = 0, \qquad f(0) =w$$ has the solution $$f(x) = w\exp\left(r x - \frac{1}{2}s x^2\right).$$

I'm trying to obtain this result using Rutten's stream calculus. A key reference for this calculus, containing the identities I refer to below, is here.

I asked a related question here, trying to work "backwards" from the known solution by seeing if anyone could transform the $\exp(x^2)$ term. What follows is my attempt at working "forwards".

Transform, applying identities 75, 80 and 86 \begin{equation*} \mathcal{T}(f)'+s\times \left[\left(X^2 \times\frac{d\mathcal{T}(f)}{dX}\right)+\left(X\times\mathcal{T}(f)\right)\right] - r\times \mathcal{T}(f) \end{equation*} Let $\sigma=\mathcal{T}(f)$ \begin{equation*} \sigma' + s\times\left[\left(X^2\times\frac{d\sigma}{dX}\right)+\left(X\times\sigma\right)\right] - r\times \sigma \end{equation*} Set $\frac{d\sigma}{dX}=\sigma'$, this seems natural but I can't find where it is defined explicitly \begin{equation*} \sigma'+ s\times\left[\left(X^2\times\sigma'\right)+\left(X\sigma\right)\right] - r\times\sigma \end{equation*} Edit: As user md2perpe points out below this is in fact wrong. Correct identity is $\frac{d\sigma}{dX}=(X\times\sigma')'$. And seeing as Prof. Rutten is sceptical of a closed form expression involving $\exp(X^2)$ (see comment in the "backwards" question referenced above), I'm not going to invest time in further derivations. I'll leave the original derivation starting from the incorrect premise here for posterity:

Simplify \begin{equation*} \sigma'+ s\times X^2\times\sigma'+s\times X\times\sigma - r\times \sigma \end{equation*} Drop the `convolution product' notation (I don't think this will get us into trouble) \begin{equation*} \sigma' + sX^2\sigma' + sX\sigma - r\sigma \end{equation*} Apply the fundamental theorem (4.1) \begin{equation*} (\sigma - w)/X + s X^2(\sigma-w)/X + sX\sigma -r\sigma \end{equation*} Simplify \begin{equation*} (\sigma - w)/X + s X(\sigma-w) + sX\sigma -r\sigma \end{equation*} Simplify \begin{equation*} \sigma/X - w/X + s X\sigma-sXw + s X\sigma -r\sigma \end{equation*} Group \begin{equation*} \sigma(1/X +2 s X - r) - w/X + -sXw \end{equation*} Rearrange \begin{equation*} \sigma= (w/X + sXw) / (1/X + 2 s X - r) \end{equation*} Simplify (multiply by $X$) \begin{equation*} \sigma= \frac{w + sw X^2}{1 - r X + 2 s X^2 } \end{equation*} Then \begin{equation*} \sigma= w \left(\frac{1}{1 - r X + 2 s X^2 } + \frac{s X^2}{1 - r X + 2 s X^2 } \right) \end{equation*} Using partial fractions and factoring the denominator we get \begin{equation*} \sigma= w \left(\frac{\sqrt{r^2-8s}}{(r + \sqrt[]{r^2 - 8s})/2 +X} - \frac{\sqrt{r^2-8s}}{(r - \sqrt[]{r^2 - 8s})/2 + X} + \frac{1}{2} + \frac{r X }{2 - 2r X + 4 s X^2} - \frac{1}{2 -2r X + 4 s X^2} \right) \end{equation*} Which becomes \begin{equation*} \sigma= w \left(\frac{\sqrt{r^2-8s}}{(r + \sqrt[]{r^2 - 8s})/2 +X} - \frac{\sqrt{r^2-8s}}{(r - \sqrt[]{r^2 - 8s})/2 + X} + \frac{1}{2} + \frac{1}{2}\left(\frac{r X }{1 - r X + 2 s X^2} - \frac{1}{1 -r X + 2 s X^2} \right) \right) \end{equation*} Then applying partial fractions again with more factoring this becomes \begin{equation*} \sigma= \frac{w}{2} \left( \frac{\sqrt{r^2-8s}}{(r + \sqrt[]{r^2 - 8s})/2 +X} - \frac{\sqrt{r^2-8s}}{(r - \sqrt[]{r^2 - 8s})/2 + X} + \frac{\sqrt{r^2-8s} r X}{(r + \sqrt[]{r^2 - 8s})/2 +X} - \frac{\sqrt{r^2-8s} r X}{(r - \sqrt[]{r^2 - 8s})/2 + X} + 1 \right) \end{equation*} Now let $a=\sqrt{r^2-8s}$. Then \begin{equation*} \sigma= \frac{w}{2} \left( \frac{2a}{r + a} \left( \frac{1}{1+2(r + a)^{-1} X} + \frac{r X}{1+2(r + a)^{-1} X} \right) - \frac{2a}{r - a} \left( \frac{1}{1+2(r - a)^{-1} X } + \frac{r X}{1+2(r - a)^{-1} X} \right) + 1 \right) \end{equation*} Back-transform, using identities (82) and (83) \begin{equation*} \begin{split} f(x)&= w \left[ \frac{a}{r + a} \left( \exp\left(\sqrt[]{2(r + a)^{-1}}x\right) + \frac{\sqrt[]{2(r+a)^{-1}}}{r} \sin\left(\sqrt[]{2(r+a)^{-1}} x\right) \right) \right.\\ - &\left. \frac{a}{r - a} \left( \exp\left(\sqrt[]{2(r - a)^{-1}}x\right) + \frac{\sqrt[]{2(r-a)^{-1}}}{r} \sin\left(\sqrt[]{2(r-a)^{-1}} x\right) \right) + 1 \right] \end{split} \end{equation*}

This doesn't seem right.

• The formula $\frac{d\sigma}{dX}=\sigma'$ is not correct. According to eq. (61) the definition is $\frac{d\sigma}{dX}=(X \otimes \sigma')'.$ – md2perpe Aug 13 '18 at 15:23