# Finding a function which fits this data?

I need to find a polynomial (or other continuous elementary function) on the interval [70, 180] such that it passes through the points (70, 0) (this is a relative min), (105, 17) (this is a relative max), (130, 5) (min), (150, 13) (max), (180, 12) (min). I was able to find a series of cubics and quadratics which connect 2 points at a time, but I need just one function that fits all of this data (or at least a function which fits 3 points) and I'm not sure how to do it. Thanks!

-

You can let $f(x)$ be your equation. Since you have a total of 5 min/max, it means that your equation must be at least 6th degree.

$f(x) = ax^6 + bx^5 + cx^4 + dx^3 + ex^2 + fx + g$

And using the points you have:

$f(70) = a(70)^6 + b(70)^5 + c(70)^4 + d(70)^3 + e(70)^2 + f(70) + g = 0$

$f(105) = a(105)^6 + b(105)^5 + c(105)^4 + d(105)^3 + e(105)^2 + f(105) + g = 17$

$f(130) = a(130)^6 + b(130)^5 + c(130)^4 + d(130)^3 + e(130)^2 + f(130) + g = 5$

$f(150) = a(150)^6 + b(150)^5 + c(150)^4 + d(150)^3 + e(150)^2 + f(150) + g = 13$

$f(180) = a(180)^6 + b(180)^5 + c(180)^4 + d(180)^3 + e(180)^2 + f(180) + g = 12$

Using the fact that there are optimums:

$f'(x) = 6ax^5 + 5bx^4 + 4cx^3 + 3dx^2 + 2ex + f$

$f'(70) = 6a(70)^5 + 5b(70)^4 + 4c(70)^3 + 3d(70)^2 + 2e(70) + f = 0$

$f'(105) = 6a(105)^5 + 5b(105)^4 + 4c(105)^3 + 3d(105)^2 + 2e(105) + f = 0$

$f'(130) = 6a(130)^5 + 5b(130)^4 + 4c(130)^3 + 3d(130)^2 + 2e(130) + f = 0$

$f'(150) = 6a(150)^5 + 5b(150)^4 + 4c(150)^3 + 3d(150)^2 + 2e(150) + f = 0$

$f'(180) = 6a(180)^5 + 5b(180)^4 + 4c(180)^3 + 3d(180)^2 + 2e(180) + f = 0$

You have 10 equations and 7 variables. There should be one solution, although it looks tedious to look for it.

-
The min/max add a constraint, as you show. To guarantee a solution will require a 9th degree polynomial-that has 10 constants to match the 10 equations. – Ross Millikan Apr 22 '13 at 16:09
@RossMillikan Woops, I forgot about the optimums being max or min. But can't this be made simpler by using $f''(x) > 0$ for minimums (although we would be adding inequalities to it...)? I thought that 7 equations out of the 10 would have sufficed. Would you be kind enough to explain the need for 3 additional equations? – Jerry Apr 22 '13 at 16:21
Generally speaking, if you have fewer unknowns than equations, the system is overdetermined and has no solution. It can have, but usually that comes about because there is some linkage between the equations. It isn't that he requires specifically max or min, just requiring zero derivative at those points. That is what created your last five equations. – Ross Millikan Apr 22 '13 at 17:04
Thanks a lot for taking the time to answer this time-consuming question. I connected 2 points at a time using this exact same method, and most of my functions were of the form ax^3+bx+c. However, the coefficients were always very messy and since I later had to find the area under this curve i figured it would be much better to just do it in one shot with one equation. – Ovi Apr 22 '13 at 21:59