8

Interested by this problem which ask for the solution of $$f_n(x)=x^x-(x-n)^{x+n}$$ that I rewrote as $$g(x)=x\log(x)-(x+n)\log(x-n)$$ After two series expansions, I obtained, for large $n$, as a very first estimate $$x_n^{(0)}=n+\sqrt n+\frac 14 \log(n)+\frac 12 \tag 1$$ which does not seem to be too bad

$$ \left( \begin{array}{ccc} k & x_{10^k}^{(0)} & x_{10^k} \\ 1 & 14.2379239334 & 15.1346725729 \\ 2 & 111.651292546 & 112.116435031 \\ 3 & 1033.84971542 & 1034.08264064 \\ 4 & 10102.8025851 & 10102.9137478 \\ 5 & 100319.605997 & 100319.656436 \\ 6 & 1001003.95388 & 1001003.97574 \\ 7 & 10003166.8072 & 10003166.8163 \\ 8 & 100010005.105 & 100010005.109 \\\end{array} \right)$$

We have $\forall n$ $$g\big(x_n^{(0)} \big) ~>~ 0 \qquad \qquad g'\big(x_n^{(0)} \big)~<~0 \qquad\qquad g''\big(x_n^{(0)} \big)~> ~0$$ So, by Darboux theorem, we know that this is an underestimate of the solution which, then, will be reached without any overshoot.

Using this estimate, the $\color{red}{\text{first}}$ iterate of Newton-like methods of order $p$ is fully explicit (even if messy). For illustration of the worst case where $n=10$

$$\left( \begin{array}{cc} p & x_{10}^{(1)} & \text{method} \\ 2 & 15.0400117306 & \text{Newton} \\ 3 & 15.1375069522 & \text{Halley} \\ 4 & 15.1343850068 & \text{Householder} \\ 5 & 15.1347106313 & \text{no name} \\ 6 & 15.1346668689 & \text{no name} \\ 7 & 15.1346734910 & \text{no name} \\ 8 & 15.1346724180 & \text{no name} \\ \cdots & \cdots & \\ \infty & 15.1346725729 & \text{solution} \\ \end{array} \right)$$

My question is : what could be the next term(s) in $(1)$ to make it better for small values of $n$ ?

Any idea idea or suggestion would be really welcome. Thanks in advance.

