I am working with the cosine function with a very large input, like cos(a* t)
, where t
varies between 1
and ~ 200
; and a
can be as large as 10^8
-
I come across, as expected, the artifact error. If I sample t
with a stepsize of 0.01
with a
100, I get a plot like this :
Notice, that for large value of a
, the sampling of t
needs to be fine, otherwise, you will not get regular cosine shape from -1
to 1
. Sometimes, wave peaks, and other times wave troughs will be missed, due to low granularity, and you will end up with a different shape of the wave than the theoritical value.
Now, increase a
to be 100000
, and as expected, the effect is much more pronounced.
My question : Is there a formula / algorithm, to avoid this effect? Is there a formula, that tells you the correct step size for a large value of a
?
I tried to google the following keywords : large input cosine function computer graphics
, but that did not help.
Thank you.