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
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