Drake Wells What I Did Lab 2 Written Report PETE 301 I integrated an executable subroutine in Python to solve the tridiagonal matrix problem A x b using the SuperLU object from the scipy package I also used the xlwings package to read data from the active Excel worksheet Here are my imports at the start of the code I dynamically determined the size of the matrices and vectors by reading N from cell A1 Dynamic as in it can work for any value of N rather than a set value I read vectors e f g and b based on N using the given sht range command we covered in class I constructed the tridiagonal matrix A using dia matrix and solved for vector x using the SuperLU decomposition I wrote the solution vector x back to the active Excel worksheet starting from the ninth column in the excel spreadsheet Where The Results Can Be Found The value of N the matrix form of A and the solution vector x are printed to the debug console The solution vector x is also written to the active Excel worksheet starting from the ninth column Observations The code successfully reads data from Excel constructs the tridiagonal matrix and solves for x The solution is both printed to the debug console and written back to Excel meeting the assignment requirements By using the xlwings package I ensured integration between Python and Excel I verified the program against textbook Example 11 1 Section 11 1 1 to ensure accuracy I kept a copy of the worksheet for Problem 11 1 in the workbook and ensured it runs correctly when active
View Full Document