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
Binary classification algorithm
Mila [183]

Answer:

What is this exactly?

Explanation:

If your asking for the definition, binary classification is the task of classifying the elements of a set into two groups on the basis of a classification rule.

3 0
2 years ago
Steam in a heating system flows through tubes whose outer diameter is 5 cm and whose walls are maintained at a temperature of 19
fomenos

Answer:

rf

Explanation:

attached to the tube. The space between the fins is 3 mm, and thus there are 250 fins per meter length of the tube. Heat is transferred to the surrounding water at T= 43.06°C, with a heat transfer coefficient of 5300 W/m2 · °C. Determine the increase in heat transfer from the tube per meter of its length as a resu.

7 0
3 years ago
Which engineers are requried to have a PE (professional engineer) license?
Elena-2011 [213]
Professional engineers need to complete a four year college degree, work under a Professional Engineer for four years, pass two intensive competency exams, and earn a license from their state’s licensure board.
7 0
3 years ago
Read 2 more answers
the voltage across a 5mH inductor is 5[1-exp(-0.5t)]V. Calculate the current through the inductor and the energy stored in the i
Serggg [28]

Given Information:

Inductance = L = 5 mH = 0.005 H

Time = t = 2 seconds

Required Information:

Current at t = 2 seconds = i(t) = ?

Energy at t = 2 seconds = W = ?

Answer:

Current at t = 2 seconds = i(t) = 735.75 A

Energy at t = 2 seconds = W = 1353.32 J

Explanation:

The voltage across an inductor is given as

V(t) = 5(1-e^{-0.5t})

The current flowing through the inductor is given by

i(t) = \frac{1}{L} \int_0^t \mathrm{V(t)}\,\mathrm{d}t \,+ i(0)

Where L is the inductance and i(0) is the initial current in the inductor which we will assume to be zero since it is not given.

i(t) = \frac{1}{0.005} \int_0^t \mathrm{5(1-e^{-0.5t}}) \,\mathrm{d}t \,+ 0\\\\i(t) = 200 \int_0^t \mathrm{5(1-e^{-0.5t}}) \,\mathrm{d}t \\\\i(t) = 200 \: [ {5\: (t + \frac{e^{-0.5t}}{0.5})]_0^t \\i(t) = 200\times5\: \: [ { (t + 2e^{-0.5t} + 2 )] \\

i(t) = 1000t +2000e^{-0.5t} -2000\\

So the current at t = 2 seconds is

i(t) = 1000(2) +2000e^{-0.5(2)} -2000\\\\i(t) = 735.75 \: A

The energy stored in the inductor at t = 2 seconds is

W = \frac{1}{2}Li(t)^{2}\\\\W = \frac{1}{2}0.005(735.75)^{2}\\\\W = 1353.32 \:J

4 0
3 years ago
If x &lt; 5 and x &gt;c, give a value of c such that there
Arlecino [84]

we have  

x<5

x>c

we know that

The solution is the intersection of both solution sets of the given inequalities.  

The solutions of the compound inequality must be solutions of both inequalities.  

The value of c could be 5 or any number greater than 5, such that there are no solutions to the compound inequality

Because

A number cannot be both less than 5 and greater than 5 at the same time

therefore

the answer is

for c_> there are no solutions to the compound inequality

7 0
3 years ago
Other questions:
  • Water at 20 bar and 400 C enters a turbine operating at steady state and exits at 1.5 bar. Stray heat transfer and kinetic and p
    14·1 answer
  • The velocity of a point mass that moves along the s-axis is given by s' = 40 - 3t^2 m/s, where t is in seconds. Find displacemen
    7·1 answer
  • A horse on the merry-go-round moves according to the equations r = 8 ft, u = (0.6t) rad, and z = (1.5 sin u) ft, where t is in s
    5·1 answer
  • With a reservoir pressure of 1.0 MPa and temperature of 750 K, air enters a converging-diverging nozzle, in a steady fashion. Fl
    5·1 answer
  • 1. Given: R= 25 , E = 100 V<br> Solve for I
    5·1 answer
  • Please help! timed test. This about electrical control. Please be serious.
    15·1 answer
  • Find the general solution of the equation<br>a) Tan A = 1/√3​
    11·1 answer
  • Compared with space operations specialists, intelligence officers are which of the following?
    7·1 answer
  • At what distance from the Earth’s surface is a 10,000 kg satellite if its potential energy is equal to –5.58 x 1011 J? (choose t
    5·1 answer
  • Tech A says that wiring diagrams are essentially a map of all of the electrical components and their connections. Tech B says th
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!