Question: Please answer #5 using Mathematica F(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.
F(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 MathematicaR documentation on how to define functions in Mathematica, and see also this further documentation giving an example of a recursively defined function. 2. From the recursive definition, compute FI2], F[3], F[4] and FI5] 3. Calculate and plot F(n for 0Sn s 20 4. Time how long it takes Mathematica to compute the FIn] up to F[30] T TablelTimingFInll, In, 0, 3031 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 Fibl01- 0; Fibl11 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
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
