Exercise 1.40 is a simple question, but it looks complicated. In essence, it is actually a simple question.
The original question is as follows:
Define a procedure cubic, Which is used together with the Newtons-method procedure in the following form expression:
(newtons-method (cubic a b c) 1)
Cubic Equation
.
The question is very simple. We need to create a cubic process, but it involves the zero points of Newtons-method and cubic equation. If you only read the question, you really don't know where to start.
To complete this question, first go back and repeat Newtons-method in the book. Newtons-method in the book is defined as follows:
(define (newtons-method g guess) (fixed-point (newton-transform g) guess))
In fact, it is to find the fixed point of Newton-transform.
So what is the Newton-transform?
The definition of Newton-transform in the book is as follows:
(define (newton-transform g) (lambda (x) (- x (/ (g x) ((deriv g) x)))))
Its function is to obtain f (x), so that f (x) is as follows:
F (x) = x-g (x)/DG (X)
As described in section 1.3.4 of the book when introducing the Newton method:
If X-> G (x) is a microfunction, then a solution of the equation g (x) = 0 is a fixed point of the Function x-> F (x, f (x) = x-g (x)/DG (X)
Okay. Back to our question, we have a function.
G (x) =
We need to push the zero point of the function g (x), that is, a solution for g (x) = 0.
As described above, it is our requirement (Newtons-method <G (x)> 1). Note that this is not a legal scheme statement.
Here g (x) is the return value of the cubic process we want to do.
The problem becomes simple here, but it is just a Lambda process that uses the cubic process to generate a cubic equation. The cubic process is defined as follows:
(define (cubic a b c) (lambda (x) (+ (* x x x) (* a x x) (* b x) c)))
Is the result a little unexpected and simple?