I would like to understand how can I plot Arnold tongues
(see figure below) with help of Wolfram Mathematica.
From this question, I have borrowed the function that computes the winding number of the circle map. My own version (in order to be consistent with the figure presented above) is
WindingNumber =
Compile[{n, η, ϵ, ϕ0}, (Nest[# + η + ϵ*Sin[#] &, ϕ0, n] - ϕ0)/(2*Pi*n)];
Here, η
is the parameter, ϕ0
is the initial value and ϵ
is the parameter, too. I know that each Arnold tongue corresponds to the rational value of WindingNumber
. So, my idea is to check that for a given values of ϵ
and η
is rational or not. To do it, I need the Wolfram Mathematica analog of RationalQ
function (see discussion here). As I understand, there is no analog of RationalQ
function, but in this question, I see the naive realization:
TrueQ@Element[x, Rationals]
where (as I understand) one checks that x
belongs to Rationals
(or not). So, I have tried to create a grid of parameters η
and ϵ
with help of Table
. For each point of the grid, I check is WindingNumber
rational or not with the help of the function written above. If true, I mark this point by 1, if false, I mark by 0, so I write
ArnoldTongues = Table[{ϵ, 2*Pi*i,
If[TrueQ@Element[WindingNumber [100, 2*Pi*i, 1.0, 0], Rationals], 1,
0]}, {i, 0, 1, 0.01}, {ϵ, 0, 1, 0.01}];
As a result, I have the array that is suitable for ListDensityPlot
.
However, I obtain that the winding number is always irrational for every point on my grid, which is impossible. What am I doing wrong?
WindingNumber
only returns real numbers. Mathematica does not consider any real number to be rational. Only explicit ratios of integers are considered rational. CompareTrueQ@Element[0.25, Rationals]
withTrueQ@Element[1/4, Rationals]
$\endgroup$Rationalize
. But it seems useless. Does any other approach to visualize Arnold tongues in Wolfram Mathematica exist? $\endgroup$Cases[wnums, wnum_ ;/ Abs[wnum - ratonal] < tol]
for each rational you want and some tol, e.g. 1E-4 $\endgroup$wnums
and compare each element with a givenrational
with the predefined tolereancetol
? Does it mean that I have to generate list of rationals, too? $\endgroup$