I was trying to solve the equation $x^{\pi}-\pi^x=0$ using numerical analysis(Using Bisection method ,Regula Falsi method). I thought $0$ would be a good start. So I plugged $0^{\pi} $ and it showed up in red as "Infinite ?". Now I am thinking what could be the reason for such a weird answer. Any ideas?
-
3$\begingroup$ Perhaps your calculator computes $a^b$ as $e^{b\log a}$, and chokes on $\log0$. $\endgroup$– Gerry MyersonSep 17, 2017 at 13:13
-
$\begingroup$ what result do you get? $$x=\pi$$ is one solution $\endgroup$– Dr. Sonnhard GraubnerSep 17, 2017 at 13:15
-
1$\begingroup$ What calculator are you using? Also, your question appears to be off topic. $\endgroup$– ShaunSep 17, 2017 at 13:15
-
$\begingroup$ I know the answer @Graubner I just wanted to see to what extent I am able to reach $\pi $. $\endgroup$– Archis WelankarSep 17, 2017 at 13:17
-
1$\begingroup$ It is difficult to give a definitive answer to the question since it depends of the math package and algorithm which is generally not accessible. For example the difficulté observed by the OP doesn't appears with WolframAlpha. The two roots are obtained : m.wolframalpha.com/input/?i=Solve+x%5Epi-pi%5Ex%3D0+for+x $\endgroup$– JJacquelinSep 17, 2017 at 16:22
1 Answer
If you want solve numerically with a recursive method such as Newton-Raphson or bissection, or similar..., you need guessed starting values. Don't chose $0$ because (depending of the software) the $0^x$ might cause trouble. Start with for example $1$ or $3$.
In addition, an analytical approach :
$$x^\pi=\pi^x$$ $$\text{Let}\quad x=e^{-X}\quad\to\quad e^{-\pi X}=e^{x\ln(\pi)}=e^{e^{-X}\ln(\pi)}$$ $$-\pi X=e^{-X}\ln(\pi)$$ $$Xe^X= -\frac{\ln(\pi)}{\pi}$$ The roots of the equation $\quad Xe^X=C\quad$ cannot be expressed with a finit number of elementary functions. They requires either an infinite series or a special function, in fact the Lambert's W function :$\quad X=\text{W}(C).\quad$ Thus : $$X=\text{W}\left(-\frac{\ln(\pi)}{\pi}\right)$$ $$x=e^{-\text{W}\left(-\frac{\ln(\pi)}{\pi}\right)}$$
The function W$(x)$ is multi-valuated if $\quad e^{-1}<x<0.\quad$ The two real branches are named W$_0(x)$ and W$_{-1}(x)$.
$e^{-1}<-\frac{\ln(\pi)}{\pi}<0.\quad$ Thus they are two real roots :
$X=\text{W}_0\left(-\frac{\ln(\pi)}{\pi}\right)\simeq -0.868015651983...\quad\to\quad x=e^{-X}\simeq 2.38217908799305...$
and $\quad X=\text{W}_{-1}\left(-\frac{\ln(\pi)}{\pi}\right)= -\ln(\pi)\quad\to\quad x=e^{-X}=e^{\ln(\pi)}=\pi$
NOTE : For the numerical computation :
http://m.wolframalpha.com/input/?i=exp%28-LambertW%280%2C-ln%28pi%29%2Fpi%29%29
http://m.wolframalpha.com/input/?i=exp%28-LambertW%28-1%2C-ln%28pi%29%2Fpi%29%29
-
1$\begingroup$ This does not answer the question. The OP's preamble about trying to solve an equation iteratively was just flavor, the real question is about the way in which modern calculators are programmed. $\endgroup$– Jack MSep 17, 2017 at 16:01
-
$\begingroup$ @Jack N : I suppose that you read my answer while I was still typing it and so, was still incomplete. Of course, the analytical part of my answer is not strictly in the scope of the OP's question. But It is not prohibited to give additional information about the theoretical context. This could interest some people and the links to WolframAlpha for numerical computation could be useful for them. $\endgroup$ Sep 17, 2017 at 16:15
-
$\begingroup$ I'm reading your answer now that you have finished typing it, and it still doesn't answer the question. It does remind me of the old joke about the guy who goes to see the doctor, and bends his elbow at a certain angle, and says, "Doc, it hurts when I do this," and the doctor replies, "So, don't do that." $\endgroup$ Sep 17, 2017 at 22:30
-
$\begingroup$ Citation : "So I plugged $0^\pi$ and it showed up in read as "Infinite " . Then, what answer do you expect exactly ? That someone write down : "The software is bad, that's all" and nothing more ? Or even worse : "$x=\infty$ is the right answer because $\pi^\infty=\infty^\pi=\infty$ ". $\endgroup$ Sep 18, 2017 at 6:54
-
$\begingroup$ I expect, or at any rate hope for, an answer that nails down the cause of the error, and specifies exactly the conditions under which the error occurs. $\endgroup$ Sep 18, 2017 at 13:31