Question: Please answer #6 using Mathematica F(0) 0 F(1) = 1 F(n)- F(n-1)+F(n-2) for n >1. to give a recursive definition of the Fibonacci numbers: see
F(0) 0 F(1) = 1 F(n)- F(n-1)+F(n-2) for n >1. to give a recursive definition of the Fibonacci numbers: see the 1. Use Mathematica Mathematica documentation on how to define functions in MathematicaR, and see also this further documentation giving an example of a recursively defined function. 2. From the recursive definition, compute FI2], F[3], FI4] and F[5] 3. Calculate and plot F(n) for 0Sn s 20 4. Time how long it takes Mathematica to compute the F[n] up to F[30] TTablelTiming[F[nll, {n, 0, 30;] gives a table (named T) of times taken, and the values computed Extract just the times taken as TIIAll,1]l and ListPlot these times. What do you notice? Apply the (natural) logarithm function Log to the list of times and ListPlot that. What do you notice? What does this suggest about the time it takes to compute the nth Fibonacci number from the given recursive definition? We can speed up the time it takes to calculate the Fibonacci numbers by getting Mathematica to remember previously calculated values. It does this by placing those values in an associative array-a look-up table which it can access rapidly Fibl00; Fibl 1 Repeat the timings experiment for calculating Fib[n], for n from 0 through 30, and ListPlot the timings. What do you notice about them? Repeat this up to Fib 100] and then Fib[500] 5. Construct a table of pairs n,Fib[n for n from 0 through 50. What do you notice? 6. Now construct a table of n, Log[Fibn] for n from 1 through 50. What do you notice? What does this suggest about the growth of Fib[n] as a function of n
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
