Rearrange so as to make w the subject, isolate w on just one side

calculuserror functionintegrationlimitsreal-analysis

$$\sqrt{{\pi}}\sqrt[4]{w}\left(x-{\mu}\right)\left(\operatorname{erf}\left(\dfrac{x-{\mu}+\frac{1}{2}}{2\sqrt{{\sigma}}\sqrt[4]{w}}\right)-\operatorname{erf}\left(\dfrac{x-{\mu}-\frac{1}{2}}{2\sqrt{{\sigma}}\sqrt[4]{w}}\right)\right)+{\sigma}^\frac{3}{2}\left(\mathrm{e}^{-\frac{\left(x-{\mu}+\frac{1}{2}\right)^2}{4{\sigma}\sqrt{w}}}-\mathrm{e}^{-\frac{\left(x-{\mu}-\frac{1}{2}\right)^2}{4{\sigma}\sqrt{w}}}\right)=0$$

How can I make w the subject?

W is on 4rth roots, on exponentials and even on the upper limits of integration( due to being on the argument of error function).

I would like to work with the more general case if it is not impossible
$$\sqrt{{\pi}}\sqrt[4]{w}\left(x-{\mu}\right)\left(\operatorname{erf}\left(\dfrac{x-{\mu}+\frac{v}{2}}{2\sqrt{{\sigma}}\sqrt[4]{w}}\right)-\operatorname{erf}\left(\dfrac{x-{\mu}-\frac{v}{2}}{2\sqrt{{\sigma}}\sqrt[4]{w}}\right)\right)+{\sigma}^\frac{3}{2}\left(\mathrm{e}^{-\frac{\left(x-{\mu}+\frac{v}{2}\right)^2}{4{\sigma}\sqrt{w}}}-\mathrm{e}^{-\frac{\left(x-{\mu}-\frac{v}{2}\right)^2}{4{\sigma}\sqrt{w}}}\right)=0$$

When v is strictly positive(v>0).( the special case is when v=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:

Approximating the erf function:$\DeclareMathOperator\erf{erf} \frac12 \sqrt{\pi} \erf\left (\frac{x-2}{\sqrt{10}}\right) + \frac12 \sqrt{\pi} \erf \left(\frac{x+2}{\sqrt{10}}\right) = \frac25 \sqrt{\pi}$: There actually is a closed form if you allow functions implemented in a Python Library named SciPy which is also the Stackoverflow Scipy tag showing that it is a standard function. Notice that this function is just a special case of the Marcum Q function: $$Q_m(a,b)=1-e^{-\frac{a^2}2}\sum_{k=0}\frac{\text P\left(m+k,\frac{b^2}2\right)}{k!}\left(\frac{a^2}2\right)^k=1-a^{1-m}\int _0^b x^v e^{-\frac{x^2+a^2}2}\text I_{v-1}(ax)dx$$ where appears the Bessel I and the Lower Normalized Incomplete Gamma “P” functions. Also, notice that it is the Non-Central Chi-Squared Distribution which is just the standard scipy.special.chndtr.

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!

Related Question