h2> Programming Assignment 3

Prob 1. Consider complex numbers a+ib where i2 = -1 and a and b are reals. You may use float or double for reals ! Given two n-tuples p=(p1,p2,...,pn) and q=(qi,q2,...,qn) of complex numbers, the inner product of p and q, written < p|q > is the sum of pi* times qi, summed over all i from 1 thru n. (Here, pi* is the complex conjugate a-ib of pi = a+ib). Compute < p|q > and < q|p > and see how they are related.

Prob 2. To compute the exponentiation function power(x, t) where t is a positive integer, we can use the following method. If t is even then power(x,t) = power(x,t/2)*power(x, t/2). If t is odd then power(x,t) = power(x, t-1)*x. Define the appropriate base cases and write a function based program to implement this strategy.

Prob 3 Verify that

             Fib(i+1) =   1  1 Fib(i)
             Fib(i)       1  0 Fib(i-1)
where Fib(i) is the i-th Fibonacci number. Use this relation to compute Fib(n) for a given n. Can you extend the method described in the previous problem ?