Finding general solution to DE subject to initial condition

310 Views Asked by At

How do we solve the following Differential Equation?

$$2 x''' + xx'' =0$$

Subject to conditions:

$$ x(0)=0$$ $$ x'(0)=0$$ $$ x'(\infty)=1$$

Is there any numerical method to solve it or some general method??

4

There are 4 best solutions below

0
On

Numerically there does not seem to be any problem, $T=20$ as approximation of $T=\infty$ appears large enough, the solution can be computed via boundary value solver, here python's scipy.integrate.solve_bvp:

T = 20
def x_ode(t,x): return [x[1], x[2], -0.5*x[0]*x[2]] 
def x_bc(x0, xT): return [x0[0], x0[1], xT[1]-1]

s = np.linspace(0,1,11);
t_init = T*s
x_init = [ T*s , 1+0*s, 0+0*s ]

res = solve_bvp(x_ode, x_bc, t_init, x_init, tol=1e-5, max_nodes=80000)

print res.message

with the result

The algorithm converged to the desired accuracy.

The plot of function and derivative

plot of function and derivative

is then produced via

if res.success:
    plt.figure(figsize=(9,6))
    plt.subplot(211); plt.plot(res.x, res.y[0], '-'); plt.grid();
    plt.subplot(212); plt.plot(res.x, res.y[1], '-'); plt.grid(); 
    plt.show()

second approach

To transform the problem to a finite interval the boundary conditions suggest to use $s=x'$, $s\in[0,1]$, as new independent parameter, thus using the inverse function $u$ to $x'$, $t=u(x')$, $x=v_0(x')$, $v_1(s)=x'(u(s))=s$, $v_2(s)=x''(u(s))$ which leads to the derivatives \begin{align} 1=\frac{dt}{dt}&=u'(x'(t))x''(t)\\ \frac{dt}{ds}&=u'(s)=\frac1{v_2(s)}\\ \frac{dv_0(s)}{ds}&=x'(u(s))u'(s)=\frac{s}{v_2(s)}\\ \frac{dv_2(s)}{ds}&=x'''(u(s))u'(s)=-\frac{v_0(s)}{2} \end{align} To get $v_0(s)\to\infty$ for $s\to 1$ we need $v_2(1)=0$ along with $u(0)=0$ and $v_0(0)=0$. To desingularize $1/v_2$ the approach using $v_2/(\epsilon^2+v_2^2)$ works best.

eps = 1e-8
def uv_ode(s,y): 
    u, v0, v2 = y; 
    v2inv = v2/(eps**2+v2**2); 
    return [v2inv, s*v2inv, -0.5*v0]

def uv_bc(u0, u1): 
    return [ u0[0], u0[1], u1[2]]

s = np.linspace(0,1,11);
y_init = [ 16*s**2 , 14*s**2, (1-s)**2/4 ]

res = solve_bvp(uv_ode, uv_bc, s, y_init, tol=1e-5, max_nodes=80000)
print res.message

if True or res.success:
    plt.figure(figsize=(9,9))
    plt.subplot(311); plt.plot(res.x, res.y[0], '-o',ms=1); plt.ylabel('$u=t$'); plt.grid();
    plt.subplot(312); plt.plot(res.x, res.y[1], '-o',ms=1); plt.ylabel('$v_0=x$'); plt.grid();
    plt.subplot(313); plt.plot(res.x, res.y[2], '-o',ms=1); plt.ylabel('$v_2=x\'\'$'); plt.grid();  plt.xlabel('$s=x\'$');
    plt.show()

enter image description here

0
On

Follows a MATHEMATICA script showing a numerical solution. Here $t = 200 \approx\infty$

