HP Forums
(35S) Complex Roots Of Any Equation Using Newton's Method - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (35S) Complex Roots Of Any Equation Using Newton's Method (/thread-10309.html)



(35S) Complex Roots Of Any Equation Using Newton's Method - gerry_in_polo - 03-12-2018 03:06 AM

HP 35s program to compute the complex roots of any equation (as long as the functions used support complex numbers on the 35s) using Newton's Method utilizing the forward difference method to approximate the derivative. The 35s' built-in equation solver can compute Y given a complex value of X, but it cannot solve for complex values of X when Y is set to zero.

Program N - Newton's Method program proper
Program Y - Equation in terms of X whose roots are to be solved.

Upon typing XEQ N, enter an initial estimate of the root. Press R/S to update the root estimate until the value no longer changes indicating convergence. To find other root values, change the initial root estimate inputted.

HP-35s Program - Complex Root Newton's Method (Gerardo V. Lozada, M.S., P.E.E., 2018-03-10)

Newton Routine
N001 LBL N
N002 INPUT X
N003 0.01i0.01
N004 STO D
N005 XEQ Y001
N006 STO A
N007 RCL X
N008 RCL D
N009 +
N010 STO X
N011 XEQ Y001
N012 RCL A
N013 -
N014 RCL D
N015 ÷
N016 RCL A
N017 x<>y
N018 ÷
N019 RCL X
N020 RCL D
N021 -
N022 x<>y
N023 -
N024 STO X
N025 VIEW X
N026 GTO N005

Sample Equation Whose Roots Are To Be Solved For (Y = e^X + X^2)
Y001 LBL Y
Y002 RCL X
Y003 e^x
Y004 RCL X
Y005 2
Y006 y^x
Y007 +
Y008 RTN


RE: (35S) Complex Roots Of Any Equation Using Newton's Method - Liamtoh Resu - 10-23-2021 02:57 AM

I was wondering what line N003 means -- is it something that I have not
rtm'd or is it a typo.

Thanks.


RE: (35S) Complex Roots Of Any Equation Using Newton's Method - PedroLeiva - 10-23-2021 11:50 AM

Hello. Can you please provide a numeric example of this equation.
I also have doubts about step N003 symbols. Thank you in advance. Pedro


RE: (35S) Complex Roots Of Any Equation Using Newton's Method - rprosperi - 10-23-2021 12:51 PM

I believe its simply a complex number with the value of 0.01 for both the real and imaginary parts (note the "i"), but looks odd due to the variable pitch font used in the code listing.


RE: (35S) Complex Roots Of Any Equation Using Newton's Method - Steve Simpkin - 10-23-2021 06:44 PM

Agree with the above about line N003. Here is what it would look like on the actual HP 35s.