1.40 Exercise 1.40
We want cubic to be a procedure of three parameter a, b, and c that returns a procedure of one parameter x that evaluates the function x^3 + ax^2 + bx + c. This can be done as so:
(define (cubic a b c) (lambda (x) (+ (cube x) (* a (square x)) (* b x) c)))
We can verify this works with an example, finding the root of the function x^3 + 2x^2 + 3x - 5 (which is approximately 0.89456):
> (newtons-method (cubic 2 3 -5) 1.0) 0.8945582482428005