INFORMATION: The write-up should be word processed (after all this is a computing module!). The programming and its description must be based on the Microsoft Visual Studio 2012 C++. The write-up should contain
- Introduction (e.g. including a brief description/discussion of the subjects and tasks of the coursework, their possible applications in mathematics and physics, etc.)
- Methods and Results (e.g. including a brief description of the methods and the approaches used, results, their analysis, etc.)
- Conclusion (e.g. including a brief summary, comparison with known facts, approaches to improve the methods and/or analysis, application of your results, etc.)
- References (you may wish to use or cite some material from books, articles, web-sites, etc., for example to describe/discuss your subject or the methods of solution, or analysis. If you do this, you have to refer to the sources properly in the text, and need to supply the list of the references in the end of your report [after conclusions])
- Appendix (which must include a paper copy of your original computer code, some sample output and a copy of your Microsoft Visual Studio 2012 C++ project on CD, DVD or USB Flash drive).
MARKING SCHEME: write-up (40%), programme code (60%)
14PHA290 Coursework Assignment 1
NOTE:
- Introduction, main text, conclusions and references (without figures and Appendix) should not exceed 4 A4 pages.
- The submitted code must work under Microsoft Visual Studio 2012 C++ without any problems. Projects for alternative C++ Development Environments are not acceptable!
- Please make sure that the submitted CD, DVD or USB flash drive is readable and written without errors. Unreadable CD, DVD or USB flash will lead to a serious decrease of your mark!
- You have to submit your coursework with a cover sheet. This is an essential part of the coursework. By signing your cover sheet you confirm that the coursework is your own and that any sources of information used are clearly indicated.
- The University takes copyright issues and plagiarism very seriously. As a consequence, if your coursework has elements of plagiarism, you might face serious consequences. Therefore, be honest!
14PHA290 Coursework Assignment 2
TASK:
A 3×3 matrix A is defined as
1. Write a program which
- a) calculates and prints on the screen the determinant of matrix A, i.e. a scalar det(A) defined as:
det(A) = a11 ⋅ a22 ⋅ a33 + a13 ⋅ a21 ⋅ a32 + a12 ⋅ a23 ⋅ a31 − −a13 ⋅a22 ⋅a31 −a12 ⋅a21 ⋅a33 −a11 ⋅a23 ⋅a32
- b) calculates the inverse of matrix A (if it exists), which is
1 ⋅BT,if det(A)≠0, det(A)
b =a ⋅a −a ⋅a ,b =a ⋅a −a ⋅a ,b =a ⋅a −a ⋅a ,
11 22 33 23 32 12 23 31 21 33 13 21 32 22 31
b21 =a13 ⋅a32 −a12 ⋅a33, b22 =a11 ⋅a33 −a13 ⋅a31, b23 =a12 ⋅a31 −a11 ⋅a32, b31 = a12 ⋅a23 −a13 ⋅a22, b32 = a13 ⋅a21 −a11 ⋅a23, b33 = a11 ⋅a22 −a12 ⋅a21.
31 32 33 with elements
The matrix BT
b b bT b b b
11 12 13 11 21 31 BT=b b b =b b b
a11 a12 a13 A = a21 a22 a 23 .
21 22 23 12 22 32 b b bb b b
aaa
where
A−1 = bbb
11 12 13 B=b21 b22 b23
b b b
31 32 33
31 32 33 13 23 33
is the transpose of the matrix B. Note that the product of a scalar α and some matrix D is a matrix
d11 d12 d13 α⋅d11 α⋅d12 α⋅d13 α⋅D=α⋅d21 d22 d23 =α⋅d21 α⋅d22 α⋅d23 .
d d d α⋅d α⋅d α⋅d
31323331 32 33
Note, that if det(A) = 0 , the inverse of the matrix A does not exist, and the matrix A
is called not invertible or singular or degenerate. c) writes into the file the matrix A−1(if it exists).
d) checks that the matrix product A−1 A = I, where
14PHA290 Coursework Assignment
3
1 0 0I=0 1 0
whose elements are
3
cij =∑aik⋅bkj,i,j,k=1,2,3.
k=1
(See also Exercise 5: Arrays).
2. Test the program for
2.0 0 0a) A=0 4.0 0
1.0 2.0 3.0b) A=4.0 5.0 6.0
0 0 1
is a 3×3 identity matrix, or unit matrix. Your programme should print on the screen the elements of the matrix A−1 A. Note that the matrix product of two matrices A
andBisamatrix C(C=A B) c11 c12 c13
C=c21 c22 c23
c c c31 32 33
0 0 6.0
7.0 8.0 9.0