## Description

1. (10 points) Write a program name hw3pr1.cpp which reads a list of doubles

terminated by end of file into a vector and prints the mean (or average) and the

standard deviation (look up the formula and tell where you got it in a

comment). Print an appropriate message if the list is empty.

2. (20 points) Use your my_cbrt_2 function from hw2pr4 to define a more

accurate cube root for all values of n using this pseudocode:

double my_cbrt_3(double n)

If n is zero return zero.

If n is negative return -my_cbrt_3(-n).

Otherwise,

set x to my_cbrt_2(n)

do this 10 times: x = (2/3)x + n/(3*x*x)

return x

Write a main which repeatedly reads a number n and prints cbrt(n),

my_cbrt_3(n), and the relative error of my_cubrt_3(n). Name your program

hw3pr2.cpp. (The relative error should be quite small.)

3. (20 points) Write the fibonacci function described in Exercise 3 at the end

of Chapter 8, and a main which reads x, y, and n, calls fibonacci to fill the

vector, and then prints the ratio of the last element of v divided by the next

to last element. For example, an input of 1 2 7 prints a ratio of 1.61538.

Fun fact: No matter what x and y are, the larger n is, the closer the ratio is

to the golden mean. Name your program hw3pr3.cpp.

OPTIONAL EXTRA CREDIT

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

4. (10 points) In problem 2 the loop doesn’t need to be executed 10 times for

maximum accuracy. Write a program named hw3pr4.cpp to determine the smallest

number k such that looping k times is just as accurate as looping 10 times.

Hint: For k = 1 to 10, find the maximum relative error for n from 1/8 to 1

in steps of 1/1024. Use those 10 numbers to determine the smallest

number k such that looping k times is just as accurate as looping 10 times.

Name your program hw3pr4.cpp.