tmax = 200; solx = NDSolve[{x1'[t] == x2[t], x2'[t] == x3[t], 2 x3'[t] + x1[t] x3[t] == 0, x1[0] == 0, x2[0] == 0, x2[200] == 1}, {x1, x2, x3}, {t, 0, tmax}][[1]] Plot[Evaluate[{x1[t], x2[t], x3[t]} /. solx], {t, 0, 20}, PlotRange -> {0, 2}, PlotStyle -> {{Black, Thick}, {Blue, Thick}, {Red, Thick}}, PlotLegends -> {Subscript[x, 1][t], Subscript[x, 2][t], Subscript[x, 3][t]}] enter image description here

$$ x_1(t) \to \mbox{black}\\ x_2(t) \to \mbox{blue}\\ x_3(t) \to \mbox{red} $$

1
On

Too long for a comment.

In his answer, JJacquelin ended with $$t(x)=\int_0^x\frac{d\xi}{\sqrt{\text{erf}(\xi/2)}}$$ which does not have explicit solution.

However, we can make quite good approximation building the Padé approximant at $\xi=0$ $$\frac{1}{\sqrt{\text{erf}(\xi/2)}}\simeq \sqrt[4]\pi \, \frac{1+\frac{363 }{3680}\xi ^2+\frac{491 }{264960}\xi ^4-\frac{23789 }{445132800}\xi^6 }{\sqrt \xi \left(1+\frac{629 }{11040}\xi ^2 \right) }$$ which can be integrated to lead to the nasty (but practicable) $$t(x)=-\frac{23789 \sqrt[4]{\pi } x^{9/2}}{114125760}+\frac{1085389 \sqrt[4]{\pi } x^{5/2}}{55389740}+\frac{3036269046 \sqrt[4]{\pi } \sqrt{x}}{1742007323}-\frac{111936400\ 2^{3/4} \sqrt[4]{\frac{345 \pi }{629}} \log \left(\sqrt{434010} x-4\ 345^{3/4} \sqrt[4]{1258} \sqrt{x}+2760\right)}{1742007323}+\frac{111936400\ 2^{3/4} \sqrt[4]{\frac{345 \pi }{629}} \log \left(\sqrt{434010} x+4\ 345^{3/4} \sqrt[4]{1258} \sqrt{x}+2760\right)}{1742007323}-\frac{223872800\ 2^{3/4} \sqrt[4]{\frac{345 \pi }{629}} \tan ^{-1}\left(1-\frac{\sqrt[4]{\frac{629}{345}} \sqrt{x}}{2^{3/4}}\right)}{1742007323}+\frac{223872800\ 2^{3/4} \sqrt[4]{\frac{345 \pi }{629}} \tan ^{-1}\left(\frac{\sqrt[4]{\frac{629}{345}} \sqrt{x}}{2^{3/4}}+1\right)}{1742007323}$$ which is not so bad as shown below $$\left( \begin{array}{ccc} x & \text{approximation} & \text{exact} \\ 0.00 & 0.00000 & 0.00000 \\ 0.25 & 1.33203 & 1.33203 \\ 0.50 & 1.88671 & 1.88671 \\ 0.75 & 2.31671 & 2.31671 \\ 1.00 & 2.68470 & 2.68470 \\ 1.25 & 3.01528 & 3.01528 \\ 1.50 & 3.32122 & 3.32122 \\ 1.75 & 3.61020 & 3.61020 \\ 2.00 & 3.88724 & 3.88725 \\ 2.25 & 4.15580 & 4.15584 \\ 2.50 & 4.41833 & 4.41843 \\ 2.75 & 4.67656 & 4.67681 \\ 3.00 & 4.93172 & 4.93227 \\ 3.25 & 5.18460 & 5.18576 \\ 3.50 & 5.43566 & 5.43794 \\ 3.75 & 5.68507 & 5.68926 \\ 4.00 & 5.93273 & 5.94004 \\ 4.25 & 6.17831 & 6.19048 \\ 4.50 & 6.42126 & 6.44074 \\ 4.75 & 6.66082 & 6.69087 \\ 5.00 & 6.89601 & 6.94094 \end{array} \right)$$

1
On

The first step in a "general method" to solve this problem is to recognize that the given third-order ordinary differential equation (ODE) is autonomous.

We'll use subscripts for derivatives in the following, because we are going to use derivatives with respect to the independent variable $t$ but also with respect to the dependent variable $x$.

Starting with $2 x_{ttt} + x x_{tt} = 0$ we write $x_t = w(x)$ with some unknown function $w$, to obtain a boundary-value problem (BVP) with a second-order ODE for $w$: \begin{equation} w w_{xx} + w_x \left( w_x + \frac{x}{2} \right) = 0, \quad w(0) = 0, \quad w(\infty) = 1 \end{equation} (note that the derivatives of $w$ are taken with respect to $x$!).

Once the function $w$ is found we may solve the following initial-value problem (IVP) with a separable first-order ODE for $x$: \begin{equation} x_t = w(x), \quad x(0) = 0. \end{equation} Thus we have split the initial-boundary-value problem (IBVP) with a third-order autonomous ODE into a BVP with a second-order ODE and an IVP with a separable first-order ODE.

Going for the inverse function $t(x)$ as suggested by JJacquelin we may write \begin{equation} t(x) = \int \limits_0^x \frac{1}{w(\xi)} \, \mathrm{d}\xi, \end{equation} with the function $w$ from above. Thus it remains to solve the BVP for $w$ and then to compute the integral.

Both tasks may be difficult, and I believe that there is a mistake in the solution provided by JJacquelin (in the calculation of the third derivative of the inverse function). I would normally write a comment on this but I am not yet allowed.