"Play it again, ZSam..."
|
02-15-2017, 07:59 AM
(This post was last modified: 03-02-2017 06:08 AM by Ángel Martin.)
Post: #1
|
|||
|
|||
"Play it again, ZSam..."
a.k.a. Solving systems of non-linear equations using the successive approximations method (SAM)... in the complex domain (Z).
Now that we got the long title done and over with, the actual description should be a breeze... First off, this routine adapts to the 41Z platform the method published by JM Baillard (see here). A few program lines needed changing, mainly to adjust the registers mapping to the convention used by the 41Z. Using 41Z functions also reduced the code size, which is always welcome. This program includes routines for data entry and output of results - so it's a "driver"of the core routine published in JM's page. This provides a convenient way to use it. This method requires one equation in explicit form for each of the n-variables, thus n-equations in total as global labels in RAM. The global label names are prompted, as well as n guess (complex) values to start the iterative process. It's not a fast approach, so don't expect blasting speed - yet should be a reliable method with sensible initial guesses. Using the same example given in the above reference: z1 = ( z1^2 - z2 )^1/3 , z2 = ( z2^2 - z1 )^1/4 programmed as follows: Code: 01 LBL "Z1=" 11 LBL "Z2=" Using (1+i) as initial guesses for both z1 and z2, the results are obtained in a few seconds on the 41-CL, or with an emulator in Turbo mode. z1 = R02 + i R03 = 1.038322757 + 0.715596476 i z2 = R04 + i R05 = 1.041713085 - 0.462002405 i And here's the program code in all its glorious splendor:- Code: 01 LBL "ZSAM" E3/E+ is of course a shortcut for {1 E3, / , 1, +} ARCLI 01 is a shortcut for {FIX 0, CF 29, ARCL 01, SF 29, FIX 3} The updated 41Z_Deluxe module - including the ZSAM program in it is now in the DFT posting. Happy ZSAM'ing folks! Cheers, ÁM "To live or die by your own sword one must first learn to wield it aptly." |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)