Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Please answer #6 using Mathematica image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: David M. Kroenke

5th Edition

B000CSIH5A, 978-0023668814

More Books

Students also viewed these Databases questions