[an error occurred while processing this directive]

cs150: Notes 5

Assignments Due

Procedures Practice

Defining Procedures
1. Define a procedure that takes three inputs, the first two inputs are procedures, and the third input is a number. The output of the procedure should be the maximum value produced by applying either the first or second input procedure to the input number.

Recursive Definitions
Here is the find-maximum procedure from Chapter 4:
(define (find-maximum f low high)
    (if (= low high) 
        (f low)
        (max (f low) 
             (find-maximum f (+ low 1) high)))))
2. (Exercise 4.8) The find-maximum procedure we defined evaluates to the maximum value of the input function in the range, but does not provide the input value that produces that maximum output value. Define a procedure that finds the input in the range that produces the maximum output value.

3. (Exercise 4.9) Define a find-area procedure that takes as input a function f, a low range value low, a high range value high, and an increment inc, and produces as output an estimate for the area under the curve produced by the function f between low and high using the inc value to determine how many points to evaluate.

[an error occurred while processing this directive]