# Numerical Methods in Scientific Computing
# Assignment 6
## E Naveen
## (ME16B077)

# Q1.

The Fredholm Integral equation is given by,
\begin{equation}
    f(x) = \phi (x) + \int_a^b K_s(x,t) \phi (t)dt
\end{equation}

One method for solving the above equation numerically is to write the integral on the RHS using any of the Quadrature methods discussed. 
Choosing Gaussian-Legendre Quadrature for this method we have,
\begin{equation}
    \int_a^b K(x,t) \phi (t)dt = \frac{b-a}{2}\int_{-1}^1 K_s(x,s) \phi_s(s)ds = \frac{b-a}{2}\sum_{i=0}^{n} w_i K_s(x,s_i) \phi_s(s_i)
\end{equation}
where
$$ s = \frac{2t - (a+b)}{b-a} $$
and $K(x,t)$ and $\phi(t)$ are changed to $K_s(x,s)$ and $\phi_s(s)$ after change of variable t into s.

So, for $x=x_0,x_1,...,x_n$ and $s=s_0,s_1,...,s_n$ (s are gauss-legendre nodes) we have
\begin{equation}
    f(x_i) = \phi_s(s_i) + \frac{b-a}{2}\sum_{j=0}^{n} w_j K_s(x_i,s_j) \phi_s(s_j)
\end{equation}
with $$ x_i = \frac{s_i(b-a)+(a+b)}{2} $$
Thus we have n+1 equations with n+1 unknowns. We can solve this as Linear system of equations.

$$ A= \frac{b-a}{2}\left(\begin{matrix}w_0K_s(x_0,s_0)&w_1K_s(x_0,s_1)&w_2K_s(x_0,s_2).&.&.&w_{n-1}K_s(x_{0},s_{n-1})&w_nK_s(x_0,s_n)\\w_0K_s(x_1,s_0)&w_1K_s(x_1,s_1)&w_2K_s(x_1,s_2).&.&.&w_{n-1}K_s(x_{1},s_{n-1})&w_nK_s(x_1,s_n)
\\.&.&w_2K_s(x_2,s_2).&.&.&.&.
\\.&.&.&.&.&.&.
\\.&.&.&.&.&w_{n-1}K_s(x_{n-1},s_{n-1})&w_nK_s(x_{n-1},s_n)\\w_0K_s(x_n,s_0)&.&.&.&.&w_{n-1}K_s(x_{n},s_{n-1})&w_nK_s(x_n,s_n)\end{matrix}\right) + \left(\begin{matrix}1&.&.&.&.&.&.&.\\.&1&.&.&.&.&.&.\\.&.&.&.&.&.&.&.\\.&.&.&.&.&.&.&.\\.&.&.&.&.&.&1&.\\.&.&.&.&.&.&.&1\end{matrix}\right) $$

$$ \phi = \left(\begin{matrix}\phi_s(s_0)\\\phi_s(s_1)\\.\\.\\\phi_s(s_{n-1})\\\phi_s(s_n)\end{matrix}\right) $$

$$ f = \left(\begin{matrix}f(x_0)\\f(x_1)\\.\\.\\f(x_{n-1})\\f(x_n)\end{matrix}\right) $$

$$ \left(\frac{b-a}{2}\left(\begin{matrix}w_0K_s(x_0,s_0)&w_1K_s(x_0,s_1)&w_2K_s(x_0,s_2).&.&.&w_{n-1}K_s(x_{0},s_{n-1})&w_nK_s(x_0,s_n)\\w_0K_s(x_1,s_0)&w_1K_s(x_1,s_1)&w_2K_s(x_1,s_2).&.&.&w_{n-1}K_s(x_{1},s_{n-1})&w_nK_s(x_1,s_n)
\\.&.&w_2K_s(x_2,s_2).&.&.&.&.
\\.&.&.&.&.&.&.
\\.&.&.&.&.&w_{n-1}K_s(x_{n-1},s_{n-1})&w_nK_s(x_{n-1},s_n)\\w_0K_s(x_n,s_0)&.&.&.&.&w_{n-1}K_s(x_{n},s_{n-1})&w_nK_s(x_n,s_n)\end{matrix}\right) + I\right) \left(\begin{matrix}\phi_s(s_0)\\\phi_s(s_1)\\.\\.\\\phi_s(s_{n-1})\\\phi_s(s_n)\end{matrix}\right) = \left(\begin{matrix}f(x_0)\\f(x_1)\\.\\.\\f(x_{n-1})\\f(x_n)\end{matrix}\right) $$

