Question

SCHEME LANGUAGE Write Scheme denitions for the functions below. Use the interpreter to try them out...

SCHEME LANGUAGE

Write Scheme denitions for the functions below. Use the interpreter to try them out on a

couple of test cases to check that they work, and include this output with your solutions.

NOTE: Scheme provides built-in support for exponentiation (via the expt function, dened so

that (expt x y) yields xy). For the exercises below, however, please construct the functions

x 7! xk using only and function application.

(a) cube, the function cube(x) = x3.

(b) p, the polynomial function p(x) = (x5 + 11x4 + 24x3 ? x + 21)3.

(Hint: Of course it is possible to expand (x5 + 11x4 + 24x3 ? x + 21)3 as a polynomial

of degree 15 and write a Scheme function to compute this by brute force. You can avoid

much of this computation by dening p in stagesrst dene the polynomial q(x) =

x5 + 11x4 + 24x3 ? x + 21 as a Scheme function; now use this function to dene p.)

(c) Using your function cube, write the function tenth(x) = x10.

(d) Using the function tenth, write the function hundredth(x) = x100. Recall that 100 =

10 10.

(e) How might you check to see whether your hundredth function gives you the right answer?

(f) Re ect on your denition of hundredth above. What would have been the di-culty of

dening this merely in terms of ?

0 0
Add a comment Improve this question Transcribed image text
Know the answer?
Add Answer to:
SCHEME LANGUAGE Write Scheme denitions for the functions below. Use the interpreter to try them out...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT