draw sines at higher freq I'm trying to plot some sine waves (code example in plain js here).
When freq is &quot;low&quot; (freq = 10 hz in that case), the plot is quite nice:

The problem is when I increase the freq (try to set var freq = 50 for example):

lots of ripples, it becomes distorted and not so good as plot. If I increment it more, even worse (var freq = 8030 for example is terrible).
When I see those kind of graph on pro systems, they are displayed just fine.
How would you improve it? FFT, splines, whatever? Which is the right approch?
I don't really need accurancy (i.e. for waveform analysis or whatever), just plot it nicely (as in Desmos https://www.desmos.com/calculator/eodkjlywjh, for example).
For a given «visual accuracy», you need to sample the sine at a sufficient number of time-steps per period.
At some point the display pixel density will be to low to render a sine accurately.
For waveform editors (that usually have access to only a finite rate sampled waveform, not a continously defined trigonometric function),  I assume that some practical approximation to the sinc(x) function is used to interpolate those samples to the desired density. There is still a question of what to do when the display is the limiting factor, rather than the input.