$$ A\phi = f \Rightarrow \phi = A^{-1}f$$

For the following equation,

\begin{equation}
    \phi(x) = \pi x^2 + \int_0^{\pi} 3(0.5sin(3x)-tx^2)\phi(t)dt \Rightarrow \phi(x) + \int_0^{\pi} 3(tx^2-0.5sin(3x))\phi(t)dt= \pi x^2
\end{equation}

Hence we have,
\begin{equation}
    K(x,t) = 3(tx^2-0.5sin(3x)) ;\quad s = \frac{2t - (a+b)}{b-a}=\frac{2t-\pi}{\pi} ;\quad t = \frac{s(b-a)+(a+b)}{2} = \frac{\pi(1+s)}{2} = x
\end{equation}

With $a=0$ and $b=\pi$
\begin{equation}
    \Rightarrow K_s(x,s) = 3(\frac{\pi(1+s)}{2}x^2-0.5sin(3x)) \quad; \quad f(x) = \pi x^2
\end{equation}

The exact solution is obtained by substituting $\phi(t)=sin(kt)$ and evaluating $\phi(x) = \pi x^2 + \int_0^{\pi} 3(0.5sin(3x)-tx^2)\phi(t)dt$ which is given by,

\begin{equation}
    \phi(x) = (-3x^2(sin(\pi k) - \pi kcos(\pi k)) - 1.5 k (cos(\pi k) - 1) sin(3 x))/k^2 + \pi x^2 =sin(kx)
\end{equation}

The above equation can be solved by equating,

\begin{equation}
    \frac{3x^2\pi cos(\pi k)}{k} = -\pi x^2 \Rightarrow k=3
\end{equation}

Hence exact solution is,
\begin{equation}
    \phi(x) = sin(3x)
\end{equation}


```python
import numpy as np
import matplotlib.pyplot as plt
import time
```


```python
# Function to return K(x,s) as defined above.
def ret_K_x_s(x,s):
    K = 3*(((np.pi*(1+s)/2)*x**2) - 0.5*np.sin(3*x))
    return K

# Function to calculate the required function phi.
def calc_phi(n):
    h = 2/n
    S, W = np.polynomial.legendre.leggauss(n+1)
    X = (S+1)*np.pi/2
    A = np.identity(n+1)
    for i in range(n+1):
        for j in range(n+1):
            A[i, j] = A[i, j] + W[j]*ret_K_x_s(X[i],S[j])*np.pi/2
    F = np.zeros((n+1,1))
    for i in range(n+1):
        F[i] = np.pi*X[i]**2
    phi = np.dot(np.linalg.inv(A), F)
    return X, phi
```


```python
# Call the function for n=100
X, phi = calc_phi(100)

# Plot the numerical and exact solution to phi.
plt.rcParams["figure.figsize"] = [8,6]
plt.plot(X,phi,color='b', label='numerical solution')
plt.plot(X,np.sin(3*X), marker='x',color='r', label='Exact solution', linestyle=' ')
plt.legend()
plt.grid()
plt.xlabel('x')
plt.ylabel('phi')
plt.title('Numerical vs Exact Solution for Fredholm integral equation')
plt.show()
```


