INFO I210: Lab 7

Recursive Numerical Functions in Sifflet

Overview

Define and test two recursive functions in Sifflet.

This lab is for the assessment of the competency 07-3 (SiffRecNum).

Problems

Coding Standards through Chapter 9 apply to this lab. While the coding standards are actually for Python code, apply the spirit of the standards also to Sifflet programs—for example, use descriptive variable and function names.

Problem 1: Summing a Function

Define and test a Sifflet function which computes the sum of the terms f(x) = x2 + 3x + 7, for x = 1 to n. You should use a combination of functions. The parameter of your summing function is n. The other function should compute f(x).

Hints:

Testing:

Problem 2: power

Define a Sifflet function which computes xn for parameters x and n, where x may be any number and n is any integer ≥ 0.

Hints:

Testing:

Turning in Your Work

Turn in the following in Oncourse Assignments:

Grading and Assessment

(CA = Competency Assessment, all or nothing; pca = partial credit is available)

07-3 (SiffRecNum) RECURSION CA SUBTOTAL: 6 points, 5 to "pass." This is not recorded separately, and it is not "all or nothing." If you earn significantly less than passing, you may get a chance to resubmit; but do try to get it all right the first time!

Total: 9 points