1
$\begingroup$

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.

$\endgroup$
15
  • 4
    $\begingroup$ 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)$ ? $\endgroup$ May 15, 2021 at 1:41
  • 2
    $\begingroup$ 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. $\endgroup$ May 15, 2021 at 2:07
  • 1
    $\begingroup$ 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. $\endgroup$ May 15, 2021 at 22:36
  • 1
    $\begingroup$ @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. $\endgroup$ May 17, 2021 at 21:22
  • 1
    $\begingroup$ @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". $\endgroup$ May 18, 2021 at 5:56

3 Answers 3

1
$\begingroup$

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.

$\endgroup$
1
$\begingroup$

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$.

$\endgroup$
0
$\begingroup$

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) > 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) > 0)

end


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

function result=g(s,t,a,b)
    result = 10+3*cos(2*s-2*t)+13*cos(2*s+2*t)+2*cos(3*s)+17*cos(2*t);
end
$\endgroup$
2
  • $\begingroup$ Thank you. I have another request if possible. Could you please write a code for Mathematica as well? I do not use Matlab. $\endgroup$
    – user215601
    May 17, 2021 at 19:39
  • 1
    $\begingroup$ 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. $\endgroup$ May 17, 2021 at 19:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.