I have two quantities of interest, x
and y
which are functions of $\theta$ and thus implicitly of time. They also depend on two parameters a
and b
. However, y
is merely a dependent equation. They are defined and solved by
x[a_, b_] := a Cos[θ[t]]^2 + b Sin[θ[t]]^2 + θ'[t];
y[a_, b_] := 3 a^2 (Cos[2 θ[t]] + Sin[θ[t]]^2) - b Sin[θ[t]];
sol1 = First @ NDSolve[{x[1, 2] == 0, θ[0] == 0}, θ, {t, 0, 10}];
Clearly, y
is a periodic function of time. However, if I try to find the period of this function using
FunctionPeriod[y[1, 2] /. sol1, t]
I get 0 every time. This seems to be a problem due to the nature of the solution as an interpolating function, but I was wondering if there is a good way to get the period.
{\[Theta] -> Function[{t}, -ArcTan[Sqrt[b] Cos[Sqrt[a] Sqrt[b] t], Sqrt[a] Sin[Sqrt[a] Sqrt[b] t]]]}
and thenFunctionPeriod
will work. $\endgroup$Integrate[1/(a Cos[\[Theta][t]]^2 + b Sin[\[Theta][t]]^2), {\[Theta][t], 0, 2 Pi}, Assumptions -> a > 0 && b > 0]
$\endgroup${\[Theta] -> Function[{t}, -Sqrt[a] Sqrt[b] t + 2 ArcTan[ Cot[Sqrt[a] Sqrt[b] t] (-1 + Sqrt[Sec[Sqrt[a] Sqrt[b] t]^2])] - ArcTan[(Sqrt[a] Tan[Sqrt[a] Sqrt[b] t])/Sqrt[b]]]}
. $\endgroup$yy[t_] = y[1, 2] /. sol1[[1]]
and minimize the quadratic differencenmin = NMinimize[{(yy[3] - yy[3 + d])^2, 1 < d < 6}, d]
to get{4.84296*10^-14, {d -> 4.44288}}
with 4.4428 as period. Choose suitable starting point from a plot of y[1,2]. $\endgroup$