Suppose you wanted to, for example, calculate evenly-spaced points on a circle. This is a rather simple problem. For instance, just calculate something x=radius*cos(n), y=radius*sin(n), for evenly-spaced values of n (ie. repeatedly incrementing n by a given value). This directly gives evenly-spaced points on a circle of the given radius.
Now a question that seems to be at least as easy, if not even easier: How to calculate evenly-spaced points on an x2 parabola?
The parabola is one of the simplest possible curves. It doesn't get much simpler than that (other than a straight line). Surely there must exist a very simple way of calculating evenly-spaced points on it?
Maybe there's a simple function that you could use like x=f(n), and thus y=x2, that gives evenly spaced points on the parabola (for evenly spaced values of n)? Or alternatively some function such that y=f(n), x=sqrt(y)? Surely that f() function is something quite simple, maybe some inverse function, or anti-derivative of the parabola?
Quite unexpectedly, there is no such function, at least not in closed form.
It is possible to calculate the arc length of a parabola between some given values of x, using a closed-form function, but this the inverse of what we are looking for. We are not looking for the length of the curve between two values of x; rather, we are looking for how much x should change in order to get a given arc length.
As surprising as it might sound, this is just not possible, using any of the usual mathematical functions in closed-form expressions (which is how we would be able to calculate it using regular mathematical functions and operators, without having to resort to loops and approximations).
If you wanted to calculate evenly-spaced points on a parabola programmatically, the only reasonable approach would be to make an iterative search for a change in x that approaches the desired arc length (the desired accuracy dictating how many iterations you need to perform). There is no formula for getting it directly, like there was eg. with a circle.
This is quite surprising, given how seemingly simple the x2 parabola is.
No comments:
Post a Comment