Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
AMTH250                                                 Assignment 5
                          Due: 10th September



Question 1 [2 marks]
   Find all the zeros of the function

                            f (x) = sin(10x) − x

Question 2 [2 marks]
   Let 0 < x1 < x2 < x3 < . . . denote the positive solutions of

                                x = tan(x)

Find x1000000 . Explain the method you used.
Question 3 [4 marks]
  For the equation
                         f (x) = x2 − 3x + 2 = 0,
each of the following functions yields an equivalent fixed point problem:

                        g1 (x) = (x2 + 2)/3
                                 √
                        g2 (x) = 3x − 2
                        g3 (x) = 3 − 2/x
                        g4 (x) = (x2 − 2)/(2x − 3).

   (a) Analyze the convergence properties of each of the corresponding fixed
point iteration schemes for the root x = 2 by considering |gi (2)|.
    (b) Confirm your analysis by implementing each of the schemes and veri-
fying its convergence (or lack thereof) and approximate rate of convergence.




                                        1
Question 4 [3 marks]
   On a computer with no functional unit for floating point division, one
might instead use multiplication by the reciprocal of the divisor.
   (a) Apply Newton’s method to produce an iterative scheme for approx-
imating the reciprocal of a number y > 0 (i.e., to solve the equation
                                                1
                                  f (x) = x −     = 0,
                                                y

given y). Considering the intended application your formula should not
contain any divisions!
   (b) Apply your method with y = 2, i.e. to compute 1/2.

  (i) Can you find an initial guess for which your method diverges?

 (ii) Can you find an initial guess for which your method converges to a
      point other than 1/2?

(iii) For what range of initial guesses does your method converge to 1/2?

Question 5 [3 marks]
   (a) Let
                                   1                 1
                 f (x) =                    +
                           (x − 0.3)2 + 0.01 (x − 0.9)2 + 0.04
Find the (global) maximum of f (x) using

  (i) Golden section search.

 (ii) Successive parabolic interpolation.

(iii) fminbnd.

   (b) Estimate the accuracy of the maximum x∗ for your best estimate
from part (a). Explain your reasoning.
Question 6 [2 marks]
    A water hose with initial water velocity v is aimed at an angle α with
respect to the ground to hit a target of height h at distance x. The angle α
and distance x are related by
                              g
                                       x2 − tan(α)x + h = 0
                       2v 2 cos2 (α)

where g = 9.80665 m/sec2 is the acceleration due to gravity.
   If v = 20 m/sec and h = 13 m find the maximum distance x at which
the target can be reached.


                                           2
Notes on the Assignment


Question 1
First plot the function!

Question 3
It is helpful to write a function to perform the iterations:

function x = iterate (g, x0, n)
  x = zeros(1,n+1);
  x(1) = x0;
  for i = 1:n
    x(i+1) = g(x(i));
  end
endfunction

    Convergence can then be analysed by examining the error and the ratio
of the errors of successive terms using something like:

octave:> x2 = iterate(g2, 1.1, 100)
octave:> err2 = abs(x2-2)
octave:> ratio2 = err2(2:101)./err2(1:100)

Questions 4
You may need to try a couple of ways of rewriting the equation until you
find one in which Newton’s method does not use division.

Questions 5
Remember that finding the maximum of f (x) is the same as finding the
minimum of −f (x).

Question 6
The problem is to find the maximum of x as a function of α. Note that x is
given implicitly as the root (we want the larger one) of a quadratic whose
coefficients depend on α. To construct the function x(α) in Octave you may
find it easier to use roots rather than the quadratic formula to solve the
quadratic for x.




                                      3

More Related Content

Assignment5

  • 1. AMTH250 Assignment 5 Due: 10th September Question 1 [2 marks] Find all the zeros of the function f (x) = sin(10x) − x Question 2 [2 marks] Let 0 < x1 < x2 < x3 < . . . denote the positive solutions of x = tan(x) Find x1000000 . Explain the method you used. Question 3 [4 marks] For the equation f (x) = x2 − 3x + 2 = 0, each of the following functions yields an equivalent fixed point problem: g1 (x) = (x2 + 2)/3 √ g2 (x) = 3x − 2 g3 (x) = 3 − 2/x g4 (x) = (x2 − 2)/(2x − 3). (a) Analyze the convergence properties of each of the corresponding fixed point iteration schemes for the root x = 2 by considering |gi (2)|. (b) Confirm your analysis by implementing each of the schemes and veri- fying its convergence (or lack thereof) and approximate rate of convergence. 1
  • 2. Question 4 [3 marks] On a computer with no functional unit for floating point division, one might instead use multiplication by the reciprocal of the divisor. (a) Apply Newton’s method to produce an iterative scheme for approx- imating the reciprocal of a number y > 0 (i.e., to solve the equation 1 f (x) = x − = 0, y given y). Considering the intended application your formula should not contain any divisions! (b) Apply your method with y = 2, i.e. to compute 1/2. (i) Can you find an initial guess for which your method diverges? (ii) Can you find an initial guess for which your method converges to a point other than 1/2? (iii) For what range of initial guesses does your method converge to 1/2? Question 5 [3 marks] (a) Let 1 1 f (x) = + (x − 0.3)2 + 0.01 (x − 0.9)2 + 0.04 Find the (global) maximum of f (x) using (i) Golden section search. (ii) Successive parabolic interpolation. (iii) fminbnd. (b) Estimate the accuracy of the maximum x∗ for your best estimate from part (a). Explain your reasoning. Question 6 [2 marks] A water hose with initial water velocity v is aimed at an angle α with respect to the ground to hit a target of height h at distance x. The angle α and distance x are related by g x2 − tan(α)x + h = 0 2v 2 cos2 (α) where g = 9.80665 m/sec2 is the acceleration due to gravity. If v = 20 m/sec and h = 13 m find the maximum distance x at which the target can be reached. 2
  • 3. Notes on the Assignment Question 1 First plot the function! Question 3 It is helpful to write a function to perform the iterations: function x = iterate (g, x0, n) x = zeros(1,n+1); x(1) = x0; for i = 1:n x(i+1) = g(x(i)); end endfunction Convergence can then be analysed by examining the error and the ratio of the errors of successive terms using something like: octave:> x2 = iterate(g2, 1.1, 100) octave:> err2 = abs(x2-2) octave:> ratio2 = err2(2:101)./err2(1:100) Questions 4 You may need to try a couple of ways of rewriting the equation until you find one in which Newton’s method does not use division. Questions 5 Remember that finding the maximum of f (x) is the same as finding the minimum of −f (x). Question 6 The problem is to find the maximum of x as a function of α. Note that x is given implicitly as the root (we want the larger one) of a quadratic whose coefficients depend on α. To construct the function x(α) in Octave you may find it easier to use roots rather than the quadratic formula to solve the quadratic for x. 3