In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces "how to solve the problem of simple determinant". In daily operation, I believe many people have doubts about how to solve the problem of simple determinant. The editor consulted all kinds of data and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubt of "how to solve the problem of simple determinant"! Next, please follow the editor to study!
Problem description
The sophomore learned part of the determinant, so I wondered if I could use Python to calculate the simple determinant.
Input: create a new folder, create a new Excel, write the data in figure 1, rename the page sheet to calculation, and save the Excel, and Python files in this folder. If not, write the path completely when you write Python.
(figure 1)
Output:
Solution
Using the openpyxl inside the Python, using the table, you think of the determinant, in fact, just using Python can also get the results, but using openpyxl will make the program seem closer to life. The diagonal solution of the determinant is used.
Listing 1 DFS solves the summation problem from 1 to 100 Python code
Import openpyxl# introduces openpyxl
Filename = rust. / find the matrix of 33. Xlsx'
Wb = openpyxl.load_workbook (filename) # Open Excel
Ws = wb ['Computing'] # Open the 'Computing' page
X11=float (ws.cell (1) 1) .value)
X12=float (ws.cell (1 and 2) .value)
X13=float (ws.cell (1p3) .value)
X21=float (ws.cell (2 and 1) .value)
X22=float (ws.cell (2) .value)
X23=float (ws.cell (2) 3) .value)
X31=float (ws.cell (3pm 1) .value)
X32=float (ws.cell (3pm 2) .value)
X33=float (ws.cell (3p3) .value)
X14=x11
X15=x12
X24=x21
X25=x22
X34=x31
X35=x32
Result = (x11 * x22 * x33) + (x12 * x23 * x31) + (x13 * x21 * x32)-(x13 * x22 * x31)-(x11 * x23 * x32)-(x12 * x21 * x33) # calculated by diagonal rule
Ws.cell (5penny 2). Value = result# write the result in (5pyr2) this cell
Wb.save (filename+'1.xlsx') # Save
Print ('execution complete')
At this point, the study of "how to solve the simple determinant problem" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.