472Homework2 - Math 472 Section 002 Professor Joseph Conlon...

This preview shows page 1 - 4 out of 7 pages.

Math 472Section 002Professor Joseph ConlonHomework 29/30/2016Problem 1sinx-0.5=0 in the interval a<x<b%Function: bisection, 9/30/2016, Math 472%Bisection Method
function c=bisection(a, b, N);d=a; e=b; c=0;for j=1:Nc=(d+e)/2;if (sin(d)-.5)*(sin(c)-.5) <0e=c;else d=c;endendcommand window>> format long>> bisection(0, 1, 20)ans =0.523598670959473>> 6*0.523598670959473ans =3.141592025756838>> pians =3.141592653589793We get pi to seven significant digits from 6*xN. For sin(x)-.5=0 the solution is (pi/6),=, which is 0.523598775598299, but by the bisection method we estimate this as 0.523598670959473. This is why 6*xNis approximately pi.Problem 2g(x)=(3x/5)+(2/x), 0<x<with initial value given by x=x0A.) %Function: fixedp, 9/30/2016, Math 472%Fixed Point Methodfunction x=fixedp(x0, N)
x=x0;for j=1:N;x = ((3*x)/5)+(2/x);endcommand window>> format long>> fixedp(1, 15)ans =2.236067977584068>> sqrt(5)ans =2.236067977499790We can determine that after 15 iterations for x15 = sqrt(5) we have 10 significant digits of accuracy.B.)>> 5^15ans =3.051757812500000e+10g’(x) = So is the the rate of convergence, so we can determine we are correct to 5^15 decimal places after 15 iterations.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture