# Compare Periods over Different Domains

The periodicity properties of a function may differ as it is considered over different domains. The following command compares the period of a function over the integers, reals, and complexes.

 In[1]:= Xdomains = {Integers, Reals, Complexes};
 In[2]:= XcompareDomains[f_, x_] := Table[FunctionPeriod[f, x, dom], {dom, domains}]

Famously, the exponential function has an imaginary period.

 In[3]:= XcompareDomains[Exp[x], x]
 Out[3]=

Functions can be periodic over the reals only or integers only as well.

 In[4]:= XcompareDomains[Sqrt[Cot[x]], x]
 Out[4]=
 In[5]:= XcompareDomains[Mod[n^2 + 2 n + 3, 7], n]
 Out[5]=
 Out[6]=

On the other hand, power functions involving roots of are periodic over all three domains.

 In[7]:= XcompareDomains[I^n, n]
 Out[7]=
 In[8]:= XTable[I^n, {n, 0, 8}]
 Out[8]=

It is easy to compare the domains for many different functions.

 In[9]:= Xfuncs = {Exp[x], Sin[x], Cos[Pi x/2], Tanh[3 x], SquareWave[3 x/2], Mod[x, 5], Mod[2 x, 5], Mod[x^2 + 2 x + 3, 7], JacobiDS[x, m], Sqrt[Cot[x]], Sin[ Pi x]^(1/3)};
 In[10]:= Xperiods = compareDomains[#, x] & /@ funcs
 Out[10]=

Nicely format the results.