6
$\begingroup$
FunctionPeriod[Sin[16 Pi x/5 - Pi/8], x, Integers]
80

then I ListPlot the function:

ListPlot[Transpose[{Range[0, 90], Sin[16/5 π Range[0, 90] - π/8]}], Filling -> Axis]

then I test the number:

Union[Simplify[Sin[16/5 π Range[0, 90] - π/8]]]
{-Cos[π/40], Cos[(7 π)/40],Cos[(9 π)/40], -Sin[(3 π)/40], -Sin[π/8]}

so I wonder why Mathematica gives 80 instead of 5?

$\endgroup$
3
  • $\begingroup$ possible duplicate of How to find the period of an arbitrary mathematical function? $\endgroup$ Sep 24, 2014 at 13:53
  • $\begingroup$ The help file for FunctionPeriod says it "gives a period p of the function f over the reals such that f(x+p)==f(x)". This is certainly the case here: 80 is "a period" of the function. Nowhere in the docs does it say that it will give the minimum period (in this case 5). $\endgroup$
    – bill s
    Sep 25, 2014 at 0:17
  • $\begingroup$ Oh I understand. $\endgroup$
    – partida
    Sep 25, 2014 at 4:47

1 Answer 1

7
$\begingroup$

FunctionPeriod is certainly imperfect. There is already discussion of this in this question, though that predates FunctionPeriod and uses lower level tools buried in the Periodic context. Nonetheless, the same comments apply:

FunctionPeriod[Sin[3 t] Sin[5 t], t]
(* Incorrect result: 2Pi *)

FunctionPeriod[TrigFactor[Sin[3 t] Sin[5 t]], t]
(* Correct result: Pi *)

Similarly,

FunctionPeriod[Sin[16 Pi x/5 - Pi/8], x, Integers]
(* Incorrect result: 80 *)

FunctionPeriod[TrigFactor[Sin[16 Pi x/5 - Pi/8]], x, Integers]
(* Correct result: 5 *)

I don't know of any cases where FunctionPeriod returns a result that is too small so you might generally try applying several of the Trig* commands and grab the absolute value of the minimum.

$\endgroup$
4
  • $\begingroup$ It's good to have this information in an answer rather than the comment section like the duplicate to which you refer. Is this issue best considered a bug or functionality-in-progress? $\endgroup$ Sep 24, 2014 at 13:57
  • $\begingroup$ I don't think this is a duplicate, as the other question predates FunctionPeriod. Also, while FunctionPeriod builds on the Periodic context, there are differences. I guess I'd say it's a bug but I doubt that it's a very high priority bug. $\endgroup$ Sep 24, 2014 at 14:03
  • $\begingroup$ Thanks for TrigFactor and Trig* - an excellent answer $\endgroup$
    – eldo
    Sep 24, 2014 at 14:08
  • $\begingroup$ @MarkMcClure fair enough. $\endgroup$ Sep 24, 2014 at 16:28

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.