SICP Workout (1.40) Resolution summary

Source: Internet
Author: User

SICP workout 1.40 is a casual job very easy, but it looks very complex, single problem.


The topic of the original question is as follows:

Define a procedure cubic, which is used with the Newtons-method process in the following form of expression:

(Newtons-method (cubic a b c) 1)

Can force three of times into the equation.

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqva2v5ym9hcmrpvee=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center "width=" 184 "height="/>

of 0 points.


The problem is very easy, asked us to do a cubic process, but it involves Newtons-method and three of the equation 0 points, assuming only to see the topic of the words really do not know where to start.


To finish this problem, we have to go back to the book to Newtons-method once again, the book's newtons-method definition such as the following:


(Define (Newtons-method g guess)  (Fixed-point (Newton-transform g) guess))



In fact, it is to seek the fixed point of newton-transform.


So what is this newton-transform, Newton's transformation?


The Newton-transform definitions in the book are as follows:


(Define (Newton-transform g)  (Lambda (x)    (-X (/(g x) ((Deriv g) x))))



Its function is to derive f (x) so that f (x) such as the following:

f (x) = X-g (x)/Dg (x)



As described in the book 1.3.4 describes the description of Newton's Law:


Assuming that x-> g (x) is a micro function, then a solution of the equation g (x) =0 is a fixed point of the function x->f (x). Middle F (x) = X-g (x)/Dg (x)


Well, back to our topic, we have a function

G (x) =


We're going to push into the 0 point of the function g (x), which is to ask for a solution of the G (x) =0.

As described above, we request (Newtons-method <g (x) > 1). Note that this is not a valid scheme statement.


The g (x) Here is the return value of the cubic process we are going to do.


The problem is very easy here, just to use the cubic process to generate a lambda process that represents a three-second equation, cubic process definitions such as the following:

(Define (cubic a B c)   (Lambda (x)    (+ (* x x x) (* a x x) (* b x) c))

Is the result a little bit unexpectedly simple?




Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.

SICP Workout (1.40) Resolution summary

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.