Problem  1.  It is desired to calculate all integral powers of the number    x= (sqrt(5.)-1.)/2.
It turns out that the integral powers of x satisfy a simple recursive relation

x^ (n+1) = x ^ (n-1) - x^ n

Show that the above recurrence relation is unstable by calculating x ^ 16,  x^ 30,  x^ 40  and  phi ^ 50 from the recurrence relation and comparing with the actual values.

Problem 2. Given x_ n = (1/3) ^ n, it turns out that the integral powers of (1/3) satisfy a simple recursive relation

x_ (n+1) = (13/3) x_n - (4/3) x_(n-1) with x_0 = 1 and  x_1 = (1/3)

Show that the above recurrence relation is unstable by calculating x_15, x_30, x_40 and  x_50 from the recurrence relation and comparing with the actual values.

Problem 3. The recurrence relation

y_ (n+1) = e - (n+1) y_ n
 
(where e is the base of natural algorithm) can be obtained from integration by parts to the  integral

y_n = int { x^n e^x dx }

with limits 0 and 1  [int stands for integral].

Show that the above recurrence relation is unstable by calculating y_15 and  y_20 from the recurrence relation.

Problem 4.  Compute the dot product of the following two vectors

x = [ 2.718281823, -3.141592654, 1.414213562, 0.5772156649, 0.3010299957]
and
y = [1486.2497, 878366.9879, -22.37492, 4773714.647, 0.000185049 ]

Compute the summation in four ways

(i) forward order Summation { x_i y_i } for i = 1, n

(ii) reverse order Summation { x_i y_i } for i = n, 1

(iii) largest to smallest order (add positive numbers in order from largest to smallest, then add negative numbers in order from smallest to largest and then add the two partial sums)

(iv) smallest to largest order (reverse order of adding in the previous method)

Use both single & double precision for a total of eight answers. Compare the results with the correct value 1.006571 E -9.