Question: (b) In an unparenthesized infix arithmetic expression, like 3 4 5, we rely on a convention to determine which operation we apply first (rules of

 (b) In an unparenthesized infix arithmetic expression, like 3 4 5,

(b) In an unparenthesized infix arithmetic expression, like 3 4 5, we rely on a convention to determine which operation we apply first (rules of precedence). Are rules of precedence necessary for arithmetic operations Scheme? 3. Write Scheme definitions 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, defined so that (expt x y) yields r'). For the exercises below, however, please construct the functions r-rk using only * and function application. (a) cube. the function cube(x)- 3 (b) p, the polynomial function p(z) = +1 124 24x3-x + 21)3 (Hint: Of course it is possible to expand (r+11r4 24r3 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 defining p in stages-first define the polynomial q(z) r5 + 1 114 + 243-x + 21 as a Scheme function: now use this function to define p.) (c) Using your function cube, write the function tenth(x)-10 (d) Using the function tenth. write the function hundredth(x)-1100. Recall that 100 10 10 (e) How might you check to see whether your hundredth function gives you the right answer? (f) Reflect on your definition of hundredth above. What would have been the difficulty of defining this merely in terms of

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!