Department of Computer Sc.
& Engineering
Parallel and Distributed Computing Lab.
Monsoon semester 2015-16
1) Write a program to implement summation of n data values stored in an array.
2) Write a program to calculate the following dot product:
x. y x0 y0 x1 y1 xn1 y n1
3) The following definite integral of nonnegative function f(x)
b
I f ( x)dx
a
can be calculated using following trapezoidal rule:
I h[( f ( x0 ) f ( xn ) / 2 f ( x1 ) f ( x2 ) f ( xn1 )]
where h (b a) / n .
Write a program to calculate the definite integral using trapezoidal rule.
4) The following definite integral of nonnegative function f(x)
b
I f ( x)dx
a
can be calculated using following Simpson’s 1/3 rule:
h
I [( f ( x0 ) 4 f ( x1 ) 2 f ( x 2 ) 4 f ( x3 ) 2 f ( x n2 ) 4 f ( x n1 ) f ( x n )]
3
where h (b a) / n .
Write a program to calculate the definite integral using Simpson’s 1/3 rule.
5) Write a program to compute f(x) using the Lagrange’s interpolation defined as follows :
f ( x) L0 y0 L1 y1 L2 y 2 Ln1 y n1
( x x 0 )( x x1 )( x x 2 ) ( x x i 1 )( x x i 1 ) ( x x n1 )
Where L
i ( x i x 0 )( x i x1 )( x i x 2 ) ( x i x i 1 )( x i x i 1 ) ( x i x n1 )
6) Given the data set d0, d1, …, dn-1, the prefix computation needs to calculate
Pi = d0 + d1 + d2 +…+ di , 0 i < n
Write a program for the above prefix computation.
7) Write a program to implement the following matrix-matrix multiplication:
n1
cij aik bkj , 0 i, j n
k 0
8) Write a program to compute the polynomial
f a0 x 0 a1 x1 a2 x 2 an1 x n1
9) Write a program to implement the following matrix-vector multiplication:
c k a k 0 x0 a k1 x1 a k ,n1 xn1 , k = 0, 1, …, n-1