1

Following my previous question here, I have this function $$f(x)=10+3 \cos (ax-bx)+13 \cos (ax+bx)+2 \cos (\frac32 a x)+17 \cos (b x),$$ with $\frac ab \notin \mathbb{Q}$.

What is the limit $$ \lim_{m\to\infty} \frac 1m \int_{0}^{m} {\bf 1}[f(x)>0] \,dx?$$

Does the limit exist? Are there similar limits for functions with more terms in the sum?

Any hints and comments are appreciated.

  • 4
    I think the method behind the answer to your previous question still applies. The point is that as $m$ gets large, $ax$ and $by$ behave like independent uniform random variables on $[0,2\pi)$. Your question just boils down to: for which fraction of $[0,2\pi)^2$ is $g(s,t)>0$ where $g(s,t)=10+3\cos(2s-2t)+13\cos(2s+2t)$ $+2\cos(3s)+17\cos(2t)$ ? – Anthony Quas May 15 '21 at 01:41
  • 2
    Well the advantage is that you have a simple description of the limit. It’s also not difficult to get approximate values for the limit. Calculating the exact value amounts to solving the equation $g(s,t)=0$ and finding the area inside the curve. That is unlikely to yield an exact value. – Anthony Quas May 15 '21 at 02:07
  • 1
    I think it’s now a question of computation. I doubt you will be able to compute an exact area. You could try approximate methods such as sampling random points from the torus to see whether your inequality is satisfied. – Anthony Quas May 15 '21 at 22:36
  • So, just compute it numerically and be happy with the numerical solution? – Jukka Kohonen May 17 '21 at 17:28
  • Matt F.'s edit kind of invalidated Anthouny Quas's answer-in-a-comment: the form is simpler, but now the function is no longer $2\pi$-periodic. Should we revert to the original formulation? – Mateusz Kwaśnicki May 17 '21 at 20:36
  • @MateuszKwaśnicki, with my revision, AnthonyQuas's comment is about $g(s,t)=f(2s,2t)$, which is still one way of boiling down the question. Fortunately, he already used a different name for the function. –  May 17 '21 at 21:14
  • 1
    @MattF.: I know that now, but I got mislead by this edit when I was first writing the Mathematica code. :-) With these comments, I think the question is fine as is. – Mateusz Kwaśnicki May 17 '21 at 21:22
  • @MattF. I am sorry if my question is very basic. If instead of the condition $f(x)>0$, I had an inequality say $0<h(x)<6$ where $h(x)$ was any combination of trigonometric functions (sum, product, division , ...), then, would this simplification still work? I mean, could I reduce the problem to finding the fraction of the area $4\pi^2$ where the inequality $0<h(x)<6$ holds? –  May 17 '21 at 22:56
  • @SaraMath, it's too late to ask about a two-sided inequality like $0<h(x)<6$ in this question, now that it has three answers about one-sided inequalities. That would work well as a follow-up question if you include some numerical experimentation on it along the lines of the code in the answers here. –  May 18 '21 at 02:48
  • 1
    @SaraMath: Sure it does! It extends to any condition that can be written as "a (continuous) function $\cos(ax)$, $\sin(ax)$, $\cos(bx)$, $\sin(bx)$ belongs to a given set". – Mateusz Kwaśnicki May 18 '21 at 05:56
  • 1
    I believe that, after receiving all these comments and answers, it is the OP's turn to work on the problem. A possible next question will be received better if it shows such effort. – Jukka Kohonen May 18 '21 at 06:08
  • Essentially the same question has now been asked on MSE https://math.stackexchange.com/questions/4139765/how-to-calculate-the-density-where-a-b-in0-2-pi2-mid-fa-b0-for-t – Jukka Kohonen May 18 '21 at 06:36
  • @MattF. Indeed, I tried with different inequalities and I got the correct result. Since my major is not math, I asked here to make sure that I can trust the result or not. –  May 18 '21 at 10:52
  • @JukkaKohonen I had asked that question, I will remove it :) –  May 18 '21 at 10:53
  • @JukkaKohonen Indeed, I tried with different inequalities and I got the correct result. Since my major is not math, I asked here to make sure that I can trust the result or not. Thank you for all your useful comments. –  May 18 '21 at 10:57

3 Answers3

1

A sample Mathematica code to find the area of the region given in Anthony Quas's comment is:

NIntegrate[
 Boole[10 + 3 Cos[2 x - 2 y] + 13 Cos[2 x + 2 y] + 2 Cos[3 x] + 17 Cos[2 y] > 0],
 {x, 0, 2 Pi},
 {y, 0, 2 Pi}]

The output is 29.7118, but Mathematica complains about slow convergence. One can try, say:

NIntegrate[
 Boole[10 + 3 Cos[2 x - 2 y] + 13 Cos[2 x + 2 y] + 2 Cos[3 x] + 17 Cos[2 y] > 0],
 {x, 0, 2 Pi},
 {y, 0, 2 Pi},
 WorkingPrecision -> 100, 
 MaxRecursion -> 20]

But this does not affect neither the answer (29.7117875164...) nor the complaints.

Other ways to accomplish the same task, involving for example ImplicitRegion, do not seem to work any better.

Mateusz Kwaśnicki
  • 16,264
  • 1
  • 31
  • 51
1

While Mathematica's command NIntegrate[] will likely produce an output with a few correct digits, it will not guarantee any of them.

To get such a guarantee, you can partition the square $[0,2\pi]\times[0,2\pi]$ into a grid of $n\times n$ smaller congruent squares (with $n$ equal, say, $50$). On each smaller square, use a Taylor expansion of the cosine function, with a controlled remainder, to bound each of the four cosine terms in the expression of the integrand (say $f$) by a polynomial. Using then (say) Mathematica's Reduce[] command will give you a constant sign of $f$ on each of most of the smaller squares, with a few exceptions. Repeat this procedure on each of the remaining exceptional smaller squares. Continue doing so until the total area of the still remaining exceptional small squares is small enough to be considered negligible.

Visual guides for this procedure could be of help:

enter image description here

In particular, a useful fact that seems to have been overlooked is that the smallest $y$-period of $f(x,y)$ is of course $\pi$, rather than $2\pi$.

Iosif Pinelis
  • 116,648
0

Using Anthony's suggestion it should not be difficult. Here is very straightforward Matlab code. This should illustrate the general method. One can of course change the function and also tune details like how the evaluation points are chosen, how many, and so on.

function beat(a,b)
% Method 1: Just take a long interval.
M = 2000*pi;
N = 1e8;
x = linspace(0,M,N);
mean(f(x,a,b) &gt; 0)

% Method 2 (Anthony Quas): Sample random points
% from the [0,2pi]^2 torus, and do Monte Carlo integration.
s = unifrnd(0, 2*pi, 1, N);
t = unifrnd(0, 2*pi, 1, N);
mean(g(s,t,a,b) &gt; 0)

end

function result=f(x,a,b) result = 10+3cos(ax-bx)+13cos(ax+bx)+2cos(3/2ax)+17cos(b*x); end

function result=g(s,t,a,b) result = 10+3cos(2s-2t)+13cos(2s+2t)+2cos(3s)+17cos(2t); end

Jukka Kohonen
  • 3,964
  • 2
  • 19
  • 49
  • Thank you. I have another request if possible. Could you please write a code for Mathematica as well? I do not use Matlab. –  May 17 '21 at 19:39
  • 1
    I'd rather trust built-in methods to handle these kind of problems with reasonable accuracy. I do not know Matlab well, but I offer some Mathematica code in another answer. – Mateusz Kwaśnicki May 17 '21 at 19:41