[Solved] Numerical Analysis -Programming Assigment #1 Root Finding

$25

File Name: Numerical_Analysis_-Programming_Assigment_#1__Root_Finding.zip
File Size: 546.36 KB

SKU: [Solved] Numerical Analysis -Programming Assigment #1 – Root Finding Category: Tag:
5/5 - (1 vote)
  1. Implement a bisection root finding method. Your function should have the signaturebisec(f,a,b,tol) and return a 1 2 list named res where f Function handle to f(x)

a, b Endpoints of initial interval [a,b] tol Tolerance res[0,0] Final approximation of the root. res[0,1] Number of iterations until convergence

  • The root should have relative precision of at least tol (unless the root close to zero, in which the absolute accuracy should be tol).
  • Provide a listing of the code and a source file named py
  1. Implement Newtons root finding method. Your function should have the signaturenewton(f,fp,x0) and return a 1 2 list named res where f Function handle to f(x) fp Function handle to the derivative of f.

x0 Initial guess res[0,0] Final approximation of the root. res[0,1] Number of iterations until convergence

  • The accuracy should be as high as possible in double precision.
  • Comment how youve determined that the root is sufficiently accurate.
  • Provide a listing of the code and a source file named py
  • Make sure that you do not enter infinite loops!
  1. Here we wish to check your implementations of Bisection and Newton methods on the functions
f(x) Newtons x0 Bisections [a,b]
tanx 2x 1.4 [1,1.4]
x3 [1]x2 + 12x 8 3.0 [1,3]

Use tol= 1012 for the bisection method.

  • For each function, generate a table that shows at each iteration
    • the estimate of the root,
    • the value of the function at the estimated root, the relative precision of the root.
    • Save the table in the file named csv make sure that when you save it you keep the format *.csv
  • Approximate the rate of convergence of each method empirically by plotting the value in the y-axis vs. n in the x-axis (see H.W assignment 2 question 1).
  • Make sure that Newtons method results in the rate p = 2. If this is not the case, decide what is the multiplicity of the root empirically (see H.W 2 Question 2).
  1. Find the first 10 zeros of Bessels function J0(x) for x 0.
    • You may use Pythons function jv found in the scipy.special library to evaluate bessel functions as needed (see https://docs.scipy.org/doc/scipy/reference/special.html)
    • The function should generate a table of the zeros accurate to 1012.
    • plot J0(x) with its zeros marked with symbols.
  2. Implement Newtons Fractal for the complex function f(z) = z3 1.
    • Create an initial grid of [1,1] [i,i] with 800 800 points.
    • Use Newtons method to find the root of f(z) for each of the starting points.
    • Store the number of iterations needed to approximate a given root up to 1010 in a 800 800 array. If you diverge use the maximal number of iterations. Normalize the array to values between 0 and 1. NOTICE: f(z) has 3 complex roots so you should have 3 such arrays.
    • Concatenate the three arrays into a single array IM of size 800 800 3.
    • Use the command imshow(IM) (found in the library matplotlib.pyplot) to show the resulting image.

Figure 1: Finding w.

[1] . Calculate the length of w in Figure 1. Upload your script file with the name Q6.py. Remark: The lengths 12m and 10m refer to the whole sides of the right angle triangles.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] Numerical Analysis -Programming Assigment #1 Root Finding
$25