1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lys-0071 [83]
3 years ago
8

The Fibonacci sequence 1, 1, 2, 3, 5, 8, 13, 21…… starts with two 1s, and each term afterward is the sum of its two predecessors

. Please write a function, Fib(n), which takes n as the input parameter. It will return the n-th number in the Fibonacci sequence. Using R, the output for Fib(9) should give only the 9th element in the sequence and not any of the previous elements. Please Help :)
Engineering
2 answers:
Novay_Z [31]3 years ago
5 0

9th value is 34

Explanation:

R or Fib (n) function is given by: (n - 1) + (n - 2), where n is the number in the Fibonacci sequence .

Hence, fib (9) = (9 - 1) + (9 - 2)

                      = 8th value + 7th value on the sequence summed together  

<em>Fibonacci sequence: 1, 1, 2, 3, 5, 8, 13, 21.</em><em> </em>The 8th value is 21 and the 7th value is 13.  

R = (n - 1) + (n - 2)

R (9) 0r Fib (9) = 21 + 13

           = 34

Olin [163]3 years ago
5 0
<h2>Answer:</h2>

  #Create a function Fib to return the nth term of the fibonacci series

  #Method header declaration

   Fib <- function(n)  {

 

   #when n <= 1, the fibonacci number is 1

   #hence return 1

   if (n <= 1)

           return(1)

   #when n = 2, the fibonacci number is 1

   #hence return 1

   else if (n == 2)

            return(1)

   

   #at other terms, fibonacci number is the sum of the previous two

   #numbers.

   #hence return the sum of the fibonacci of the previous two numbers

   else

           return( Fib(n-1) + Fib(n-2))

   }    #End of method.

============================================================

<h2>Sample Output:</h2>

A call to Fib(9) will give the following output:

>> 34

============================================================

<h2>Explanation:</h2>

The above program has been written in R language and it contains comments explaining each of the lines of code. Please go through the comments in the code.

For readability, the actual lines of code have been written in bold face to distinguish them from the comments.

You might be interested in
The fine for passing a stopped school bus illegally on the right is
ioda
You will pay a minimum fine of $265 for your first offense. A second offense within 5 years of this nature carries an additional $265
8 0
3 years ago
In using the drag coefficient care needs to be taken to use the correct area when determining the drag force. What is a typical
stealth61 [152]

Answer:

Explanation:

We know that Drag forceF_D

  F_D=\dfrac{1}{2}C_D\rho AV^2

Where

             C_D is the drag force constant.

                 A is the projected area.

                V is the velocity.

                ρ is the density of fluid.

Form the above expression of drag force we can say that drag force depends on the area .So We should need to take care of correct are before finding drag force on body.

Example:

 When we place our hand out of the window in a moving car ,we feel a force in the opposite direction and feel like some one trying to pull our hand .This pulling force is nothing but it is drag force.

6 0
4 years ago
What is Euler's equation?
igomit [66]

Answer:

e^{ix} = cosx + i sinx

Explanation:

In mathematics, Euler's formula is an equation in complex analysis, that gives a relationship between an exponential factor and the trigonometric functions.

The Euler equation is:

e^{ix} = cosx + i sinx

Here,

e - base of the natural logarithm

i - imaginary unit

x - argument given in radians

sin , cos - trigonometric functions sine and cosine respectively.

4 0
3 years ago
Steam at 6 MPa and 5008C enters a two-stage adiabatic turbine at a rate of 15 kg/s. 10 percent of the steam is extracted at the
loris [4]

Answer:

Bubblebutt

Explanation:

4 0
3 years ago
Air-conditioning principles are being discussed. Technician A states that heat always
Sunny_sXe [5.5K]

Answer: C.

Explanation:

7 0
3 years ago
Other questions:
  • Determine the required dimensions of a column with a square cross section to carry an axial compressive load of 6500 lb if its l
    13·2 answers
  • For problems 1 and 2, six luminaires, similar to Style E used in the Commercial Building, are to be installed in a room that is
    13·1 answer
  • Determine the mean effective pressure of an ideal Otto cycle that uses air as the working fluid if its state at the beginning of
    11·1 answer
  • 37. In ______ combination of drugs, the effects of one drug cancel or diminish
    12·1 answer
  • What is the maximum volume flow rate, in m^3/hr, of water at 15.6°C a 10-cm diameter pipe can carry such that the flow will be l
    9·1 answer
  • Forcing a solid piece of heated aluminum through a die forms:
    15·2 answers
  • if stall speed in ktas for an aircraft us 100 ktas at sea level, what is the stall speed in ktas of the aircraft at 5000 ft dens
    7·1 answer
  • I will Brainliest
    7·2 answers
  • In the following scenario, what could the engineers have done to keep the bridge from collapsing?
    8·1 answer
  • Two solid yellow center lines on a two-lane highway indicate:
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!