I want to draw sin, cos, tan and other mathematical functions with the shader editor. How do I do this?
This aspect may not matter that much to you.. ( if it did, it might be better to go to a vector-graphics program and use its internal rasterization, or implement the graph as geometry in Blender).
As always, open to challenge, but stroking a sine-wave, or other trig. functions, with an even thickness, turns out to be a hard problem. See, for example, this article. And you would need different distance-functions for every graphed function.
You could let the compositor in Blender approximate it for you with edge-detection..
First graph f(X) < Y:
And then put the result (on the left) through edge-detection and dilation in the compositor:
but I wouldn't expect it to be worth the hack, since even that is still an approximation..
A really simple node setup that gives you a gradient as well, which of course can be changed to a solid line if you want.
Using a MixRGB node set to difference mode, comparing sin(x) to y just like an equation. You can do this to plot any equation, really.
Here it is with a custom color, thickness, and gradient.
Well, I can't offer a uniform line thickness, but I can give you procedural axis grid lines
You can download a copy here: https://blenderartists.org/t/math-graph-shader/1380100