# Polynomial Fitting of Circular Data Object

This is a very odd question. I have a one dimensional data set that is graphed on a histogram. I am trying to curve fit this data set (using the class midpoints as the x values, and the frequencies as the y values); I know that this usually would not make sense, but I'm trying to accomplish this for a purpose that I know it 'works' for. I'm linking a rudimentary graph here to give you an idea of what I'm doing.

As you can see, at both points $x = 0$ and $x \approx 2^{32}$ (approximate maximum), the fit sharply turns to end on the exact frequencies at those points. Basically the points are supposed to be the 'same.' We have a distance function that maps our keyspace (the x values) to a circular representation, such that the distance $d(0,2^{32}) \approx 0$. It probably isn't possible, but I was wondering if there is a way to fit our data such that this is 'known' by the fitting algorithm so that there aren't sharp turns at the endpoints.