Assignment #4 - 92B
# Assignment #4 - 92B

Assignment #4 Weight 20
============= Due 19 Oct
E-Mail to HDLV
>>> Resolution of system of linear equations <<<
This assignment is for you to use arrays in Fortran; so we will be
working with 1-dimensional and 2-dimensional arrays.
You will have to solve the following linear equation KX = F
where K is an n*n matrix
X is an n*1 matrix or a vector (array)
F is an n*1 matrix
You have to solve such a system of equations in static deformation
and stress analysis where K corresponds to, for example, the stiffness
matrix, X represents the displacement vector and F is the force vector.
(Just so you know this could be useful !)
The system to solve is of this form:
a1*x + b1*y + c1*z = a
a2*x + b2*y + c2*z = b
a3*x + b3*y + c3*z = c
where a1 b1 c1 x a
K = a2 b2 c2 , X = y , F = b
a3 b3 c3 z c
Several techniques can be used to solve the system. You have to use the
following method (known as the Cramer's method).
This method involves the use of determinants. For a 3*3 matrix, we
compute the determinant this way:
| a1 b1 c1 |
det(K) = | a2 b2 c2 | = a1*| b2 c2 | - b1*| a2 c2 | + c1*| a2 b2 |
| a3 b3 c3 | | b3 c3 | | a3 c3 | | a3 b3 |
and where | a b | = a*d - c*b
| c d |
The solutions of the system are :
x = det(Kx)/det(K) , y = det(Ky)/det(K), etc...
where det(Kx) is the determinant of the matrix K where the column
corresponding to the variable x is replaced by the values of the
vector F.
Implement this method using matrix manipulations. Run your program on
these 2 systems of equations:
2x + 3y - z = 1 2x - 5y + 2z = 7
3x + 5y + 2z = 8 x + 2y - 4z = 3
x - 2y - 3z = -1 3x - 4y - 6z = 5
Finally, you have to implement a procedure which will verify your
results by doing a matrix multiplication of a 3*3 matrix with a 3*1
matrix. That is, multiplying your initial matrix K with your solution
vector.
Print out the system of equations in its matrix format: KX = F.