Homework 3

Name:
Math 213 - Math with Mathematica
Due Friday, October 2, 2009 at 11:59pm.

This assignment will incorporate parts of Chapters 3.

Introduction: Fibonacci Numbers

Read pages 35 and top of 36.

The Fibonacci numbers are a sequence of numbers that is defined recursively.  That is, each element is defined in terms of previous elements in the sequence.  Mathematica lets us define numbers recursively.  It is important to understand the difference between the two different ways that one might define a sequence recursively, as highlighted by the difference between f, defined on page 36 and fib, defined on page 37.  Read through pages 36 and 37 to understand this difference.

Problem 3-1: Fibonacci Numbers

Input the functions f and fib here: (pages 36 and 37).  Then evaluate f[20] and fib[20].

fib[1]=1;fib[2]=1;

fib[n]:=fib[n]=fib[n-1]+fib[n-2]

Compare how Mathematica stores these functions.

To see what values of f and fib are defined (and therefore how many computations Mathematica will be doing to generate new instances), use the following commands

?f

?fib

What is the downside of computing the Fibonacci numbers using fib instead of f?

Complete Exercise 3.1

Complete Exercise 3.2

Problem 3-2: Fibonacci Ratios

Complete Exercise 3.5

Complete Exercise 3.6

Read to the bottom of page 39, and calculate N[ϕ,k]

Use Mathematica to find the limit of the Fibonacci sequence:

Read to the bottom of page 39.  Calculate N[ϕ,k].

Mathematica knows about the Fibonacci sequence and can calculate the limit of the ratio using the following:

Limit[Fibonacci[n]/Fibonacci[n-1],n->Infinity]

Problem 3-3: The towers of Hanoi

Read the section on the Towers of Hanoi on page 42.

Complete Exercise 3.16 (*)

(*) Note:  Those of you who are obsessive-compulsive or bored can decide to answer this question by NOT ignoring leap years.

Complete Exercise 3.26 (p.46)

Problem 3-4: Code Words

Read pages 43 and 44.

Complete Exercise 3.17

Complete Exercise 3.18

Complete Exercise 3.19