Edit (after @Empy2's answer)

If we compute the first iterate of Newton method and expand it for large values of $n$, we have $$x_n^{(1)}-x_n^{(0)}=\frac {3 \log ^2(n)+8 \log (n)+12 }{32 \sqrt{n} }+O\left(\frac{1}{n}\right)$$

which is exactly what @Empy2 answered.

The good thing is $g\big(x_n^{(1)} \big)$ is still positive.

Repeating the calculations $$ \left( \begin{array}{ccc} k & x_{10^k}^{(1)} & x_{10^k} \\ 1 & 15.0400117306 & 15.1346725729 \\ 2 & 112.106568773 & 112.116435031 \\ 3 & 1034.08180781 & 1034.08264064 \\ 4 & 10102.9136866 & 10102.9137478 \\ 5 & 100319.656432 & 100319.656436 \\ 6 & 1001003.97574 & 1001003.97574 \\ \end{array} \right)$$

  • The first appearance of $\epsilon$ in the expansion is $2\sqrt{n}\epsilon$ in the second term. I think it has to cancel a plain quadratic in $\ln n$ – Empy2 May 31 '24 at 16:30
  • I got $(3(\ln n)^2+12\ln n+20)/(32\sqrt n)$. That was $0.0549, 0.0237,0.00981$ instead of $0.050439,0.02186,0.0091$ for the actual errors for $10^5,10^6,10^7$ – Empy2 May 31 '24 at 17:24
  • As $n \searrow 0$, Maple gives $x = e + \frac32 n - \frac7{24 e} n^2 + \frac1{3 e^2} n^3 + \cdots$. The constant and linear terms can be extracted cheaply. – Travis Willse Jun 20 '24 at 05:30
  • @TravisWillse. Thank you ! I never thought about very small $n$ but I shall follow your idea. Cheers. – Claude Leibovici Jun 20 '24 at 05:33
  • 1
    @TravisWillse. I added another answer ! You inspired me. Thanks for that and for many other things. Cheers :- – Claude Leibovici Jun 20 '24 at 06:31

6 Answers6

6

I get a different formula this time. Here it is to check.

I will assume the leading terms are the same and the next term is $\epsilon n^{-1/2}$. I will treat $\ln n$ as $O(1)$, and keep $O(1)$ terms in the products.

Let $$N=n,R=\sqrt n,L=\ln n$$

$$x=N+R+\frac {L+2}4+\frac{\epsilon}R\\ \ln x=L+\left(\frac1R+\frac{L+2}{4N}\right)-\frac1{2N}\\ x\ln x = (NL+R+(L+2)/4-1/2) +(RL+1)+(L^2+2L)/4 $$

$$\ln(x-n)=L/2+(L+2)/(4R)+\epsilon/N -(L+2)^2/(32N)\\ (x+n)\ln(x-n)=(NL+R(L+2)/2+2\epsilon -(L+2)^2/16) +(RL/2+(L+2)/4)+(L^2+2L)/8 $$ Assuming $O(n)$ and $O(\sqrt n)$ terms cancel, collect $O(1)$ terms. $$(L+2)/4-1/2+1+(L^2+2L)/4 =2\epsilon-(L+2)^2/16+(L+2)/4 +(L^2+2L)/8\\ 1/2+(L+2)(1/4+L/4+(L+2)/16-1/4-L/8) =2\epsilon\\ \epsilon/\sqrt n=(3L^2+8L+12)/(32R)$$

Empy2
  • 52,372
6

If we go beyond for better accuracy, the logarithm in $$x_n^{(0)}=n+\sqrt n+\frac 14 \log(n)+\frac 12 \tag 1$$ is killing after Newton method.

Using instead $$x_n^{(0)}=n+\sqrt n$$ computing the first iterate of Householder method and expanding again as a series for large $n$. The result is (with $L=\log(n)$) $$x_n^{(1)}=n+\sqrt n+\frac L4 +\frac 12+$$ $$\frac{3 L^2+8 L+12}{32\, n^{1/2}}+\frac{2 L^3+6 L^2+15 L+12}{48\, n}+$$ $$\frac{125 L^4+400 L^3+1320 L^2+1728 L+1232}{6144\,n^{3/2}}+$$ $$\frac{81 L^5+270 L^4+1080 L^3+1800 L^2+2280 L+1120}{7680\, n^2}+$$ $$O\left(\frac{\log ^6(n)}{n^{5/2}}\right)$$ and we still have $g\big(x_n^{(1)} \big)$ postive.

Repeating the previous calculations

$$\left( \begin{array}{ccc} k & x_{10^k}^{(1)} & x_{10^k} \\ 1 & 15.0704798432 & 15.1346725729 \\ 2 & 112.114185500 & 112.116435031 \\ 3 & 1034.08259684 & 1034.08264064 \\ 4 & 10102.9137472 & 10102.9137478 \\ 5 & 100319.656436 & 100319.656436 \\ \end{array} \right)$$

Edit

In fact, we can avoid thinking about the first iterate of Newton-like method.

It is enough to write $$x=n+\sqrt n+\sum_{k=0}^p \frac {a_k} {n^{\frac k 2}}$$ Expanding $$g(x)=x\log(x)-(x+n)\log(x-n)$$ as a series for large $n$, cancelling one term at the time leads to the result (even if it starts to be tedious for $k>3$).

Edit

If you are interested by this problem, have a look here for @Roaman's, @user64494's and @Vaclav Kotesovec's contributions.

Using @Vaclav Kotesovec's formulae for $n=10$ $$\left( \begin{array}{cc} k & x_k \\ 1 & 14.6438158582 \\ 2 & 15.1069703071 \\ 3 & 15.1345865574 \\ 4 & 15.1346725720 \\ \end{array} \right)$$

2

After @TravisWillse's comment for small values of $n$, using series expansion $$x=e+e \sum_{k=1}^\infty(-1)^{k-1}\, a_k\,\left(\frac{n}{e}\right)^k $$ the first coefficients being $$\left\{\frac{3}{2},\frac{7}{24},\frac{1}{3},\frac{ 911}{1920},\frac{34}{45},\frac{748075}{580608}, \frac{1933}{840},\frac{845935879}{199065600},\cdots\right\}$$ which ,for $n=\frac 12$, gives $x=\color{red}{3.44594}61$.

For small $n$

$$f_n(x)=x^x-(x-n)^{x+n}=n (1-\log (x))+\frac{3 n^2}{2 x}+O\left(n^3\right)$$ gives, as an estimate, $$\large x_n^{(0)} \sim \frac {\frac{3 n}{2} } {W\left(\frac{3 n}{2 e}\right) }$$
which is a good estimate.

Again closed forms for the first iterate of Newton-like methods of order $p$.

Some results for $n=1$ (wich is a bad case) $$\left( \begin{array}{cc} p & x_p^{(1)} & \text{method} \\ 2 & 4.135671593 & \text{Newton} \\ 3 & 4.141094652 & \text{Halley} \\ 4 & 4.141039975 & \text{Householder} \\ 5 & 4.141041582 & \text{no name} \\ 6 & 4.141041523 & \text{no name} \\ 7 & 4.141041526 & \text{no name} \\ \end{array} \right)$$

I was dreaming for it !

2

Expanding in a series about $n = \infty$ using Maple, via the command

assume(x > 0);
solve(x * log(x) = (x + n) * log(x - n), x);
map(simplify, series(%, n = infinity, 2), symbolic);

gives the expansion \begin{multline*} x_0 \sim n + \sqrt{n}+\frac{\log n}{4}+\frac{1}{2}+\frac{3 \log^2 n +8 \log n + 12}{32 \sqrt{n}} \\ +\frac{2 \log^3 n + 6 \log^2 n + 15 \log n + 12}{48 n} \\ +\frac{125 \log^4 n +400 \log^3 n +1320 \log^2 n +1728 \log n +1232}{6144 n^{\frac{3}{2}}} + \cdots , \end{multline*} where $\cdots$ denotes terms of order $O(n^{-2} \log^5 n)$, which confirms and extends Empy2's answer. Presumably the additional terms here can be derived in the same manner as the terms in that answer.

Similarly expanding about $n = 0$ gives the expansion $$x_0 \sim e + \frac32 n - \frac7{24 e} n^2 + \frac1{3 e^2} n^3 - \frac{911}{1920 e^3} n^4 + \cdots ,$$ where $\cdots$ denotes terms of order $O(n^5)$.

Travis Willse
  • 108,056
  • Good to know ! How long (CPU time) did Maple used for obtaining this expression ? – Claude Leibovici Jun 21 '24 at 07:42
  • Just 1.08s. It hardly takes any longer to compute the series modulo $O(n^{-5} \log^{11} n)$ (replace the parameter $2$ with $5$). – Travis Willse Jun 22 '24 at 04:52
  • 1
    This is very impressive. Thanks again and, please, continue to inspire me ! Cheers :-) – Claude Leibovici Jun 22 '24 at 05:15
  • I took a trial version of Maple and mde if for $5$. This is just incredible. – Claude Leibovici Jun 26 '24 at 12:30
  • Taking into account what you did here, would you mind t have a look at my last question ? Would Maple be able to provise something ? Thanks & cheers :-) – Claude Leibovici Nov 03 '24 at 05:03
  • @ClaudeLeibovici Replying here to make sure you saw my comment on your question: https://math.stackexchange.com/questions/4993079/approximate-the-first-solution-of-sum-k-0n-frac-1x-k-0 – Travis Willse Nov 15 '24 at 15:26
  • I did not; sorry for that. Your comment starts with Claude and not @Claude. Then, being blind ... ! I also thought about polynomials in $\frac 1 {\log(n)}$ and it is good (from curve fit). But, the sake of the art sake, I would prefer something formal even if not as good. Thanks again ! – Claude Leibovici Nov 15 '24 at 15:53
  • If you have time to waste, could you please take a look at my last question https://math.stackexchange.com/questions/5074568/are-these-polynomials-already-known ? Do you think that Maple would easily or not generate the polynomials $P_n(t)$ ? Thanks in advance & cheers :-) – Claude Leibovici Jun 13 '25 at 05:00