```python
# Plot the error as a function of number of nodes.
N = np.linspace(5,400,20)
Error = []
for n in N:
    X, phi = calc_phi(int(n))
    phi = [float(x) for x in phi]
    phi_exact = np.sin(3*X)
    phi_exact = [float(x) for x in phi_exact]
    Error.append(np.mean(np.abs(np.subtract(phi,phi_exact))))
    
plt.rcParams["figure.figsize"] = [8,6]
plt.loglog(N,Error,color='b', label='Max Absolute Error')
plt.legend()
plt.grid()
plt.xlabel('N')
plt.ylabel('error')
plt.title('Infinity Norm Error')
plt.show()
```

- The numerical method is very accurate when comparing with the exact solution even for small values of n.
- Initially the rate of convergence to the actual solution as seen using infinity norm error is very steep for n from 5 to 15 beyond which the solution is accurate to machine precision.

# Q2.


```python
# Return function value when in terms of x
def f_x(x):
    f = np.exp(-x)/x**0.5
    return f

# Return function value when in terms of t
def f_t(t):
    f = 2*np.exp(-t**2)
    return f

# Rectangular rule in terms of x.
def rect_rule_x(n):
    h = 1/n
    X = np.linspace(0,1,n+1)
    Y = [(X[i]+X[i+1])/2 for i in range(n)]
    F_x = [f_x(Y[i]) for i in range(n)]
    I_x = h*sum(F_x)
    return I_x

# Rectangular rule in terms of t.
def rect_rule_t(n):
    h = 1/n
    X = np.linspace(0,1,n+1)
    Y = [(X[i]+X[i+1])/2 for i in range(n)]
    F_t = [f_t(Y[i]) for i in range(n)]
    I_t = h*sum(F_t)
    return I_t
```


```python
# Defined values for n.
N = [5,10,20,50,100,200,500,1000,2000,5000,10000]

# Store the integral value obtained from wolfram alhpa.
accurate_I = 1.493648265624854050798934872263706010708999373625212658055
accurate_I = [accurate_I for _ in range(len(N))]

# Initialize parameters to store the results.
x_I = []
x_time = []
x_error = []
t_I = []
t_time = []
t_error = []
for n in N:
    
    start = time.time()
    I = rect_rule_x(n)
    end = time.time()
    x_I.append(I)
    x_time.append(end-start)
    
    start = time.time()
    I = rect_rule_t(n)
    end = time.time()
    t_I.append(I)
    t_time.append(end-start)
    
    x_error.append(abs(rect_rule_x(n)-accurate_I[0]))
    t_error.append(abs(rect_rule_t(n)-accurate_I[0]))
    
print("The average time to run function to find both types of Integrals are:")
print("Using x =", abs(np.mean(x_time)))
print("Using t =", abs(np.mean(t_time)))

# Plot the absolute error in log-log plot as a function of n.
plt.rcParams["figure.figsize"] = [5,4]
plt.loglog(N, x_error, color='r', label='using x')
plt.loglog(N, t_error, color='b', label='using t')
plt.legend()
plt.grid()
plt.xlabel('n')
plt.ylabel('Error')
plt.title('Absolute Error vs n in log-log plot')
plt.show()
```

- The Integral obtained using Rectangular rule after making a change of variable to 't' is way more accurate than with 'x'.
- The Slope in log-log plot of error vs number of intervals using 'x' is 0.5 whereas that for 't' is 2, signifying multiple orders accurate than with just using 'x'.
- On average the cost of computation is more for integrating $\frac{e^{-x}}{\sqrt{x}}$ than $e^{-t^2}$ owing to the requirement of performing a square root and division operation which requires more effort and done using newton raphson method.

# Q3.

It is given that f(x) is d+1 times continuously differentiable function. The Householder's method is given by,
\begin{equation}
    x_{n+1} = x_n + d\frac{(1/f)^{d-1}(x_n)}{(1/f)^d(x_n)}
