Tue May 20 22:25:36 2025 python_mistake_test(): python version: 3.10.12 numpy version: 1.26.4 Demonstrate some python mistakes. python_mistake01(): Show that A=B is not the right way to copy arrays. Use "=" to copy an array a = [ 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.] (Bad) b = a = [ 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.] Do stuff to b, but do not touch a... a = [-1. -1. -1. -1. 1. 1. 1. 1. 1. 1.] b = [-1. -1. -1. -1. 1. 1. 1. 1. 1. 1.] Repeat, but use COPY rather than "=" a = [ 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.] (Correct) b = a.copy() = [ 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.] Do stuff to b, but do not touch a... a = [ 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.] b = [-1. -1. -1. -1. 1. 1. 1. 1. 1. 1.] python_mistake02(): QR factorization on array stored as integer or real values. User software fails for integer values. A = np.array ( [ [1,2,3],[4,5,6],[7,8,10]]). Algorithm norm(Q^T*Q-I) norm(Q*R-A) mgs_vector 1.732051e+00 1.743560e+01 np.linalg.qr 5.235557e-16 5.528866e-15 A = np.array ( [ [1.0,2.0,3.0],[4.0,5.0,6.0],[7.0,8.0,10.0]]). Algorithm norm(Q^T*Q-I) norm(Q*R-A) mgs_vector 3.529601e-15 0.000000e+00 np.linalg.qr 5.235557e-16 5.528866e-15 python_mistake_test(): Normal end of execution. Tue May 20 22:25:37 2025