kind of related to a previous question of mine. I am describing a physical phenomena related to charged molecules and am interested in the following quantity:
$$\xi=\int_0^{\infty}\left[1-g(x)^2\right]\text{d}x$$
where $g(x)$ is the solution to the following differential equation: $$g''(x)=\alpha\left[g(x)^3-g(x)\right]+\beta g(x) e^{-\kappa x}$$ with boundary conditions $g(0)=0$ and $g(\infty)=1$. For $\beta=0$ this has a nice analytical solution $g(x)=\tanh{\frac{\sqrt{\alpha}x}{\sqrt{2}}}$ with $\xi=\frac{\sqrt{2}}{\sqrt{\alpha}}$.
What I have tried so far: getting an approximate solution by rewriting equation 2 to $1-g(x)^2$ and integrating, splitting the integration between $0\leq x \leq l$ and $x>l$, where $l$ is the region where the exponential term of equation 2 is dominating. I haven't managed to prove the value of $l$ to make this work.
What I did find through some "educated" and accidental guesses is $\xi \approx \frac{\sqrt{2}}{\sqrt{\alpha}}+\frac{\ln{\left[\frac{\beta}{\kappa \sqrt{2\alpha}}+1\right]}}{\kappa}$, which is surprisingly accurate. However, I am in no form able to derive something close to this.
This has me thinking that there might be a solution in the form of $g(x)=g(x)_{\beta=0}+c_1 y(x)$.
What I'm wondering is if there is an analytical solution to the actual differential equation, and if so, could someone point me in the correct direction such that I can (learn to) solve it. If not, what might be other methods to obtain an approximate expression for $\xi$. Thank you.
Edit: I have some software which solves a lattice-based model for this physical problem and found that indeed for a certain region $0\leq x \leq l$ $g(x)$ is very small and almost stationary, after this point the $\tanh$ solution seems to describe $g(x)$ with high accuracy.
Edit: Analysis of the parameters $\alpha$ and $\kappa$ shows that $\frac{2}{\alpha}>\kappa^2$. In general $\kappa>0$,and $\alpha<\kappa<\beta$.
Edit: For the physicists with us, the problem here is seemingly equivalent to describing the spin order parameter in a correlated magnetic field $\beta g(x) e^{-\kappa x}$ see for instance Lubensky, T. C., and Morton H. Rubin. "Critical phenomena in semi-infinite systems. II. Mean-field theory." Physical Review B 12.9 (1975): 3885.

