# Thread: the general solution to a first order ODE

1. ## the general solution to a first order ODE

I have a ODE shown as below：
m(dx/dt)=ax-b(dx/dt)+c(integrate (dx/dr)/((t-r)^(1/2)) (0,t))

in which m, a, b and c are constants, and the part
integrate (dx/dr)/((t-r)^(1/2)) (0,t) means the integration of the expression

(dx/dr)/((t-r)^(1/2)) with respect to r, from 0 to t.
The rest parts of the equation is OK to handle; it is just this integration.

Thanks~

2. Hi. Never seen one like that before. Looks like it's:

$\displaystyle k\frac{dx}{dt}=ax+c\int_0^t \left(\frac{d}{dr}x(r)\right) \frac{1}{\sqrt{t-r}}dr$

First thing I notice is the integral is in the form of a convolution:

$\displaystyle \mathcal{L}\left\{\int_0^t F(r)G(t-r)dr\right\}=f(s)g(s)$

where f(s) and g(s) are the Laplace Transforms of F(r) and G(r). So I do that in desperation cus' I don't know what else to do and I end up with the expression:

$\displaystyle \mathcal{L}^{-1}\left\{\frac{kx_0-c x_0 \sqrt{\pi/s}}{ks-a-c\sqrt{\pi s}}\right\}$

which Mathematica can't invert so then I consider:

$\displaystyle \mathcal{L}^{-1}\left\{\frac{kx_0-c x_0 \sqrt{\pi/s}}{ks-a-c\sqrt{\pi s}}\right\}=\frac{1}{2\pi i}\mathop\int\limits_{c-i\infty}^{c+i\infty} \frac{kx_0-c x_0 \sqrt{\pi/s}}{ks-a-c\sqrt{\pi s}}e^{st}ds$

or just for now, collapse it down to:

$\displaystyle \mathop\int\limits_{c-i\infty}^{c+i\infty} \frac{1- \sqrt{\pi/s}}{s-1-\sqrt{\pi s}}e^{st}ds$

That's an interesting contour integral to evaluate (if it converges), probably with a slit along the real axis from $\displaystyle (-\infty,0]$ with an indentation around the origin.

There was a thread here of late about "exploring mathematics". Yeah, this is where I'd be heading.

Maybe though there is an easier way.

3. I've made some progress which gives me some encouragement the inverse transform is convergent. The code below numerically integrates the Bromwich integral with all parameters equal to one including the initial condition x(0)=1 and since the imaginary component is odd and the real even (by just plotting them), I just multiply the real part by 2 (but the 2i cancel) and integrate from s=6+0i to s=6+500i (since the pole in the denominator is at about 4.9) for t in the range of (0,1). I then fit the data to a 10-degree polynomial and then back-substitute that polynomial into the IDE and then compare plots of the left and right side of the equation by superimposing them. The plot below shows at least in this range, good agreement.

Code:
u[s_] := (1 - Sqrt[Pi/s])/(s - 1 - Sqrt[Pi*s]);
myTable = Table[{tval, (1/Pi)*Re[NIntegrate[u[s]*Exp[s*t] /.
{t -> tval, s -> 6 + I*y}, {y, 0, 500}]]}, {tval, 0.01, 1, 0.05}];
g[t_] = Sum[Subscript[a, n]*t^n, {n, 0, 10}]
theCoeff = Table[Subscript[a, n], {n, 0, 10}]
mycoef = FindFit[myTable, g[t], theCoeff, t]
mysol[t_] := g[t] /. mycoef;
leftside = D[mysol[t], t]
rightside = mysol[t] + Integrate[D[mysol[r], r]*(1/Sqrt[t - r]), {r, 0, t},
Assumptions -> t > 0]
left = Plot[leftside, {t, 0, 1}, PlotStyle -> Blue]
right = Plot[rightside, {t, 0, 1}, PlotStyle -> Red]
Show[{left, right}]

4. So I use the contour below and we're looking for the purple path so that for the IVP:

$\displaystyle k\frac{dx}{dt}=a x+c\int_0^t \left(\frac{d}{dr}x(r)\right) \frac{1}{\sqrt{t-r}}dr,\quad x(0)=x_0,\quad t\geq 0$

arrive at the general solution:

$\displaystyle x(t)=\sum_{n=1}^N\mathop\text{Res}\limits_{s=s_n}\ left(\frac{x_0(k-c\sqrt{\pi/s}}{k s-a-c\sqrt{\pi s}}e^{st}\right)+\frac{a c x_0}{\sqrt{\pi}}\int_0^{\infty}\frac{1}{\sqrt{r}\l eft[a^2+2 ak r+r(c^2\pi+k^2r)\right]}e^{-rt}dr$

where the sum is over the number of poles (0,1, or 2) that lie in the contour. I haven't rigorously checked it but it does give good numerical agreement when test cases are back-substituted into the IDE.