[plt-scheme] calculation time for 11.5.3
Using my def for add ,multiply and finally exponent which is
dependent
on the def for add and multiply i find calculation times increase
dramatically as i raise the exponent. (exponent 10 4) takes a long
long
time.
Can i assume that the nature of the functions is such that the
number
of calculations increases hyperbolically?? and not a function of sick
computer?
code is:
(define (multiply n x)
(cond
((= x 0) 0)
(else
(add n (multiply n (sub1 x))))))
which is used for:
(define (exponent x n)
(cond
( (= n 0) 1)
(else
(multiply x (exponent x (sub1 n))))))
mike