Sometimes just using the integral form of error function can save you.
$\int_0^t\dfrac{1}{x}e^{-\frac{a^2}{x}}
\text{erf}\biggl(\dfrac{b}{\sqrt{x}}\biggr)~dx$
$=\dfrac{2}{\sqrt{\pi}}\int_0^t\dfrac{1}{x}e^{-\frac{a^2}{x}}\int_0^\frac{b}{\sqrt{x}}e^{-u^2}~du~dx$
$=\dfrac{2}{\sqrt{\pi}}\int_0^t\dfrac{1}{x}e^{-\frac{a^2}{x}}\int_0^1e^{-\left(\frac{bu}{\sqrt{x}}\right)^2}~d\biggl(\dfrac{bu}{\sqrt{x}}\biggr)~dx$
$=\dfrac{2}{\sqrt{\pi}}\int_0^t\dfrac{1}{x}e^{-\frac{a^2}{x}}\int_0^1\dfrac{b}{\sqrt{x}}e^{-\frac{b^2u^2}{x}}~du~dx$
$=\dfrac{2b}{\sqrt{\pi}}\int_0^t\int_0^1\dfrac{e^{-\frac{b^2u^2+a^2}{x}}}{x\sqrt{x}}du~dx$
$=\dfrac{2b}{\sqrt{\pi}}\int_0^1\int_0^t\dfrac{e^{-\frac{b^2u^2+a^2}{x}}}{x\sqrt{x}}dx~du$
$=\dfrac{4b}{\sqrt{\pi}}\int_0^1\int_0^t-e^{-\frac{b^2u^2+a^2}{x}}~d\biggl(\dfrac{1}{\sqrt{x}}\biggr)~du$
$=\dfrac{4b}{\sqrt{\pi}}\int_0^1\int_\infty^\frac{1}{\sqrt{t}}-e^{-(b^2u^2+a^2)x^2}~dx~du$
$=\dfrac{4b}{\sqrt{\pi}}\int_0^1\int_\frac{1}{\sqrt{t}}^\infty e^{-(b^2u^2+a^2)x^2}~dx~du$
$=\dfrac{4b}{\sqrt{\pi}}\int_0^1\int_0^\infty e^{-(b^2u^2+a^2)x^2}~dx~du-\dfrac{4b}{\sqrt{\pi}}\int_0^1\int_0^\frac{1}{\sqrt{t}}e^{-(b^2u^2+a^2)x^2}~dx~du$
$=2b\int_0^1\dfrac{1}{\sqrt{b^2u^2+a^2}}du-\dfrac{4b}{\sqrt{\pi}}\int_0^1\biggl[\sum\limits_{n=0}^\infty\dfrac{(-1)^n(b^2u^2+a^2)^nx^{2n+1}}{n!(2n+1)}\biggr]_0^\frac{1}{\sqrt{t}}~du$
$=2b\int_0^1\dfrac{1}{\sqrt{b^2u^2+a^2}}du-\dfrac{4b}{\sqrt{\pi}}\int_0^1\sum\limits_{n=0}^\infty\dfrac{(-1)^n(b^2u^2+a^2)^n}{t^{n+\frac{1}{2}}n!(2n+1)}du$
$=2b\int_0^1\dfrac{1}{\sqrt{b^2u^2+a^2}}du-\dfrac{4b}{\sqrt{\pi}}\int_0^1\sum\limits_{n=0}^\infty\sum\limits_{k=0}^n\dfrac{(-1)^nC_k^na^{2n-2k}b^{2k}u^{2k}}{t^{n+\frac{1}{2}}n!(2n+1)}du$
$=2b\biggl[\dfrac{\ln\left(b^2u+b\sqrt{b^2u^2+a^2}\right)}{b}\biggr]_0^1-\dfrac{4b}{\sqrt{\pi}}\biggl[\sum\limits_{n=0}^\infty\sum\limits_{k=0}^n\dfrac{(-1)^na^{2n-2k}b^{2k}u^{2k+1}}{t^{n+\frac{1}{2}}k!(n-k)!(2n+1)(2k+1)}\biggr]_0^1$
$=2\ln\left(b^2+b\sqrt{a^2+b^2}\right)-2\ln(|a|b)-\sum\limits_{n=0}^\infty\sum\limits_{k=0}^n\dfrac{(-1)^n4a^{2n-2k}b^{2k+1}}{\sqrt{\pi}t^{n+\frac{1}{2}}k!(n-k)!(2n+1)(2k+1)}$
$\int_0^b\dfrac{1}{\sqrt{a^2+x^2}}\text{erfc}\left(\sqrt{\dfrac{a^2+x^2}{t}}\right)~dx$
$=\dfrac{2}{\sqrt{\pi}}\int_0^b\dfrac{1}{\sqrt{a^2+x^2}}\int_\sqrt{\frac{a^2+x^2}{t}}^\infty e^{-u^2}~du~dx$
$=\dfrac{2}{\sqrt{\pi}}\int_0^b\dfrac{1}{\sqrt{a^2+x^2}}\int_0^\infty e^{-u^2}~du~dx-\dfrac{2}{\sqrt{\pi}}\int_0^b\dfrac{1}{\sqrt{a^2+x^2}}\int_0^\sqrt{\frac{a^2+x^2}{t}}e^{-u^2}~du~dx$
$=\int_0^b\dfrac{1}{\sqrt{a^2+x^2}}dx-\dfrac{2}{\sqrt{\pi}}\int_0^b\dfrac{1}{\sqrt{a^2+x^2}}\biggl[\sum\limits_{n=0}^\infty\dfrac{(-1)^nu^{2n+1}}{n!(2n+1)}\biggr]_0^\sqrt{\frac{a^2+x^2}{t}}~dx$
$=\int_0^b\dfrac{1}{\sqrt{a^2+x^2}}dx-\dfrac{2}{\sqrt{\pi}}\int_0^b\dfrac{1}{\sqrt{a^2+x^2}}\sum\limits_{n=0}^\infty\dfrac{(-1)^n(a^2+x^2)^{n+\frac{1}{2}}}{t^{n+\frac{1}{2}}n!(2n+1)}dx$
$=\int_0^b\dfrac{1}{\sqrt{a^2+x^2}}dx-\dfrac{2}{\sqrt{\pi}}\int_0^b\sum\limits_{n=0}^\infty\dfrac{(-1)^n(a^2+x^2)^n}{t^{n+\frac{1}{2}}n!(2n+1)}dx$
$=\int_0^b\dfrac{1}{\sqrt{a^2+x^2}}dx-\dfrac{2}{\sqrt{\pi}}\int_0^b\sum\limits_{n=0}^\infty\sum\limits_{k=0}^n\dfrac{(-1)^nC_k^na^{2n-2k}x^{2k}}{t^{n+\frac{1}{2}}n!(2n+1)}dx$
$=\left[\ln\left(x+\sqrt{a^2+x^2}\right)\right]_0^b-\dfrac{2}{\sqrt{\pi}}\biggl[\sum\limits_{n=0}^\infty\sum\limits_{k=0}^n\dfrac{(-1)^na^{2n-2k}x^{2k+1}}{t^{n+\frac{1}{2}}k!(n-k)!(2n+1)(2k+1)}\biggr]_0^b$
$=\ln\left(b+\sqrt{a^2+b^2}\right)-\ln|a|-\sum\limits_{n=0}^\infty\sum\limits_{k=0}^n\dfrac{(-1)^n2a^{2n-2k}b^{2k+1}}{\sqrt{\pi}t^{n+\frac{1}{2}}k!(n-k)!(2n+1)(2k+1)}$
Best Answer
I use this function for solving the problem since I have less competence with non-central distributions. Let’s use the strategy from:
Scipy makes no mention on the restrictions of chndtr, but $n$, the non-centrality parameter,can be any real number. However, $n\in\Bbb R, d,x>0\le p\le1$ where we will set $p$ equal to the equation like a probability. See here and here for the special case derivation:
$$\text{chndtr}(x,d,n)\mathop=1-Q_\frac n2(\sqrt d,\sqrt x)\implies \text{chndtr}(x,d,3)= \frac12 \text{erf}\left(\frac{\sqrt d + \sqrt x}{\sqrt2}\right) -\frac12 \text{erf}\left(\frac{\sqrt d - \sqrt x}{\sqrt2}\right) + \frac{e^{-\sqrt d \sqrt x - \frac d2 - \frac x2}}{\sqrt {2 \pi} \sqrt d} -\frac{e^{\sqrt d \sqrt x - \frac d2 - \frac x2}}{\sqrt {2 \pi} \sqrt d} + 1 =p\implies \text{chndtr}(x^2,d^2,3)= \frac12 \text{erf}\left(\frac{d + x}{\sqrt2}\right) -\frac12 \text{erf}\left(\frac{ d - x}{\sqrt2}\right) + \frac{e^{- d x - \frac {d^2}2 -\frac {x^2}2}}{\sqrt {2 \pi} d} -\frac{e^{d x - \frac {d^2}2 - \frac {x^2}2}}{\sqrt {2 \pi} d} =p-1$$
where there exists a scipy function for the inverse with respect to $d$ and $x$, but first we must put the equation into the right form. Rearranging your general equation. Let me replace $x$, in your question’s equation, with $y$ to not mix up variables fro your problem and my set up above:
$$\frac12 \operatorname{erf}\left(\dfrac{y-{\mu}+\frac{v}{2}}{2\sqrt{{\sigma}}\sqrt[4]{w}}\right)-\frac12\operatorname{erf}\left(\dfrac{y-{\mu}-\frac{v}{2}}{2\sqrt{{\sigma}}\sqrt[4]{w}}\right)+\frac{{\sigma}^\frac{3}{2}}{\sqrt{{\pi}}\sqrt[4]{w}\left(y-{\mu}\right)}\left(\mathrm{e}^{-\frac{\left(y-{\mu}+\frac{v}{2}\right)^2}{4{\sigma}\sqrt{w}}}-\mathrm{e}^{-\frac{\left(y-{\mu}-\frac{v}{2}\right)^2}{4{\sigma}\sqrt{w}}}\right)=0$$
We must have:
$$\dfrac{y-{\mu}+\frac{v}{2}}{2\sqrt{{\sigma}}\sqrt[4]{w}}=\frac{d + x}{\sqrt2},\dfrac{y-{\mu}-\frac{v}{2}}{2\sqrt{{\sigma}}\sqrt[4]{w}}=\frac{d -x}{\sqrt2} $$
$$\frac{{\sigma}^\frac{3}{2}}{\sqrt{{\pi}}\sqrt[4]{w}\left(y-{\mu}\right)} = \frac 1{\sqrt {2 \pi} d}$$ $$-\frac{\left(y-{\mu}+\frac{v}{2}\right)^2}{4{\sigma}\sqrt{w}}= -\frac12(d+x)^2, -\frac{\left(y-{\mu}-\frac{v}{2}\right)^2}{4{\sigma}\sqrt{w}}= -\frac12(d-x)^2 $$
where $d$ can be transformed using any variables, except $x$; however, I do not see how to put $w$ in terms of $x$ or $d$, not both. If you do solve, then use chndtridf or chndtrix to solve for $d$ or $x$ in $$\text{chndtr}(x,d,3)=p\implies d=\text{chndtridf}(x,p,3),x=\text{chndtrix}(p,d,3)$$
After some algebra we miraculously get 2 of the same equations, so we can just ignore one:
$$\dfrac{\left(y-{\mu}+\frac{v}{2}\right)^2}{4\sigma\sqrt w}=\frac{(d + x)^2}2,\dfrac{\left(y-{\mu}-\frac{v}{2}\right)^2}{{4\sigma}\sqrt w}=\frac{(d -x)^2}2 $$
$$\frac{{\sigma}^\frac{3}{2}}{\sqrt{{\pi}}\sqrt[4]{w}\left(y-{\mu}\right)} = \frac 1{\sqrt {2 \pi} d}$$ $$\text{ignore}:\frac{\left(y-{\mu}+\frac{v}{2}\right)^2}{4{\sigma}\sqrt{w}}= \frac12(d+x)^2, \frac{\left(y-{\mu}-\frac{v}{2}\right)^2}{4{\sigma}\sqrt{w}}= \frac12(d-x)^2$$
Therefore
$$d = \frac{\sqrt[4]{w}\left(y-{\mu}\right)} {\sqrt 2{\sigma}^\frac{3}{2}}$$
we substitute back for $x$ and solve, but we get $\text{chndtr}(d,x,3)=\text{chndtr}(f(w),g(w),3)=p$ and there is no inverse function for it even though we got the very similar form.
This answer shows that $w$ cannot be solved for using this library function, but you can solve for $y,\mu,v$ using this method. Note the repetitive nature of the answer making it long. Please correct me and give me feedback!