Post Reply 
(48) Complex Roots Of Multiple Non-Linear Equations (Newton-Raphson Method)
04-18-2023, 02:48 AM (This post was last modified: 04-18-2023 02:53 AM by acser.)
Post: #3
RE: (48) Complex Roots Of Multiple Non-Linear Equations (Newton-Raphson Method)
First of all, this program, because of "ROW->" only works on HP48GX, but NOT on HP48SX (the HP48SX does not have the "ROW->" command). At least that was my experience with Emu48.
The zip file contents (incl. the .HP binary file) at https://www.hpcalc.org/details/8802 are incorrect. I created a working version of the below files as the cplxroots.HP attachment to this post.

The inputs are the following:
Equations:
{ 'X(1)^2-2*X(1)*X(2)+X(2)^2-LN(X(3))-16' 'X(1)^2-X(2)^2+20*SIN(X(3))-9' 'X(1)^3+X(2)^2+X(3)^2+27' }

Initial guesses for X(1), X(2), and X(3):
[ (1,-7) (2,10) (-4,-11) ]

You have to provide the above arguments to the program below:

« \-> MQ X0
« .000001 'TL' STO MQ SIZE 'N' STO X0 'X' STO
IF X0 TYPE 4 ==
THEN (.01,.01) 'D' STO
ELSE .01 'D' STO
END 0 'ITER' STO
DO 0 'YM' STO 1 N
FOR I MQ I GET \->NUM
NEXT N \->ARRY 'Y' STO 1 N
FOR I Y I GET ABS 'YI' STO
IF YI YM >
THEN YI 'YM' STO
END
NEXT
IF YM TL \>=
THEN 1 N
FOR I 1 N
FOR J X J GET D + X J 3 ROLL PUT 'X' STO MQ I GET \->NUM Y I GET - D / X J GET D - X J 3 ROLL PUT 'X' STO
NEXT N \->ARRY
NEXT N ROW\-> 'JAC' STO Y JAC / 'DX' STO X DX - 'X' STO
END ITER 1 + 'ITER' STO
UNTIL YM TL <
END MQ X "X" \->TAG ITER "ITER" \->TAG YM "YM" \->TAG
»
»

(Notes:
Replace in the above the \-> sequence with the green right shift + 0 character.
Replace in the above \>= sequence with the HP character map's >= character.)
The « and » characters should translate fine to the characters inserted by pressing green right shift + - (minus sign). )


Attached File(s)
.hp  cplxroots.HP (Size: 1.12 KB / Downloads: 7)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (48) Complex Roots Of Multiple Non-Linear Equations (Newton-Raphson Method) - acser - 04-18-2023 02:48 AM



User(s) browsing this thread: 1 Guest(s)