Computing Fibonacci

MATH 242 practice problems

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: Wednesday, September 24, at 5pm. Try to complete this before class, but you can ask last-minute questions on Wednesday before turning it in. Upload your solution as a Mathematica notebook to the Computing Fibonacci assignment on Moodle.

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.

Name:

What assistance did you receive and what resources did you use (if any) while working on this assignment?

(your response here)

Problem 1: Golden ratio powers

Let ϕ=((1+(Sqrt[5]))/2) be the golden ratio. Find the closest integer to ((ϕ^n)/(Sqrt[5])) for various positive integers n. What do you observe?
(This is similar Exercise 2.13 in the text.)

Problem 2: Fibonacci exact formula

Write a module that computes Fibonacci numbers using the exact formula given in Equation (2.5) on page 62 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.15 in the text.)

Problem 3: Faster verification of Cassini’s identity

Write a Mathematica module to implement Pseudocode 2.9 on page 69 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.