\end{equation}

If the sequence of iterates converge to a root a, we know $f(a) = 0$. Then near $x = a$ the function $(1/f)(x)$ has a singularity or is called a meromorphic function.

Writing the Taylor Series expansion for $(1/f)(x)$,

\begin{equation}
    (1/f)(x) = \sum_{d=0}^{\infty} \frac{(1/f)^{(d)}(b)}{d!} (x-b)^d
\end{equation}

Konig's theorem states that given a meromorphic function as defined above with infinite terms, the limit beow as $d\rightarrow \infty$ is
\begin{equation}
    \lim_{d\rightarrow\infty} \frac{\frac{(1/f)^{(d-1)}(b)}{(d-1)!}}{\frac{(1/f)^{(d)}(b)}{d!}} = \lim_{d\rightarrow\infty} d\frac{(1/f)^{(d-1)}(b)}{(1/f)^{(d)}(b)} = a-b
\end{equation}

where a-b is the error. Hence for any d, by the power of the error term (b-a) in the Taylor series expansion containing the $d^{th}$ derivative, we have
\begin{equation}
    |x_{n+1}-a| \leq K|x_n-a|^{d+1}
\end{equation}


# Q4.

As the function is strictly convex, twice differentiable and with single simple root its first derivative must either be such that $f^{\prime}(x) \gt 0 \text{ } \forall x$ or $f^{\prime}(x) \lt 0 \text{ } \forall x$. Which also tells that the function value has opposite signs on all values of x on either side of the root (x=a).

Case 1: $f^{\prime}(x) \gt 0$,
- When the initial guess is to the left of root (x<a), 
    - f(x) < f(a) making f(x) negative as f(a) = 0 
    - This leads to the term $-\frac{f(x_n)}{f^{\prime}(x_n)}$ being positive and hence $x_{n+1} \gt x_n$ making the next iteration move towards to the root.
- Similarly, when the initial guess is to the right of root (x>a), 
    - f(x) is positive and this leads to the term $-\frac{f(x_n)}{f^{\prime}(x_n)}$ being negative and hence $x_{n+1} \lt x_n$ making the next iteration move towards to the root as well.

Case 2: $f^{\prime}(x) \lt 0$,
- When the initial guess is to the left of root (x<a), 
    - f(x) > f(a) making f(x) positive as f(a) = 0 
    - This leads to the term $-\frac{f(x_n)}{f^{\prime}(x_n)}$ being positive and hence $x_{n+1} \gt x_n$ making the next iteration move towards to the root.
- Similarly, when the initial guess is to the right of root (x>a), 
    - f(x) is negative and this leads to the term $-\frac{f(x_n)}{f^{\prime}(x_n)}$ being negative and hence $x_{n+1} \lt x_n$ making the next iteration move towards to the root as well.

When the initial guess is infact the root, regardless of the case, the subsequent iterations have no change in value of x as f(x)=0.

Hence the Newton method converges to the root irrespective of the initial guess.

# Q5.

To show $w(x) = xe^{x} - a$ has only one real root for $a\gt0$.

It can be said that when $a\gt0$ the root, say x*, should also be $\gt0$. The derivative of $w(x)$ is given by,

\begin{equation}
    w^{\prime}(x) = (x+1)e^x \gt 0 \quad \forall x \gt 0
\end{equation}

Since $w^{\prime}(x) \gt 0$ the function $w(x)$ is monotonically increasing for $x \gt 0$. Moreover we know,

\begin{equation}
    w(0) = -a \lt 0 \quad and \quad w(a) = a(e^a-1) \gt 0
\end{equation}

So the root lies in the real interval [0,a] and since the function is monotonically increasing it has only one real root. 