1

Some tought :

$$g\left(x\right)=x\ln\left(x\right),f\left(x\right)=(x+n)\ln\left(x-n\right),r(x)=\int_{n}^{x}-\left(f\left(y\right)-g\left(y\right)\right)dy$$

And :

$$p\left(x\right)=-2n(-n+x)+\frac{1}{2}\ln(-n+x)(-n+x)^{2}+2n\ln(-n+x)(-n+x)-\frac{1}{4}(-n+x)^{2},h\left(x\right)=\frac{1}{4}x^{2}\left(2\ln\left(x\right)-1\right),r\left(x\right)=h\left(x\right)-h\left(n\right)-p\left(x\right)$$

We can use Taylor series or Newton's method since $r(x)$ is concave for $x>n$ and so gives an approximation of the new target which is a maximum nota bene we fix $n$ and set $a=x-n,b=x$

Edit for Claude and curious others :

You just have to use a common trick as we have an oscillating (bad news) approximation of the maximum :

$$I=\max_{x>0}\left(r'\left(n+x\right)n+r\left(n+x\right)+\frac{r''\left(n+x\right)}{2}n^{2}+\frac{r'''\left(n+x\right)}{6}n^{3}+\frac{r''''\left(n+x\right)}{24}n^{4}+\cdots\right)$$

It works well as in another answer for a small $n$ says $n\in(0,1)$ next :

$$I=\max_{x>0}(r(x+2n))$$

And so introducing a new unknow :

$$\lim_{k\to -\infty}r\left(x+2^{k}n\right)=\lim_{k\to-\infty}\left(r'\left(x+2^{k-1}n\right)2^{k-1}n+r\left(x+2^{k-1}n\right)+\frac{r''\left(x+2^{k-1}n\right)\left(2^{k-1}n\right)^{2}}{2}+\frac{r'''\left(x+2^{k-1}n\right)\left(2^{k-1}n\right)^{3}}{6}+\frac{r''''\left(x+2^{k-1}n\right)\left(2^{k-1}n\right)^{4}}{24}+\frac{r'''''\left(x+2^{k-1}n\right)\left(2^{k-1}n\right)^{5}}{120}+\frac{r''''''\left(x+2^{k-1}n\right)\left(2^{k-1}n\right)^{6}}{720}+\cdots \right)$$

