# SICP Solutions: Section 1.3.4

### Section 1.3.4 - Procedures as Returned Values

#### Exercise 1.40

`cubic`

will create and return procedures that should be solved using Newton’s
method:

#### Exercise 1.41

Defining `double`

is quite simple:

All the fun comes when trying to calculate something like
`((double (double double)) inc)`

.

`(double double)`

essentially returns a procedure that applies the original
prodecure 4 times. Therefore `(double (double double))`

will apply what it
receives receives \(4 * 4 = 16\) times. So if we start from \(5\):

#### Exercise 1.42

#### Exercise 1.43

#### Exercise 1.44

Using the definition of `dx`

from above:

#### Exercise 1.45

So the general function would be something like:

The parameter `damps`

controls the number of repeated average damps.
Experimenting a bit showed that with 2 average damps we can calculate up to the
7th root. 3 average damps lets us calculate up to the 31st root. Using 4 damps
we were able to calculate at least up to the 512th root with no problems.

#### Exercise 1.46

We first define `iterative-improve`

. Note that it returns an anonymous procedure
that itself creates and executes a recursive procedure:

Now we can implement `sqrt`

and `fixed-point`

:

This concludes Chapter 1. Onwards to Chapter 2 then!