```python
def f_x(x, a):
    f = x*np.exp(x) - a
    return f
    
def f_prime_x(x):
    f_prime = (x+1)*np.exp(x)
    return f_prime

def Bisect(a, x1, x2, tol_x = 10**-3, tol_y = 10**-3):
    iterations = 0
    while True:
        iterations += 1
        if np.abs(x2-x1) < tol_x and np.abs(f_x(x1, a)-f_x(x2, a)) < tol_y: break
        x_new = (x1+x2)/2
        if f_x(x_new, a)*f_x(x2, a) <= 0:
            x1 = x_new
        elif f_x(x_new, a)*f_x(x1, a) <= 0:
            x2 = x_new
        else:
            break
    return [x1, x2], iterations

def Newton(a, x1, x2, tol_x = 10**-3, tol_y = 10**-3):
    x_old = (x1+x2)/2
    iterations = 0
    while True:
        iterations += 1
        x_new = x_old - (f_x(x_old, a)/f_prime_x(x_old))
        if np.abs(x_new-x_old) < tol_x and np.abs(f_x(x_new, a)-f_x(x_old, a)) < tol_y: break
        x_old = x_new
    if x_new >= x_old: range_x = [x_old, x_new]
    else: range_x = [x_new, x_old]
    return range_x, iterations

def Secant(a, x1, x2, tol_x = 10**-3, tol_y = 10**-3):
    x_n_1 = x1 + 0.75*(x2-x1)
    x_n_2 = x1 + 0.25*(x2-x1)
    iterations = 0
    while True:
        iterations += 1
        x_n = x_n_1 - f_x(x_n_1, a)*(x_n_1 - x_n_2)/(f_x(x_n_1, a) - f_x(x_n_2, a))
        if np.abs(x_n-x_n_1) < tol_x and np.abs(f_x(x_n, a)-f_x(x_n_1, a)) < tol_y: break
        x_n_2 = x_n_1
        x_n_1 = x_n
    if x_n >= x_n_1: range_x = [x_n_1, x_n]
    else: range_x = [x_n, x_n_1]
    return range_x, iterations
```