Using this trick it works well for all $n>0$ .

Now remarking that if we set $X=x-n$ ,$p(X)$ is a one variable function , the derivative of $h(n)$ is zero and then for $h(X+n)$ there is a partial telescoping series .

Now the magical things to catch the maxima for $n \in (0,1]$ :

Solve using Lagrange reversion :

$$x\ln\left(x\right)-\left(x+n\right)\ln\left(x-n\right)=\left(\frac{r''\left(x+2^{k-1}n\right)\left(2^{k-1}n\right)^{2}}{2}+\frac{r'''\left(x+2^{k-1}n\right)\left(2^{k-1}n\right)^{3}}{6}+\frac{r''''\left(x+2^{k-1}n\right)\left(2^{k-1}n\right)^{4}}{24}+\frac{r'''''\left(x+2^{k-1}n\right)\left(2^{k-1}n\right)^{5}}{120}+\frac{r''''''\left(x+2^{k-1}n\right)\left(2^{k-1}n\right)^{6}}{720}\right),k=e-\frac{3}{2}n-3$$

Restricting to the third derivative we have :

$$x\ln\left(x\right)-\left(x+n\right)\ln\left(x-n\right)=\left(\frac{\left((2n)/(n-x)+\ln(x)-\ln(-n+x)\right)\left(2^{k-1}n\right)^{2}}{2}+\frac{\left((n(n+x))/\left(\left(n-x\right)^{2}\left(x\right)\right)\right)\left(2^{k-1}n\right)^{3}}{6}\right)$$

Cheating :

$$x\ln\left(x\right)-\left(x+n\right)\ln\left(x-n\right)=\left(\frac{\left((2n)/(n-x)+x\ln(x)-\left(x+n\right)\ln\left(x-n\right)\right)\left(\frac{n}{4}\right)^{2}}{2}+\frac{\left((n(n+x))/\left(\left(n-x\right)^{2}\left(x\right)\right)\right)\left(\frac{n}{4}\right)^{3}}{6}\right)$$

Or :

$$\left(x\ln\left(x\right)-\left(x+n\right)\ln\left(x-n\right)\right)=\left(1-\frac{n^{2}}{32}\right)^{-1}\left(\frac{\left((2n)/(n-x)\right)\left(\frac{n}{4}\right)^{2}}{2}+\frac{\left((n(n+x))/\left(\left(n-x\right)^{2}\left(x\right)\right)\right)\left(\frac{n}{4}\right)^{3}}{6}\right)$$

Or :

$$\left(x\ln\left(x\right)-\left(x+n\right)\ln\left(x-n\right)\right)=\left(\frac{\left((2n)/(n-x)\right)\left(\frac{n}{4}\right)^{2}}{2}+\frac{\left((n(n+x))/\left(\left(n-x\right)^{2}\left(x\right)\right)\right)\left(\frac{n}{4}\right)^{3}}{6}\right)$$

Or equalizing to zero :

$$\frac{1}{48}(25n+\sqrt{721}n)=x$$

Which is a good idea for small range say $n\in [300,600]$

I take here $k=-1$ but if $2^{-k+1}=(-\sqrt{n}-n+2n^{\frac{3}{2}})/(6(-1+n))$ in : $$n+\sqrt{n}=(n+6kn+\sqrt{(1+36k+36k^{2})}n)/(12k)$$

We have the result of ClaudeLeibovici .

Barackouda
  • 3,879
0

Considering $n>0$, working with the equation

\begin{equation} x\log\left(x\right)-\left(x+n\right)\log\left(x-n\right)=0 \end{equation}

Transforming the equation with the change of variable $x\rightarrow n\left(2-1/z\right)$ and multiplying by z, we obtain the equation

\begin{equation} \left(2z-1\right)\log\left(n\left(2-\frac{1}{z}\right)\right)+\left(1-3z\right)\log\left(n\left(1-\frac{1}{z}\right)\right)=0 \end{equation}

Defining the function $f(z)=\left(2z-1\right)\log\left(n\left(2-\frac{1}{z}\right)\right)+\left(1-3z\right)\log\left(n\left(1-\frac{1}{z}\right)\right)$ and applying the Burniston-Siewert method to solve transcendental equations to this equation we obtain

\begin{equation} x=n\left(2-\frac{1}{z}\right),\quad z=\frac{1}{2}-\frac{2-\log\left(2\right)}{2\log\left(2\right)-\log\left(n\right)}+m \end{equation}

where

\begin{equation} m=\frac{1}{\pi}{\displaystyle \int\limits _{0}^{1}\arctan\left(\frac{2}{\pi}\,\frac{\left(2t-1\right)\log\left|2t-1\right|+\left(1-3t\right)\log\left(1-t\right)+t\log\left(\frac{t}{n}\right)}{\left(1-4t\right)-\left|2t-1\right|}\right)\,dx} \end{equation}

(Another representation is)

\begin{equation} m=\frac{1}{\pi}{\displaystyle \int\limits _{-\infty}^{1}\frac{1}{\left(2-t\right)^{2}}\arctan\left(\frac{2}{\pi}\,\frac{\left(t+1\right)\log\left(1-t\right)-t\log\left|t\right|+\log\left(n\right)}{\left(t+2\right)+\left|t\right|}\right)\,dx} \end{equation}

Putting everything into a single expression,

\begin{equation} x=2n-n\left[\frac{1}{2}-\frac{2-\log\left(2\right)}{2\log\left(2\right)-\log\left(n\right)}+\frac{1}{\pi}{\displaystyle \int\limits _{0}^{1}\arctan\left(\frac{2}{\pi}\,\frac{\left(2t-1\right)\log\left|2t-1\right|+\left(1-3t\right)\log\left(1-t\right)+t\log\left(\frac{t}{n}\right)}{\left(1-4t\right)-\left|2t-1\right|}\right)\,dx}\right]^{-1} \end{equation}

This expression, in fact, works for $n\in\mathbb{\mathbb{R}}^{+}$. For example, if $n=1$

\begin{equation} x=2-\left[\frac{3\log\left(2\right)-2}{4\log\left(2\right)}+\frac{1}{\pi}{\displaystyle \int\limits _{0}^{1}\arctan\left(\frac{2}{\pi}\,\frac{\left(2t-1\right)\log\left|2t-1\right|+\left(1-3t\right)\log\left(1-t\right)+t\log\left(t\right)}{\left(1-4t\right)-\left|2t-1\right|}\right)\,dx}\right]^{-1} \end{equation}

Ref:

-E. E. Burniston, C.E. Siewert. The use of Riemann problems in solving a class of transcendental equations. Mathematical Proceedings of the Cambridge Philosophical Society. 73. 111 - 118. (1973).

-Henrici P., Applied and computational complex analysis, Volume III. Wiley, New York. 183-191 (1986).