Page 138 - IJOCTA-15-3
P. 138

Srinivasarao Thota et al. / IJOCTA, Vol.15, No.3, pp.503-516 (2025)
            Table 2. Number of iterations

             Eq       Root       NR HM MHM NM1 NM2 EM Sania9 MBIT9                                 PM
             Eq    1.404491648   11     7       5       5      4      5       3        3      3 (Example 1)
                1
             Eq 2  6.308777130   12     8       6       5      6      5       3        3      3 (Example 2)
             Eq 3  1.465091220   10     7       5       4      4      4       3        3      3 (Example 3)
             Eq 4  2.125391199   10     8       6       4      4      4       3        3            3
              Notes: NM1 and NM2 represent the numerical methods proposed in refs. [38] and [1,2], respectively. EM
             indicates the enhanced method from reference [44]. RFM refers to the ninth-order root-finding method from
                ref. [37], which introduced a new three-step numerical scheme for solving nonlinear scalar and vector
               equations. MBIT denotes the ninth-order memory-based iterative technique from ref. [37], in which the
                authors proposed a novel three-step, memory-based method for solving nonlinear equations. Sania is a
             Ninth-order method by Sania. Abbreviations: Eq, equation; HM, Halley’s method; MHM, modified Halley’s
                                method; NR, Newton Raphson method; PM, proposed method.


            > Prop_Alg(1, sin(x)^2-x^2+1 = 0,3);                       t = x - (2 * f(x) * df(x)) / (2 *
            Iteration 1    =   1.403066996.                            (df(x))**2 - f(x) * ddf(x))
            f(x) = .35327132e-2,                                       s = t * math.exp(-f(t) / (t * df(t)))
            AbsError = .2872756591                                     if t * df(t) != 0 else t
            Iteration 2    =   1.404491649.                            x_new = t - (f(t) + f(s)) / df(t)
            f(x) = -.2e-8,                                             print(f"Iteration {iteration}:
            AbsError = .1014354910e-2                                  x = {x_new:.15f}, f(x) =
            Iteration 3    =   1.404491649.                            {f(x_new):.15e}")
            f(x) = -.2e-8,                                             if abs(x_new - x) < tol:
            AbsError = 0.                                                   print("\nConverged to root:",
            1.404491649                                                     x_new)
                Example 6. Consider with x0 = 0.8.                          print("Total iterations:",
                                                                            iteration)
            > Prop_Alg(0.8, 10*x*exp(-x^2)-1 = 0, 4);
                                                                            return x_new
            Iteration 1    =   1.531609079.
                                                                       x = x_new
            f(x) = .466791835,
                                                                   print("\nMaximum iterations reached.
            AbsError = .4776735063
                                                                   Root may not be accurate.")
            Iteration 2    =   1.679628729.
                                                                   return x
            f(x) = .5200e-5,
            AbsError = .8812640999e-1
                                                              # Example: Solve sin^2(x) - x^2 + 1 = 0
            Iteration 3    =   1.679630611.
                                                              initial_guess = 1.0     # Start near an
            f(x) = -.12e-8,
                                                              expected root
            AbsError = .1120484461e-5
                                                              root = ninth_order_method(initial_guess)
            Iteration 4    =   1.679630611.
            f(x) = -.12e-8,     AbsError = 0.
            1.679630611
                                                                  Output of the implementation:
            4.2. Python implementation
            Consider the transcendental Equation (13) from
            Example 1 for sample computations using the       Iteration 1: x = 1.403066995981864,
            Python implementation, as follows.                f(x) = 3.532713035351298e-03
            import numpy as np                                Iteration 2: x = 1.404491648215341,
            import math                                       f(x) = -4.440892098500626e-16
            def f(x):                                         Iteration 3: x = 1.404491648215341,
                 return np.sin(x)**2-x**2+1                   f(x) = -4.440892098500626e-16
            def df(x):
                 return 2*np.sin(x)*np.cos(x)-2*x             Converged to root:
            def ddf(x):                                       1.4044916482153413
                 return 2*(np.cos(x)**2- np.sin(x)**2)-2 Total iterations: 3
            def ninth_order_method(x0, tol=1e-10,
            max_iter=20): x = x0                              === Code Execution Successful ===
                 for iteration in range(1, max_iter + 1):
                                                           510
   133   134   135   136   137   138   139   140   141   142   143