Computing Fibonacci

Math 242 practice problems

Name: _________________

Learning Goals: Gain proficiency with programming in Mathematica. Develop and implement an algorithm to solve a mathematical problem, and interpret your results.

Your task: Complete the two problems below involving Fibonacci numbers and Cassini’s identity.

Due: Friday, February 24 at 5:00pm. Upload your solution as a Mathematica notebook to the Computing Fibonacci assignment (Moodle link).

Grading: If you write Mathematica modules for each problem and demonstrate that they work as expected, you will earn a Satisfactory grade for each problem.

Need help? Review the notes from class (which are posed on the course web site), talk with your classmates, email Prof. Wright, or visit the help session.

Problem 1

Write a module that computes Fibonacci numbers using the exact formula, Equation (2.5) on page 55 of the text. Your module should accept a parameter n and return the number (Subscript[F, n]). Use your module to compute (Subscript[F, n]) for n=0,1,2,...,25 and confirm that your module produces the same numbers as our Fibonacci code from class.
(This is similar to Practice 2.12 in the text.)

Problem 2

Write a Mathematica module to implement Pseudocode 2.7 on page 61 in the text. After you test the module, compare its runtime with the runtime of our verifyIdentity module from class (make sure to remove any print statements first). You should find that this new module runs in about one-third as much time as the module from class.