Hi folks !
The past couple of weeks were spent of developing heuristics for determining the
fundamental period of a given trigonometric function.
In our higher school, we all must have come across
One of the most striking properties of these functions is their periodicty.
The ability of a function to repeat its values in regular intervals has always
caught my imagination.
Well, SymPy ought to have a functionality to determine the period of a function.
The instigated me to implement this function now was the build failure in my
function_range(sin(x), x, domain=S.Reals) causes the build to time-out as the
number of critical points of
sin(x) in the entire real domain is infinite.
The same goes for other trigonometric functions as well.
However, if we can set the
domain argument to be a finite interval which
encompasses the entire behaviour of
sin(x) over the entire real domain, our
issue can be solved.
This led me to the idea of using the periodicity of the function as its domain.
f = sin(x) + sin(2*x) + cos(3*x)
We know that the period of
i.e. the LCM of the periods of individual function.
It is known !
Hence, in order to find the period of
f, we need the functionality to determine
the period simpler trigonometric functions such as
If the period of
T, then the period of
Using this property, we can easily compute the periods of
with our knowledge of the periodicity of the fundamental trigonometric functions.