## Find the Polynomial You’ve Been Looking ForApril 2nd, 2009 Patrick Stein

Often, I want to have a polynomial that meets certain criteria. For most applications in the past, I figured it all out by hand.

Today, I was having trouble getting the conditions specified enough to get the sort of polynomial that I was expecting. After finding the coefficients for several sixth degree polynomials in a row, I figured I should instead be able to do something like this with the proper lisp:

(calculate-polynomial-subject-to
(value :at 0 :equals 0)
(derivative :at 0 :equals 0)
(nth-derivative 2 :at 0 :equals 0)
(value :at 1 :equals 1)
(derivative :at 1 :equals 0)
(nth-derivative 2 :at 1 :equals 0)
(value :at 1/2 :equals 3/4))

That’s all done now (polynomials.lisp). So, for the record, the above is: $26x^3 - 63x^4 + 54x^5 - 16x^6$. That is still not quite the polynomial I want for this application, but it’s close. A few minutes of Lisp saved me hours of whiteboard work.

Email: