You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
967 B
63 lines
967 B
|
|
Exercise 1.31:
|
|
|
|
|
|
The sum procedure is only the simplest of a vast number of similar
|
|
abstractions that can be captured as higher-order procedures.51 Write an analogous
|
|
procedure called product that returns the product of the values of a
|
|
function at points over a given range. Show how to define factorial in
|
|
terms of product. Also use product to compute approximations to
|
|
|
|
π
|
|
using the formula52
|
|
|
|
|
|
|
|
π
|
|
4
|
|
|
|
|
|
=
|
|
|
|
|
|
|
|
|
|
2
|
|
⋅
|
|
4
|
|
⋅
|
|
4
|
|
⋅
|
|
6
|
|
⋅
|
|
6
|
|
⋅
|
|
8
|
|
⋅
|
|
⋯
|
|
|
|
|
|
3
|
|
⋅
|
|
3
|
|
⋅
|
|
5
|
|
⋅
|
|
5
|
|
⋅
|
|
7
|
|
⋅
|
|
7
|
|
⋅
|
|
⋯
|
|
|
|
|
|
.
|
|
|
|
|
|
|
|
If your product procedure generates a recursive process, write one that
|
|
generates an iterative process. If it generates an iterative process, write
|
|
one that generates a recursive process.
|
|
|
|
|
|
|