Algorithm for proper drawing of cosine function

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.

In this case where cos(a * t) is the function of interest, the frequency is a/(2*pi) - therefore your sampling rate should be greater than 2 * a/(2*pi) (in this case you may even want the sampling rate to be even higher so that the cosine function has a nice curve to it).
To get the step size from this sampling rate just use t = 1/(sampling rate)