15c challenge: accuracy of a complex equation system
|
08-14-2023, 11:20 AM
(This post was last modified: 08-14-2023 11:56 AM by Albert Chan.)
Post: #10
|
|||
|
|||
RE: 15c challenge: accuracy of a complex equation system
This just setup matrix A and B, 10-digits precision
10 DESTROY ALL @ OPTION BASE 1 20 R=4 @ COMPLEX A(R,R),B(R),X(R) 30 DATA (100,-116.6666667),(0,266.6666667),(0,0),(0,0) 31 DATA (0,266.6666667),(1E6,-116.6666667),(-1E6,0),(0,0) 32 DATA (0,0),(-1E6,0),(1E6,147.3333333),(0,-150) 33 DATA (0,0),(0,0),(0,-150),(1E5,147.3333333) 40 FOR I=1 TO R @ FOR J=1 TO R @ READ A(I,J) @ NEXT J @ NEXT I 45 DATA 10,0,0,0 50 FOR I=1 TO R @ READ B(I) @ NEXT I Code: >RUN X(2) and X(3) are extremely close. If we solve X(2), X(3)-X(2) instead, we get *full* 12 digits accuracy. Code: >FOR I=1 TO R @ A(I,2)=A(I,2)+A(I,3) @ NEXT I MathPac2 Owner's Manual Supplement for HP-71 Wrote:MAT X=INV(A)*B directly computes the solution of the matrix equation A X=B instead of Newly adjusted A is very stable. Without resdiual correction, this run twice as fast, without giving up much accuracy. Code: >MAT X=INV(A)*B @ X(3)=X(3)+X(2) @ MAT DISP X |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)