```python
A = np.logspace(-4, 1.5, 10)

for a in A:
    print('a =', a)
    range_x, iterations = Bisect(a, x1=0, x2=a, tol_x = 10**-5, tol_y = 10**-5)
    print('Bisect Method: \t Range =', [np.around(x, 10) for x in range_x], '\t Iterations =', iterations)
    range_x, iterations = Newton(a, x1=0, x2=a, tol_x = 10**-5, tol_y = 10**-5)
    print('Newton Method: \t Range =', [np.around(x, 10) for x in range_x], '\t Iterations =', iterations)
    range_x, iterations = Secant(a, x1=0, x2=a, tol_x = 10**-5, tol_y = 10**-5)
    print('Secant Method: \t Range =', [np.around(x, 10) for x in range_x], '\t Iterations =', iterations)
    print('-'*75)
```

    a = 0.0001
    Bisect Method: 	 Range = [9.375e-05, 0.0001] 	 Iterations = 5
    Newton Method: 	 Range = [9.999e-05, 9.99925e-05] 	 Iterations = 2
    Secant Method: 	 Range = [9.999e-05, 9.99919e-05] 	 Iterations = 2
    ---------------------------------------------------------------------------
    a = 0.00040842386526745213
    Bisect Method: 	 Range = [0.0004020422, 0.0004084239] 	 Iterations = 7
    Newton Method: 	 Range = [0.0004082572, 0.0004082988] 	 Iterations = 2
    Secant Method: 	 Range = [0.0004082572, 0.0004082884] 	 Iterations = 2
    ---------------------------------------------------------------------------
    a = 0.0016681005372000592
    Bisect Method: 	 Range = [0.0016615845, 0.0016681005] 	 Iterations = 9
    Newton Method: 	 Range = [0.0016653249, 0.0016660159] 	 Iterations = 2
    Secant Method: 	 Range = [0.0016653247, 0.001665842] 	 Iterations = 2
    ---------------------------------------------------------------------------
    a = 0.006812920690579615
    Bisect Method: 	 Range = [0.006766348, 0.0067730012] 	 Iterations = 11
    Newton Method: 	 Range = [0.0067669735, 0.0067669736] 	 Iterations = 3
    Secant Method: 	 Range = [0.0067669596, 0.0067753654] 	 Iterations = 2
    ---------------------------------------------------------------------------
    a = 0.02782559402207126
    Bisect Method: 	 Range = [0.0270783247, 0.027085118] 	 Iterations = 13
    Newton Method: 	 Range = [0.0270821304, 0.02708216] 	 Iterations = 3
    Secant Method: 	 Range = [0.0270813617, 0.0270821303] 	 Iterations = 3
    ---------------------------------------------------------------------------
    a = 0.11364636663857254
    Bisect Method: 	 Range = [0.1025619615, 0.1025688979] 	 Iterations = 15
    Newton Method: 	 Range = [0.1025677755, 0.1025719053] 	 Iterations = 3
    Secant Method: 	 Range = [0.1025677495, 0.1025677755] 	 Iterations = 4
    ---------------------------------------------------------------------------
    a = 0.4641588833612782
    Bisect Method: 	 Range = [0.3327678384, 0.3327713796] 	 Iterations = 18
    Newton Method: 	 Range = [0.3327713368, 0.3327713425] 	 Iterations = 4
    Secant Method: 	 Range = [0.3327713368, 0.3327714532] 	 Iterations = 4
    ---------------------------------------------------------------------------
    a = 1.8957356524063793
    Bisect Method: 	 Range = [0.828156774, 0.828158582] 	 Iterations = 21
    Newton Method: 	 Range = [0.8281581322, 0.8281581373] 	 Iterations = 4
    Secant Method: 	 Range = [0.8281565661, 0.8281581326] 	 Iterations = 6
    ---------------------------------------------------------------------------
    a = 7.742636826811277
    Bisect Method: 	 Range = [1.5857096343, 1.5857100958] 	 Iterations = 25
    Newton Method: 	 Range = [1.5857100296, 1.5857100297] 	 Iterations = 8
    Secant Method: 	 Range = [1.5857100296, 1.5857100318] 	 Iterations = 8
    ---------------------------------------------------------------------------
    a = 31.622776601683793
    Bisect Method: 	 Range = [2.5268887514, 2.5268888692] 	 Iterations = 29
    Newton Method: 	 Range = [2.526888812, 2.5268888121] 	 Iterations = 20
    Secant Method: 	 Range = [2.526888812, 2.5268888506] 	 Iterations = 17
    ---------------------------------------------------------------------------


#### Criteria for Convergence

- Bisection Method

    - When the guess for intial interval lies in range [0, a] (as derived earlier the root lies in [0,a]) the Bisection method always converges to a specified tolerance. In fact when the initial guess is any interval containing [0, a] the Bisection method converges.
    
    - This is because we know that only one real root is present and $w(x) \geq 0$ for all $x \geq root$ and $w(x) \leq 0$ for all $x \leq root$. Thus the function value at extreme points of the interval are of opposite sign. This ensures that we always eliminate the interval not containing the root when bisecting and thus always  keep the interval containing root while at the same time shrinking it to half at each iteration.


- Newton Method

    - When the initial guess is any point $ x_0 \gt -1$ the method always converges. This is due to the fact that at $x=-1$ the first derivative $f^{\prime}(x=-1)=0$ and $\forall x \lt -1 \quad f^{\prime}(x) < 0$. THis causes the iterations to diverge as both $f(x)$ and $f^{\prime}(x)$ are negative.


- Secant Method

    - Similar to the Newton method the condition is that the first 2 initial points ($x_0 \& x_1$) that we consider should both be $\gt -1$. Definitely both points should not be $ \leq -1$. 
    
    - Intuitively it is because this method tries to aprroximate the first derivative using 2 points on either side and if both of them are less than -1 the approximation resembles for a point less than -1. If say $x_0$ is towards the left of -1 the convergence might not be guaranteed as it depends on the values that functions take on subsequent iterations.

