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.
sicp-all-tasks/sicp/2_002e95

130 lines
1.2 KiB

Exercise 2.95: Define
P
1
,
P
2
, and
P
3
to be the polynomials
P
1
:
x
2
2
x
+
1
,
P
2
:
11
x
2
+
7
,
P
3
:
13
x
+
5.
Now define
Q
1
to be the product of
P
1
and
P
2
, and
Q
2
to be
the product of
P
1
and
P
3
, and use greatest-common-divisor
(Exercise 2.94) to compute the GCD of
Q
1
and
Q
2
.
Note that the answer is not the same as
P
1
. This example introduces
noninteger operations into the computation, causing difficulties with the
GCD algorithm.127 To understand what is happening, try tracing
gcd-terms while computing the GCD or try performing the
division by hand.