Patrick (patrickwonders) wrote,

  • Mood:

Things look nice in lisp...

So, very often for things that I'm toying with, I want to have a polynomial that meets certain criteria. For most applications in the past, I have sat down and figured it all out by hand.

Today, I was having trouble getting the conditions that I wanted 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. So, for the record, the above is:

26x3 - 63x4 + 54x5 - 16x6

Which is still not quite what I'm looking for for this application, but it's close.

Tags: lisp
  • Post a new comment


    default userpic

    Your reply will be screened

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.