TAILIEUCHUNG - Numerical Methods in Engineering with Python Phần 9

rong các ngôn ngữ khác, khối lệnh thường được đánh dấu bằng cặp kí hiệu hoặc từ khóa. Ví dụ, trong C/C++, cặp ngoặc nhọn { } được dùng để bao bọc một khối lệnh. | 341 Power and Inverse Power Methods EXAMPLE The stress matrix describing the state of stress at a point is -30 10 20 S 10 40 -50 MPa 20 -50 -10 Determine the largest principal stress the eigenvalue of S furthest from zero by the power method. Solution First iteration T Let v 10 0 be the initial guess for the eigenvector. Then -30 10 20 1 z Sv 10 40 -50 0 20 -50 -10 0 z 7302 102 202 77 z 1 v z 52 Second iteration -30 10 20 77 z Sv 10 40 -50 20 -50 -10 52 z 56. 442 z v z 1 56. 442 Third iteration -30 10 20 z Sv 10 40 -50 20 -50 -10 z z 1 v z 342 Symmetric Matrix Eigenvalue Problems At this point the approximation of the eigenvalue we seek is Ấ MPa the negative sign is determined by the sign reversal of z between iterations . This is actually close to the second-largest eigenvalue Ấ2 MPa. By continuing the iterative process we would eventually end up with the largest eigenvalue Ấ3 MPa. But since Ấ2 and Ấ31 are rather close the convergence is too slow from this point on for manual labor. Here is a program that does the calculations for us usr bin python example9_4 from numpy import array dot from math import sqrt s array v array for i in range 100 vOld z dot s v zMag sqrt dot z z v z zMag if dot vOld v sign v -v else sign if sqrt dot vOld - v vOld - v break lam sign zMag print Number of iterations i print Eigenvalue lam raw_input Press return to exit The results are Number of iterations 92 Eigenvalue Note that it took 92 iterations to reach convergence. EXAMPLE Determine the smallest eigenvalue Ấ1 and the corresponding .

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.