Question

if anybody knows how to solve this Q with R languege, I will really appreciate it!3. (10 points) Using R, compute the first 1000 Fibonacci numbers starting with 1, and plot the ratios n+1 for n-1, 2, .., 999. Report R code and R plot. Xn Hint: The first and second Fibonacci numbers are x,-1, x2 1, and successive numbers can be generated by the formula Xm+1·+,I , for example X3 = X2 + X,-1 + 1 = 2, x4 + x,-2+1-3, and the sequence goes as 1,1,2,3,5,8,

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#Initialize the maximum number of terms
xterm = 1000

#First two terms
x1 = 1
x2 = 1
count = 2

ratio = c(1,1)
while(count<xterm)
{
xth = x1+x2
ratio[count+1] <- (xth/x2)
  
#Update the values
x1 = x2
x2 = xth
count = count + 1
  
  
print(ratio)
  
}
#Plot the ratio
plot(ratio)

Output:

e lf Anybody Knows How T / T compile R online ぐ-) C O Not secure | rextester.com/Vt-online-compiler AppsBookmarks K The Batma

Add a comment
Know the answer?
Add Answer to:
if anybody knows how to solve this Q with R languege, I will really appreciate it!...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 2-3. Let ?>0 and ?? R. Let X1,X2, distribution with probability density function , Xn be...

    2-3. Let ?>0 and ?? R. Let X1,X2, distribution with probability density function , Xn be a random sample from the zero otherwise suppose ? is known. ( Homework #8 ): W-X-5 has an Exponential ( 2. Recall --)-Gamma ( -1,0--) distribution. a) Find a sufficient statistic Y-u(X1, X2, , Xn) for ? b) Suggest a confidence interval for ? with (1-?) 100% confidence level. "Flint": Use ?(X,-8) ? w, c) Suppose n-4, ?-2, and X1-215, X2-2.55, X3-210, X4-2.20. i-1...

  • How can I find the inverse of the Linear Transformation From R^4 to R^4? x1 T...

    How can I find the inverse of the Linear Transformation From R^4 to R^4? x1 T = x1 22 -16 8 5 + x2 13 -3 9 4 x2 x3 x4 + x3 8 -2 7 3 + x4 3 -2 2 1

  • Hello! I need help understanding this question. I would really appreciate it if anybody could help...

    Hello! I need help understanding this question. I would really appreciate it if anybody could help me. thank you! 20. (Problem 16) in the bacterium Escherichia coll, the amino acid tryptophan is synthesized in a multistep pathway, beginning with an organic precursor called chorismate: Chorismate ——Y-Tryptophan 2 3 The numbers denote steps in the pathway, each catalyzed by an enzyme. There are five bacterial genes that encode polypeptides associated with these enzymes, called trpa, trp8, trpc, trp, and trpe. A...

  • I would really appreciate your help with solving this whole question of my assignment due in...

    I would really appreciate your help with solving this whole question of my assignment due in a few hours. Willing to rate and like!! Thank you so much Q1/ Solve the following series question a) is the following sequence increasing, decreasing, or not monotonic? Is the sequence bounded? a. an = 2n13 b) Use power series to approximate the definite integral to six decimal places. a. Jo 773 dx b. So 2 x ln(1 + x²) dx 0.3 x c)...

  • l. X) points Lei Xi, X, X b e random variables . I. adl X, is...

    l. X) points Lei Xi, X, X b e random variables . I. adl X, is "uifornly disi rilnicd 。" on [0,1]. The random variables Xi, X2, X3,... are independent. The random variable N is the first integer n 2 1 such that Xn 2 c where 0< c< is a constant. That is, N = min(n : Xn-c). What is EM?

  • Appreciate a step by step explanation to this question. Write two separate programs in python that...

    Appreciate a step by step explanation to this question. Write two separate programs in python that generate the n-th Fibonacci number. The programs should both take n as command line input. The first algorithm one should implement the recursive algorithm, and the second one should implement the iterative algorithm. Measure the time it takes for each of these versions (use for example, the time it module in python) to calculate the n-th Fibonacci number for the following values of n:...

  • Help please. I would really appreciate clear, full explanation of the method used. like and comment are rewarded for good answer. (a) Let v(r) be a scalar function of r, where r V +y? +22 (i) Show...

    Help please. I would really appreciate clear, full explanation of the method used. like and comment are rewarded for good answer. (a) Let v(r) be a scalar function of r, where r V +y? +22 (i) Show that (i) If F Vu) evaluate Jc Fdr where C is straight line going from the point defined by vector r1 to the point defined by r2 (b) Consider a body with a surface defined by 2(x2 + y2) + 4z2 1 (i)...

  • Can anyone explain to me in detail and step by step how to solve this problem?...

    Can anyone explain to me in detail and step by step how to solve this problem? I don't really understand by looking at the answer. 2. The Markov chain (Xn, n = 0,1,2,...) has state space S = {1,2,3,4,5) and transition matrix /1 0 0 0 0 0.2 0.1 0.6 0.1 0 P= 0 0.4 0 0.6 0 0 0 0 0.6 0.4 0 0 0 0 1 (b) Find P(X2 = 2, X3 = 4|X, = 2, X1 =...

  • Subgroup X1 X2 X3 X4 X R 1 98.4 98.6 98.3 98.7 98.5 0.4 2 97.5...

    Subgroup X1 X2 X3 X4 X R 1 98.4 98.6 98.3 98.7 98.5 0.4 2 97.5 97.6 98.0 97.6 97.7 0.5 3 98.8 98.9 98.4 98.7 98.7 0.5 4 99.1 99.3 99.4 99.2 99.3 0.3 5 97.8 98.0 98.2 98.0 98.0 0.4 6 98.3 98.5 98.5 98.5 98.5 0.2 7 98.9 99.0 98.6 99.0 98.9 0.4 8 97.5 97.7 97.6 97.9 97.7 0.4 9 99.3 99.3 99.2 99.4 99.3 0.2 10 98.5 98.7 98.7 98.3 98.6 0.4 a. You are...

  • 2. Here is a sorting algorithm that I like to use. Given an unsorted list of...

    2. Here is a sorting algorithm that I like to use. Given an unsorted list of size n, let Xx represent the data in location k of the unsorted list. Compare xi to X2 and switch if necessary so that they are in sorted order, smallest first. Compare Xn-1 and Xn and switch if necessary so that they are in sorted order, smallest first. • Compare x3 with its left neighbors, switching if necessary so that the 3 first entries...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT