Previous Up Next

9.2.2  Finding a period of an expression

The period command finds a period of a given periodic expression.

Remark.

If periodic returns zero for an expression f(x), it does not always mean that f is constant. For example, f(x)=⌊ x−⌊ x−1⌋⌋ is always equal to 1 because 1≤ x−⌊ x−1⌋<2, but g(x)=⌈ x−⌊ x−1⌋⌉ is not constant by the same argument (for x∈ℤ, g(x) is equal to 1, and for x∉ℤ its value is 2). However, periodic returns zero for both functions, as it is unable to detect changes in isolated points.

Examples

To define and display a square wave, you can enter:

sw:=sign(sin(pi*x)):; plot(sw,x)

You observe that the period is equal to 2. Indeed:

period(sw)
     
2           

Any rational function with periodic variables is periodic if the variable periods are commeasurable (i.e. if the quotient of any two periods is a rational number). Also, if f is periodic, then gf is periodic for any function g. For example, define two periodic functions f and g with periods 2 and 3, respectively, and then the function h(x)=f(x)g(x)/ln(1+f(x)2+g(x)4):

f:=periodic(x^2,x=-1..1):; g:=periodic(x^3,x=-3/2..3/2):; h:=f*g/ln(1+f^2+g^4):; plot(h)

The above graph indicates that h is possibly periodic; indeed, its period is equal to 6, which is the least common multiple of the periods of f and g.

period(h)
     
6           

A function built from periodic functions with periods which are not commeasurable is not periodic. For example, f(x)=sin(x)+sin(π x) is not periodic:

period(sin(x)+sin(pi*x),x)
     
+∞            

Often (but generally not), the smallest period is returned, such as for the function f(x)=sin2 x, for instance.

period(sin(x)^2,x)
     
π            

Previous Up Next