Given $n$ arbitrary points, generate a function that passes through all points, with the line (or arc) between two points resembling a straight line

calculusfinitely-generatedfixed points-

I was wondering one day, say there were $n$ arbitrary points. Label the points $\{(x_1, y_1), (x_2, y_2), (x_3, y_3),…, (x_n, y_n)\}$ All the points have a unique x-value.

For simplicity, let’s say that the x-values aren’t too spaced out from each other, and that the differences between x-values are the same. Let the spacing between each x-value be $v_x$.

I would like to generate a function that passes through all the points, with the line (or arc) between two points most resembling a straight line.

This means that, between points, there shouldn’t be any excessive wiggles that ‘mess up’ the graph in any way. It should be ‘smooth’. As an addition, I want this function to wiggle up and down smoothly forever, not like a polynomial that zooms off to infinity, so some trigonomic waves should be used instead of polynomials. Unless, there’s another type of function that wiggles up and down that I don’t know about.

I first thought of using Taylor and Maclaurin series, but realized that I didn’t have any function to take the derivative of. Also, the result would be polynomials, which zoomed off to infinity.

I then tried combining a few trigonomic functions in Desmos. That didn’t work too well either, since these were approximations and didn’t quite go through the points exactly.

I also read a few other questions on this topic, but only found either:

  1. Generic formulas that only gave me a vague sense of what I was supposed to do
  2. Articles that were a bit too hard to understand
  3. Polynomials.

Write the function as f(x). Use the variables $v_x$ and $n$. If sigma notation is used, write the x and y coordinates of the points as $x_i$.

Best Answer

This might be worth a try. Choose some number $d$ comparable in size to $x_n-x_1$. Let $$f(x)=a_1\sin(x/d)+a_2\sin(2x/d)+\cdots+a_n\sin(nx/d)$$ Then the equations $$y_i=a_1\sin(x_i/d)+a_2\sin(2x_i/d)+\cdots+a_n\sin(nx_i/d),\qquad i=1,2,\dots n$$ give you $n$ linear equations in the $n$ unknowns $a_1,\dots,a_n$.