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?