need help with computational physics hw for python

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

need help with computational physics hw for python

Post by answerhappygod »

need help with computational physics hw for python
Need Help With Computational Physics Hw For Python 1
Need Help With Computational Physics Hw For Python 1 (43.66 KiB) Viewed 54 times
Exercise 6.8 In this exercise you'll write a program to calculate the eigenvalues and eigenvectors of a real symmetric matrix using the QR algorithm. The first challenge is to write a program that finds the QR decomposition of a matrix. Then we'll use that decomposition to find the eigenvalues. Refer to the question in your textbook for the complete details to this exercise. b) Write a Python function that takes as its argument a real square matrix A and returns the two matrices Q and R that form its QR decomposition. As a test case, try out your function on the matrix listed in this problem description from your textbook. Check the results by multiplying Q and R together to recover the original matrix A again. You can use the numpy function dot() to perform matrix multiplication. :#Type your code here /20pts. c) Using your function, write a complete program to calculate the eigenvalues and eigenvectors of a real symmetric matrix using the QR algorithm. Continue the calculation until the magnitude of every off-diagonal element of the matrix is smaller than 106. Test your program on the example matrix above. You should find that the eigenvalues are 1, 21, -3, and-8. Out the eigenvectors and eigenvalues. :#Type your code here /20pts. d) Verify that your eigenvalues and eigenvectors satisfy the eigenvector equation: Av = λv # Type code here /10pts. e) Verify your eigenvectors and eigenvalues using the numpy.linalg function eigh(). # Type code here /10pts.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply