1. Engineering
  2. Computer Science
  3. problem 1 the fibonacci numbers are defined as x11 x22...

Question: problem 1 the fibonacci numbers are defined as x11 x22...

Question details

Problem 1.

The Fibonacci numbers are defined as x(1)=1, x(2)=2, .... x(n) = x(n-1) + x(n-2) .... Write a function to find the first N Fibonacci numbers, with N being the input parameter. Try calling this function with a parameter of 10 and print out the corresponding Fibonacci number

Problem 2.

  1. Create a numpy matrix with the content shown below, with the first column the days and the second column daily returns0.01 0.003 0.015 4 0.026 0.006
  2. Create a numpy array that contains the cumulative returns of the daily return data above. Hint: use (1+r1)*(1+r2)-1 to calculate cumulative return for day two. Don’t forget to initialize the array
  3. Create a plot with the cumulative returns as y variable and the days as the x variable. Set the line color to be blue, linewidth to be 2 and label the x and y axis with names ‘day’ and ‘cumulative return’
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution