1

I am attempting to numerically approximate

$$\int_0^1 \frac{1}{x} \cos\left(\frac{\log(x)}{x^2}\right) \, dx,$$

whose graph is shown below. To that end, I am attempting to calculate roots of the function to serve as bounds for subintervals. My plan being to create a converging sequence comprised of the cumulative sum of the integrals of each subinterval as I sweep backwards from 1 to zero. What I am having trouble with is finding these roots. My first thought was to sweep left through the function, checking the sign along the way and using the Intermediate Value Theorem to narrow down the interval in which to perform the root finding method. The problem is that the distance between roots converges so quickly as you approach zero that I am having trouble narrowing down the root finding interval quickly enough.

enter image description here

Mark McClure
  • 30,510

3 Answers3

1

The roots come when $\frac {\log x}{x^2}=(k+\frac 12)\pi$ for $k$ an integer, so you should be looking to solve that. The $\log x$ term is the slower varying one, so I would try an iteration $x_{i+1}=\sqrt{\frac {\log x_i}{(k+\frac 12) \pi}}$ I get faster and faster convergence as $k$ gets large and negative starting with $x_0=0.1$. For $k=-10$ it converges in twelve iterations to six places at $x=0.223921$. For $k=-10\ 000$ it converges in five iterations to $x=0.004176$. For $k=-10^{10}$ six iterations converges to $x=1.86194E-05$ and by now you might find a closer starting value.

Ross Millikan
  • 374,822
  • Thank you so much! This got me started on the right path I think, although because I am using a cos function in this case, the denominator for the fixed point iteration should be k*pi + pi/2 no? – user425340 Mar 14 '17 at 06:30
  • You are right about the $+\frac \pi 2$. I have fixed it. The values did not change except $k=-10$. Thanks – Ross Millikan Mar 14 '17 at 14:04
1

As Ross Millikan answered, you look for the zero's of equation $$\frac {\log x}{x^2}=k\pi$$ Changing variable $x^2=y$ leads to $$\frac {\log y}{y}=2k\pi$$ which has explicit solutions in terms of Lambert function $$y=-\frac{W(-2 k\pi )}{2 k\pi }$$ When $k$ is large and negative, the Wikipedia page gives a series expansion $$W(t)=L_1-L_2+\frac{L_2}{L_1}+\frac{L_2(L_2-2)}{2L_1^2}+\cdots$$ using $L_1=\log(t)$ and $L_2=\log(L_1)$.

I give below a table of the value of $x_k$ obtained from the above approximation and the exact one $$\left( \begin{array}{ccc} k & \text{approx} & \text{exact}\\ -1 & 0.477910 & 0.481989 \\ -2 & 0.387985 & 0.388115 \\ -3 & 0.339177 & 0.338855 \\ -4 & 0.307075 & 0.306685 \\ -5 & 0.283728 & 0.283344 \\ -6 & 0.265673 & 0.265313 \\ -7 & 0.251123 & 0.250789 \\ -8 & 0.239042 & 0.238733 \\ -9 & 0.228784 & 0.228497 \\ -10 & 0.219918 & 0.219651 \\ -11 & 0.212147 & 0.211898 \\ -12 & 0.205256 & 0.205022 \\ -13 & 0.199085 & 0.198865 \\ -14 & 0.193514 & 0.193305 \\ -15 & 0.188448 & 0.188250 \end{array} \right)$$

The other possible way would be the use of Newton method for finding the zero of equation $$f(y)=\log(y)-2k \pi y$$ The successive iterates would be given by $$y_{n+1}=\frac{y_n (\log (y_n)-1)}{2 k\pi y_n-1}$$ for which we could use $$y_0=-\frac{\log(-2k\pi)}{2k\pi}$$ For illustration purposes, let us use $k=-15$. The table below shows the successive iterates $$\left( \begin{array}{ccc} n & y_n & x_n \\ 0 & 0.04823378637 & 0.2196219169 \\ 1 & 0.03506427908 & 0.18725458360 \\ 2 & 0.03543768539 & 0.18824899838 \\ 3 & 0.03543814514 & 0.18825021949 \end{array} \right)$$ This shows a very fast convergence

0

There are infinite roots on this interval, as $\cos(\frac{\log(x)}{x^2})$ has infinite roots, because $\log(x)/x^2$ covers all $x$ in $[0,\infty)$ in the interval $x \in [0,1]$, and $\cos(x)$ has an infinite number of roots on that infinite range.

Proof of $\log(x)/x^2$ covering all real numbers in $[0,\infty)$ in the interval $x \in [0,1]$ is easy and you should be able to do that yourself quickly.