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
We have a tube with a diameter of 5 inches that is 1 foot long. The tube then reduces the diameter to 3 inches. According to the
Ksju [112]
Can I get a picture? Of the question so I can understand it more?
6 0
2 years ago
Read 2 more answers
Two technicians are discussing the intake air temperature (IAT) sensor. Technician A says that the computer uses the IAT sensor
mart [117]

Both the technicians are correct.

Explanation

Intake air temperature sensor is used in engines of vehicles to monitor the temperature of air entering the engine.

They are basically made of thermistors whose electrical resistance changes according to temperature.

Depending upon the reading and accuracy of intake air temperature sensor, the power-train control module (PCM) will decide about the air and fuel mixture ratio in the engine.

The hot air in engine requires less fuel to operate the engine parts while cold air requires more fuel to operate the engine.

The ratio of air and fuel mixture should be maintained in the engine and it is done by PCM only after getting the input from IAT. So technician B is saying correct.

Also the IAT works as a backup to support the engine coolant temperature sensor by the computer.

As the IAT checks the temperature of outside air, it will help to change the coolant temperature of the engine based on the environment.

Thus technician A is also correct. So both the technicians are correct.

6 0
3 years ago
Any help is appreciated &lt;3
Len [333]

Answer:

forwarder

Explanation:

8 0
3 years ago
Tahir travel twice as far as ahmed, but onley one third as fast. Ahmed starts travel on tuesday at noon at point x to point z 30
shepuryov [24]

Answer:

6:00 pm the next day

Explanation:

Given that

Tahir traveled twice as far as Ahmed. We say,

Ahmed traveled a distance, D

Tahir would travel a distan, 2D

Tahir traveled 1/3 as fast as Ahmed, so we say

Ahmed traveled at a speed, S

Tahir would travel at a speed, S/3

If Ahmed starts travel on tuesday at noon at point x to point z 300km, by 9:00pm,

Time taken by Ahmed to travel is

9:00 pm - 12:00 pm = 9 hours

Ahmed, traveled 300 km in 9 hours, meaning he traveled at 33.3 km in an hour.

Speed, S that Ahmed traveled with is 33.3 km/h

Remember, we stated that Tahir travels at a speed of S/3, that is, The speed of Tahir is

33.3/3 = 11.1 km/h.

300 km would then be traveled in 300 km/11.1 km/h = 27 hours.

Tahir started traveling, 3 hours after Ahmed, that is 12:00 pm + 3:00 hrs = 3:00 pm, and if he's to spend 27 hours on the journey he would reach destination z at 6:00 pm the next day

7 0
3 years ago
Ammonia contained in a piston-cylinder assembly, initially saturated vapor at 0o F, undergoes an isothermal process during which
Rudik [331]

ANSWERS:

-P_{2(a)} =15.6lbf/in^2\\-P_{2(b)} =30.146lbf/in^2\\ T_{2(a)} =0^oF\\T_{2(b)} =0^oF\\x_{2(b)} =49.87percent

Explanation:

Given:

Piston cylinder assembly which mean that the process is constant pressure process P=C.

<u>AMMONIA </u>

state(1)

saturated vapor x_{1} =1

The temperature T_{1} =0^0 F

Isothermal process  T=C

a)

-V_{2} =2V_{1} ( double)

b)

-V_{2} =.5V_{2} (reduced by half)

To find the final state by giving the quality in lbf/in we assume the friction is neglected and the system is in equilibrium.

state(1)

using PVT data for saturated ammonia

-P_{1} =30.416 lbf/in^2\\-v_{1} =v_{g} =9.11ft^3/lb

then the state exists in the supper heated region.

a) from standard data

-v_{1(a)} =2v_{1} =18.22ft^3/lb\\-T_{1} =0^oF

at\\P_{x} =14lbf/in^2\\-v_{x} =20.289 ft^3/kg

at\\P_{y} =16 lbf/in^2\\-v_{y} =17.701ft^3/kg

assume linear interpolation

\frac{P_{x}-P_{2(b)}  }{P_{x}- P_{y} } =\frac{v_{x}-v_{1(a)}  }{v_{x}-v_{y}  }

P_{1(b)}=P_{x} -(P_{x} -P_{y} )*\frac{v_{x}- v_{1(b)} }{v_{x}-v_{y}  }\\ \\P_{1(b)} =14-(14-16)*\frac{20.289-18.22}{20.289-17.701} =15.6lbf/in^2

b)

-v_{2(a)} =2v_{1} =4.555ft^3/lb\\v_{g}

from standard data

-v_{f} =0.02419ft^3/kg\\-v_{g} =9.11ft^3/kg\\v_{f}

then the state exist in the wet zone

-P_{s} =30.146lbf/in^2\\v_{2(a)} =v_{f} +x(v_{g} -v_{f} )

x=\frac{v_{2(a)-v_{f} } }{v_{g} -v_{f} } \\x=\frac{4.555-0.02419}{9.11-0.02419} =49.87%

3 0
3 years ago
Other questions:
  • Which of the following is not true about Machine Learning?Machine Learning was inspired by the learning process of human beings.
    11·1 answer
  • Run the program and observe the output to be: 55 4 250 19. Modify the numsInsert function to insert each item in sorted order. T
    14·1 answer
  • Which of the following can minimize engine effort in save fuel
    15·2 answers
  • Explain the differences between planned and predictive maintenance.
    12·1 answer
  • 12. The small space above the piston in which fuel is burned is called the
    10·1 answer
  • 6. Given a sheet of metal that is 1.2 cm wide, 3.8 cm long and 1.0 mm thick with a density of 8.57 g/cm3, calculate the mass of
    8·1 answer
  • 1. Using the formula above, complete this task.
    9·1 answer
  • 1. In order to minimize hazards, what should you do before starting a job
    10·2 answers
  • Limestone scrubbing is used to remove SO2 in a flue gas desulfurization (FGD) system. Relevant reactions are given below. A lime
    8·1 answer
  • A. Briefly describe the microstructural difference between spheroidite and tempered martensite. Explain why tempered martensite
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!