Competency 07-3: Recursive Numerical Functions

Identifier: SiffRecNum

Prerequisites: SiffCond

Functions that call helping functions; functions that call themselves.

Learning Objectives

Students should be able to:

  1. Design and interpret Sifflet programs that use a combination of functions.
  2. Design and interpret Sifflet programs that use recursive functions.
  3. Explain the terms recursion, base case, recursive step.

Lesson

Reading

Sifflet Tutorial Lessons 4 and 5

Lecture

Available in Oncourse Modules

Practice

Define and test a Sifflet function that computes the sum of the terms f(x) = x3 + 9 for x = 1 to n. You should use a combination of functions. The parameter of the main, or summing, function is n, the number of terms, and it computes the sum, using the helping function f. The parameter of the helping function is x.

Hints:

Solution

Assessments