# Solving $a\sqrt{1-x^2} + \log(x) = b$ for $x \approx 0$

I have to solve this

$$a\sqrt{1-x^2} + \log(x) = b \tag{1}$$ for $$x \approx 0$$ where $$a$$ and $$b$$ are two constants and $$x>0$$.

One (maybe naive) approach is to approximate $$\log(x)$$, which I asked here. (However, this is not XY problem because I do use the approximation of $$\log(x)$$ for other problems, so please do not mark it as duplicated)

Another way I tried is to allow $$\sqrt{1-x^2} \approx 1$$ then $$x \approx e^{b-a} \tag{2}$$

Even though the result of (2) is quite good, it is not satisfactory. Could anyone propose other solutions better than (2)?

• Write $A=e^a, B=e^b$ and exponentiates both sides of the equation. You get $xe^{a\sqrt{1-x^2}} \approx xA(1-\tfrac{1}{2}x^2)=B$ which is a cubic equation in $x$. – gammatester Oct 27 '18 at 10:13
• @gammatester Thanks, but I think it should be $xe^{a\sqrt{1-x^2}} \approx xA^{\sqrt{1-x^2}}$, shouldn't it? – AlexTP Oct 28 '18 at 10:04

Your equation is equivalent to $$a\sin\theta+\log\cos\theta = b$$, which can be solved through Newton's method both in the case $$\theta\approx 0^+$$ (in such a case we consider as a starting point a solution of $$a\theta-\frac{\theta^2}{2}=b$$) and in the case $$\theta\approx\frac{\pi}{2}^-$$ (in such a case we consider as a starting point the solution of $$1+\log\left(\frac{\pi}{2}-\theta\right)=b$$).

• Nice way, I didn’t see that! – user Oct 27 '18 at 18:33
• @Jack D'Aurizio, thanks very nice. However, besides making the equation nicer, could you please tell me what is the advantages of setting $x=\cos(\theta)$? Does it make the rate of convergence faster in comparing to keeping $x$ as unknown? – AlexTP Nov 12 '18 at 13:59
• @Jack, your answer is truly elegant, but it converges slower than the direct Newton method on $x$. The conclusion comes from simulations with the same accepted threshold. – AlexTP Nov 12 '18 at 17:33

If you are looking for an approximation for $$x$$ small then we have

$$\sqrt{1-x^2}\approx 1-\frac12x^2$$

and then

$$a\sqrt{1-x^2} + \log(x) \approx a-\frac12 ax^2+\log x\approx a+\log x$$

and

$$a+\log x =b \implies x=e^{b-a}$$

is a nice first order approximation.

To obtain a better approximation we need to solve

$$a-\frac12 ax^2+\log x=b$$

which can be solved numerically starting for the solution found by the first order approximation.

• could you please elaborate how we can conlude that 'we do not have solution' for that problem? Thanks. – AlexTP Oct 27 '18 at 10:04
• @AlexTP I mean that when $x$ approach to $0$ (with x>0) $\log x$ diverges to $-\infty$ and therefore we can't find any $a$ and $b$ such that $a\sqrt{1-x^2} + \log(x) \to b$as $x \to b$. Are you looking for that or something different? – user Oct 27 '18 at 10:08