This is by no means a full answer however it is too long for a comment and I think it is of value. We give general solutions in two special cases.
\begin{equation} x + C_2 = \int \frac{d g}{\sqrt{\alpha g^2 (g^2/2-1) + C_1}} \end{equation}
The solution above reduces to the solution given in the body of the question if $C_2=0$ and $C_1 = \alpha/2 $. the required boundary conditions are satisfied.
\begin{equation} g(x) = C_1 I_0(2 \frac{\sqrt{\beta}}{\kappa} \sqrt{e^{-\kappa x}}) + C_2 K_0(2 \frac{\sqrt{\beta}}{\kappa} \sqrt{e^{-\kappa x}}) \end{equation}
If $C_2=0$ and $C_1=1$ then $g(\infty) = 1$ as required however the value at zero is in general not zero unless some quantization conditions are imposed on the parameters.
Update: I was thinking that one might find a general solution to this ODE by using a perturbation approach, i.e. by postulating that $g(x) := \sum\limits_{n=0}^\infty f_p(x) \cdot \beta^p $ with $f_0(x) := \tanh(\sqrt{\alpha/2} x) $. In here I found the first order correction $f_1(x) $. This quantity satisfies the following ODE:
\begin{equation} f^{''}_1(x)+ \alpha \left(1- 3 \tanh(\sqrt{\alpha/2} x)^2\right) f_1(x) - e^{-\kappa x} \tanh(\sqrt{\alpha/2} x) = 0 \quad (i) \end{equation}
Now by substituting for $u = \exp(\sqrt{\alpha/2} x)$ we found that $f_1(u) = 1/\sqrt{u} {\tilde f}_1(u) $ where
\begin{equation} {\tilde f}^{''}_1(u)+ \alpha \left(-\frac{15}{4 u^2} + \frac{24}{(1+u^2)^2}\right) {\tilde f}_1(u) + \frac{2}{\alpha} u^{-\frac{3}{2} - \frac{\sqrt{2} \kappa}{\sqrt{\alpha}}} \frac{1-u^2}{1+u^2} = 0 \quad (ii) \end{equation}
The solution to $(ii)$ is given as :
\begin{equation} {\tilde f}_1(u) = C_1 {\tilde q}_1(u) + C_2 {\tilde q}_2(u) + \int\limits_0^u \frac{1}{{\mathfrak W}(u)} \left| \begin{array}{lll} {\tilde q}_1(\xi) & {\tilde q}_2(\xi) \\ {\tilde q}_1(u) & {\tilde q}_2(u) \end{array} \right| rhs(\xi) d\xi \quad (iii) \end{equation}
where
\begin{eqnarray} {\tilde q}_1(u) &:=& \frac{u^{5/2}}{(1+u^2)^2} \\ {\tilde q}_2(u) &:=& \frac{-1-8 u^2+8 u^6 + u^8 + 24 u^4 \log(u)}{4 u^{3/2} (1+u^2)^2} \\ {\mathfrak W}(u) &:=& 1 \\ rhs(u) &:= & -\frac{2}{\alpha} u^{-\frac{3}{2} - \frac{\sqrt{2} \kappa}{\sqrt{\alpha}}} \frac{1-u^2}{1+u^2} \end{eqnarray}
The integrals in $(ii)$ can be expressed in terms of the Gaussian hypergeometric function and its first derivatives by parameters.
Update 1: As a matter of fact one can write down a recurrence relation for the series expansion solution in powers of $\beta$. So we have $g(x):= \sum\limits_{p=0}^\infty f_p(x) \cdot \beta^p$ with $f_0(x):=\tanh(\sqrt{\alpha/2} x)$. Then we have:
\begin{equation} f_p(x) :=C_1 {\tilde q}_1(x) + C_2 {\tilde q}_2(x) + \int\limits_0^x \frac{1}{{\mathfrak W}(\xi)}\left| \begin{array}{lll} {\tilde q}_1(\xi) & {\tilde q}_2(\xi) \\ {\tilde q}_1(x) & {\tilde q}_2(x) \end{array}\right| rhs(\xi) d\xi \end{equation}
where
\begin{eqnarray} {\tilde q}_1(x) &:=& \frac{e^{\sqrt{2} \sqrt{\alpha } x}}{\left(e^{\sqrt{2} \sqrt{\alpha } x}+1\right)^2} \\ {\tilde q}_2(x) &:=& \frac{e^{-\sqrt{2} \sqrt{\alpha } x} \left(12 \sqrt{2} \sqrt{\alpha } x e^{2 \sqrt{2} \sqrt{\alpha } x}-8 e^{\sqrt{2} \sqrt{\alpha } x}+8 e^{3 \sqrt{2} \sqrt{\alpha } x}+e^{4 \sqrt{2} \sqrt{\alpha } x}-1\right)}{\left(e^{\sqrt{2} \sqrt{\alpha } x}+1\right)^2}\\ {\mathfrak W}(x)&:=& 2 \sqrt{2\alpha} \\ rhs(x) &:=& \alpha \sum\limits_{\begin{array}{l} p_1+p_2+p_3=p \\ 0 \le p_1\le p-1 \\ 0 \le p_2 \le p-1 \\ 0 \le p_3 \le p-1 \end{array}} f_{p_1}(x) f_{p_2}(x) f_{p_3}(x) \quad + \quad f_{p-1}(x) e^{-\kappa x} \end{eqnarray} for $p\ge 1$.
I wouldn't guarantee that it is possible to evaluate all those integrals in closed form but at least one could do that for $p=1,2$ (we almost did it already for $p=1$ above) and then evaluate the integrals numerically for higher values of $p$.
1: Andrey D. Polyanin, Valentin F. Zaitsev, Handbook of exact solutions for ordinary differential equations, Chapman & Hall/CRC 2003