Two quantities a and b are said to be in the golden ratio if (a+b)ais equal to ab. Assuming a and b are line segments, the golden section is a line segment divided according to the golden ratio: The total length (a + b) is to the longer segment a as a is to the shorter segment b. It turns out that the ratios of successive terms of the Fibonacci sequence approximate the golden ratio. That is to say F(n+1)F(n) is, in the limit, the golden ratio, where F(n) is the nth number of the Fibonacci sequence. Consider the function below that computes an approximation to the golden ratio using the (n-1) and (n-2) numbers in the Fibonacci sequence: double golden(int n) { } double ratio; if (n <= 2) { ratio = 1.0; } else { ratio = ((1.0) * fib(n-1)) / (1.0 * fib(n - 2)); } return ratio; Which statements are true? 1.The function golden is recursive II.The function goldenis a helper function III.The function goldenassumes that another function fib computes the Fibonacci numbers required to compute the ratio
Two quantities a and b are said to be in the golden ratio if (a+b)ais equal to ab. Assuming a and b are line segments, the golden section is a line segment divided according to the golden ratio: The total length (a + b) is to the longer segment a as a is to the shorter segment b. It turns out that the ratios of successive terms of the Fibonacci sequence approximate the golden ratio. That is to say F(n+1)F(n) is, in the limit, the golden ratio, where F(n) is the nth number of the Fibonacci sequence. Consider the function below that computes an approximation to the golden ratio using the (n-1) and (n-2) numbers in the Fibonacci sequence: double golden(int n) { } double ratio; if (n <= 2) { ratio = 1.0; } else { ratio = ((1.0) * fib(n-1)) / (1.0 * fib(n - 2)); } return ratio; Which statements are true? 1.The function golden is recursive II.The function goldenis a helper function III.The function goldenassumes that another function fib computes the Fibonacci numbers required to compute the ratio
Related questions
Question
C++
![Two quantities a and b are said to be in the golden ratio if (a+b)ais equal to
ab. Assuming a and b are line segments, the golden section is a line segment divided
according to the golden ratio: The total length (a + b) is to the longer segment a as a
is to the shorter segment b. It turns out that the ratios of successive terms of the
Fibonacci sequence approximate the golden ratio. That is to say F(n+1)F(n) is, in the
limit, the golden ratio, where F(n) is the nth number of the Fibonacci
sequence. Consider the function below that computes an approximation to the
golden ratio using the (n-1) and (n-2) numbers in the Fibonacci sequence:
double golden(int n)
{
}
double ratio;
if (n <= 2) { ratio = 1.0; }
else { ratio = ((1.0) * fib(n-1)) / (1.0 * fib(n - 2)); }
return ratio;
Which statements are true?
1.The function golden is recursive
II.The function goldenis a helper function
III.The function goldenassumes that another function fib computes the Fibonacci
numbers required to compute the ratio](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F115bc08a-05f9-46c8-bfbd-3937dbcb6bf8%2F71e360d1-aaab-42f1-aa8e-f5ea4fb9de63%2Fh79pug_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Two quantities a and b are said to be in the golden ratio if (a+b)ais equal to
ab. Assuming a and b are line segments, the golden section is a line segment divided
according to the golden ratio: The total length (a + b) is to the longer segment a as a
is to the shorter segment b. It turns out that the ratios of successive terms of the
Fibonacci sequence approximate the golden ratio. That is to say F(n+1)F(n) is, in the
limit, the golden ratio, where F(n) is the nth number of the Fibonacci
sequence. Consider the function below that computes an approximation to the
golden ratio using the (n-1) and (n-2) numbers in the Fibonacci sequence:
double golden(int n)
{
}
double ratio;
if (n <= 2) { ratio = 1.0; }
else { ratio = ((1.0) * fib(n-1)) / (1.0 * fib(n - 2)); }
return ratio;
Which statements are true?
1.The function golden is recursive
II.The function goldenis a helper function
III.The function goldenassumes that another function fib computes the Fibonacci
numbers required to compute the ratio
![sequence. Consider the function below that computes an approximation to the
golden ratio using the (n-1) and (n-2) numbers in the Fibonacci sequence:
double golden (int n)
{
}
double ratio;
if (n <= 2) { ratio = 1.0; }
else { ratio = ((1.0) * fib(n - 1)) / (1.0 * fib(n - 2)); }
return ratio;
Which statements are true?
I.The function golden is recursive
II.The function goldenis a helper function
III.The function goldenassumes that another function fib computes the Fibonacci
numbers required to compute the ratio
O1, 11
I, III
II, III
I, II, III](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F115bc08a-05f9-46c8-bfbd-3937dbcb6bf8%2F71e360d1-aaab-42f1-aa8e-f5ea4fb9de63%2F26av9cq_processed.jpeg&w=3840&q=75)
Transcribed Image Text:sequence. Consider the function below that computes an approximation to the
golden ratio using the (n-1) and (n-2) numbers in the Fibonacci sequence:
double golden (int n)
{
}
double ratio;
if (n <= 2) { ratio = 1.0; }
else { ratio = ((1.0) * fib(n - 1)) / (1.0 * fib(n - 2)); }
return ratio;
Which statements are true?
I.The function golden is recursive
II.The function goldenis a helper function
III.The function goldenassumes that another function fib computes the Fibonacci
numbers required to compute the ratio
O1, 11
I, III
II, III
I, II, III
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)