Open Zaq-Xander opened 2 years ago
Here's what I'm doing at the moment: https://www.math3d.org/U7Y1XWaXK. It has a few little problems
For the abs(x)/x division by 0 problem, you could replace that with sign(x). The function name isn't romanized (#194), but it appears to work the same as abs(x)/x.
As for the sine curve not reaching the endpoint in that example, that's because you don't have enough sample points. sin(4 pi x) oscillates too rapidly for the linear interpolation to look smooth with only 128 sample points between x = -5 and x = +5. See this graph I just made in Desmos: https://www.desmos.com/calculator/e3hl9rtwxd It emulates the function in your example, with some additional numerical analysis, with the slider N adjusting the number of sample points.
Would it be possible to get built-in piecewise functions?
Here's what I'm doing at the moment: https://www.math3d.org/U7Y1XWaXK. It has a few little problems and would generally be nicer if the functionality I'm after were built in.
Cheers!