Hands-on-Solving Nonlinear Equations with MATLAB II

  1. We have given the following function;

    $\displaystyle f(x)=3x + sin(x) - e^x
$

    1. To obtain the true value for the root $ r$, which is needed to compute the actual error. MATLAB is used as:

      \includegraphics[scale=1]{figures/1-33}
    2. Comparing Muller's and Fixed-point Iteration methods. (Download http://siber.cankaya.edu.tr/ozdogan/NumericalComputations//mfiles/chapter1/muller.mmuller.m, http://siber.cankaya.edu.tr/ozdogan/NumericalComputations//mfiles/chapter1/fixedpoint.mfixedpoint.m)
      save with the name muller.m. Then;

      \includegraphics[scale=1]{figures/1-35}

      save with the name fixedpoint.m. Then;

      \includegraphics[scale=1]{figures/1-34}
    3. Plot the behaviours of the errors (may use ratios) for both cases. Compare and discuss the rate of convergence.
      Solution:

      \includegraphics[scale=0.9]{figures/1-32}

      save with the name main.m. Then;
      >> main
      
      For the rate of convergence: Muller's method converges much faster than fixed-point iteration.
  2. The following MATLAB command plots the function
    $ f_1(x)=x^2-3x+2$

    \includegraphics[scale=0.9]{figures/1-36}

    and the following finds the roots; (What are 1 -3 2?)
    >> roots([1 -3 2])
    ans =
         2
         1
    
    These are distinct real roots. Apply same procedure for the following functions

    $\displaystyle f_2(x)=x^2-10x+25
$

    $\displaystyle f_3(x)=x^2-17x+72.5
$

    comment the outputs. You should observe, repeated real roots, and complex roots.
  3. A pair of equations:
    $ x^2 + y^2 = 4$
    $ e^x + y = 1$
    1. Write a MATLAB program to solve this system by
      1. expanding both functions as a Taylor series expansion (begin with $ x_0 = 1, y_0 = - 1.7$). See lecture notes.
      2. and by Iteration (begin with $ x = 1$). See lecture notes.
    2. Tabulate the actual error values as the following; (See Table 3.8. Number of iterations is not limited to or defined as 15.)

      Table 3.8: The Error Sequences
      n Expansion $ f(x_n)$ Iteration $ f(x_n)$
      1    
      2    
      3    
      4    
      5    
      6    
      7    
      8    
      9    
      10    
      12    
      13    
      14    
      15    


Cem Ozdogan 2011-12-27