Fastest way to implement Secant method on calculator

algorithmscalculatornumerical methodsprogrammingroots

I am looking for the fastest way to implement the secant method (the one which is used for finding roots to a given single-variable equation) on a fx-991es calculator (scientific, non programmable calculator). What I have done till now:

  1. Assign initial values to A,B,C,D
    (Later the variables will serve as A = $x_{n-1}$, B = $x_n$, C = $x_{n+1}$, $D = f(x_{n-1})$, $E = f(x_n)$)
  2. Perform the operation $\frac{AE-BD}{E-D} \rightarrow C$, followed by the operations $B \rightarrow A, E \rightarrow D, C \rightarrow B$. Then, perform $f(C)\rightarrow E$. For example: ($cos(c)-c e^c \rightarrow E$)
  3. Repeat step 2 till the desired accuracy is reached.
    I found this pretty useful in implementing Regular-Falsi(False position) method/ bisection method, as only one set of variables is replaced there (A,D or B,E).
    However, navigating history after each operation 2 takes some time (to find the operation, then implement $\frac{AE-BD}{E-D} \rightarrow C$). Also, there are multiple replacement operations. Please post a shorter solution, if possible. A general comment on implementing numerical solutions using calculator (for other methods) would be helpful too.
    About the calculator: It has 9 variables for storage option (including M), operations supported in Vectors, Matrices too. Maybe a 2-d vector solution to this problem can be found.
    Note: I am aware that on the computer(Matlab)/programmable calculator, the process can be automated. However, I require a solution which is doable using a non-programmable calculator as these options are not available in the exam. So, please don't post such comments.

Best Answer

Not only does the form

$$x_{n+1}=x_n-\frac{f(x_n)}{f(x_n)-f(x_{n-1})}(x_n-x_{n-1})$$

provide more numerical stability, it can also be implemented with fewer variables (and hence less updates per iterations) since it can be rewritten as

\begin{cases}x_{n+1}=x_n+\Delta x_n\\\Delta x_n=\dfrac{f_n}{f_{n-1}-f_n}\Delta x_{n-1}\\f_n=f(x_n)\end{cases}

which requires only one value of $x$, one value of $\Delta x$, and two values of $f$ per iteration:

  1. Initialize $(A,B,C,D)=(x_1,\Delta x_0,f_1,f_0)=(x_1,x_1-x_0,f(x_1),f(x_0))$.

  2. Update $B:=\dfrac{BC}{D-C}$, then $A:=A+B$, then $D:=C$, then $C:=f(A)$.

  3. Repeat 2. until desired accuracy.

Related Question