#### When $a<0$

Equating the first derivative of the function to 0,
\begin{equation}
    w^{\prime}(x) = (x+1)e^x = 0 \quad  \Rightarrow x = -1
\end{equation}

The second derivative at x = -1 is,
\begin{equation}
    w^{\prime\prime}(x=-1) = (x+2)e^x|_{x=-1} = e^{-1} \gt 0
\end{equation}


So the function $w(x)$ reaches the minimum value at $x=-1$ and as $a<0$, the plot of function will be tangent to the x-axis at 
$$a_0 = xe^x|_{x=-1} = -e^{-1}$$

Hence, given $a < 0$, for all values of $a > a_0$ there will be 2 roots and for all values of $a < a_0$ there will be no roots. For when $a=a_0$ there will be one root given by $x^* = -1$.

#### Criteria for Convergence

- Bisection Method

    - When $w(-1)=0 \Rightarrow$ one root exists at $x=-1$, 
        - the bisection method cannot be used due to the fact that the function value is non-negative for all values of x and cannot choose an interval with opposite signs.
    
    - When $w(-1) \lt 0 \Rightarrow$ two roots exist on either side of $x = -1$. 
        - The Bisection method would only converge if we choose the initial range such that one of the extremes is at $x = -1$.
    
    - When $w(-1) \gt 0 \Rightarrow$ no root exists and function value is always positive. 
        - So Bisection method cannot be used.


- Newton Method

    - When $w(-1)=0 \Rightarrow$ one root exists at $x=-1$, 
        - Newtons method would converge for any initial guess other than $x=-1$. When the point is to the left of $x=-1$, $f(x)>0 \& f^{\prime}(x)<0$ pushing further iterations towards the root. Similarly for when the point is to the right of $x=-1$ further iterations will come closer to the root.
    
    - When $w(-1) \lt 0 \Rightarrow$ two roots exist on either side of $x = -1$. 
        - The Newtons method converges to the roots when guess is other than $x=-1$. When the initial guess is $\lt-1$ it converges to the root to the left of $x=-1$ and when the guess is $\gt-1$ it converges to the other root.
    
    - When $w(-1) \gt 0 \Rightarrow$ no root exists.
        - Newtons method will not converge as no root exists.
    
    
- Secant Method

    - When $w(-1)=0 \Rightarrow$ one root exists at $x=-1$,
        - Similar to that of Newtons method. It will converge when initial guesses are towards the right or left of $x=-1. 
        
    - When $w(-1) \lt 0 \Rightarrow$ two roots exist on either side of $x = -1$.
        - It will converge to the root depending on whether the initial guesses are both either $\lt -1$ or $\gt -1$ to the root that is $\lt -1$ or $\gt -1$ respectively. When initial guesses are on either side of $x=-1$ we cannot say to which root it would converge as it depends on the function values aling the iterations.
    
    - When $w(-1) \gt 0 \Rightarrow$ no root exist.
        - Would not converge.

9fdccdf33768b4b5132a9dbf8a590d44e338872b
ipynb
Jupyter Notebook
me16b077_6.ipynb
ENaveen98/Numerical-methods-and-Scientific-computing
5b931621e307386c8c20430db9cb8dae243d38ba
MIT
2021-01-05T12:31:51.000Z
2021-01-05T12:31:51.000Z
me16b077_6.ipynb
ENaveen98/Numerical-methods-and-Scientific-computing
5b931621e307386c8c20430db9cb8dae243d38ba
MIT
me16b077_6.ipynb
ENaveen98/Numerical-methods-and-Scientific-computing
5b931621e307386c8c20430db9cb8dae243d38ba
MIT
Qwen/Qwen-72B
1. YES
2. YES