(DM42) Matrix exponential
|
08-12-2023, 09:27 AM
Post: #3
|
|||
|
|||
RE: (DM42) Matrix exponential
Hi Gil
Thanks for your interest. This method for calculation the matrix exponential with power series expansion is a summation of many terms until convergence, not only 3 first terms. In addition there is a significant risk of overflow in intermediate terms which can be much larger than the converged results. Thus the halving calculations in lines 04 to 17, and repeated squaring (by matrix multiplication) lines 58 to 63 of matrix after convergence is achieved. DM42 and Free42 allows for numbers range up to about +/-1E6145, HP50g to about +/-1E499. Unfortunately I am not able catch overflow error on the DM42 for matrix multiplication (not sure whats happening). I can only get it for element-wise operations, and have updated the program with a final test so overflows are likely catched when flag 24 is cleared. The update is 63 LBL 04 64 FNRM 65 LAST 66 RTN 67 END In addition I will add instructions that for the DM42 or Free42 flag 24 should be cleared to catch out of range errors. On the HP50G: if you are writing a user-rpl program, be sure to set system flag -21 "Overflow --> error" and clear system flag -22 "Infinite --> error". There is also a HPGCC2 implementation for matrix exponential (probably more accurate and 50-100 times faster than any simple user-rpl implementation) at https://www.hpcalc.org/hp49/math/numeric/utilgcc.zip If you are willing to do a rom update to enable HPGCC3 programs, I have an even faster update. Send me a message if that is interesting. For very simple testing, you can use a square matrix with entries only at the diagonal, then (and only then) the matrix exponential is equal to elementwise exponention of diagonal elements. For testing on HP50G, you can e.g. use the EIG function on (symmetric) matrix on the HP50G to diagonalize the matrix. See e.g. Wikipedia on matrix exponential for limitations and how to do that. Best regards Gjermund |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)