Slot 1: Question 3
Due on 2020-12-05, 11:00 IST
A complex number is represented as a pair of floating point numbers
- (a,b) represents the complex number a+ib, where i is the square root
of -1.
You are given a 3x3 matrix (let us call it M) of such complex
numbers. The matrix is called Hermetian if for every row i and column
j, M[i][j] is the conjugate of M[j][i]. That is to say, if M[i][j]
represents the complex number a+ib, then M[j][i] should represent the
complex number a-ib.
You must output the number of entries M[i][j] such that M[i][j] is NOT
the transpose of M[j][i]. (If the matrix is actually Hermetian, then
this number will be 0.)
Hint: You can use
scanf("(%f %f) ",&x, &y);
to read a pair of floating point numbers in the given format into
float variables x and y. Please note that there is a space after the
closing bracket ')' and the closing double quote.
No comments:
Post a Comment