Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

One dimensional root finding has many applications, and a common situation is called continuation, where a sequence of ( related ) roots are to be

One dimensional root finding has many applications, and a common situation is called continuation,
where a sequence of (related) roots are to be solved for. An elementary example of a continuation
is the numerical construction of a contour (or level curve) of a 2D function. A contour plot is a 2D
representation of a function of two variables, f(x, y) that plots all curves of the form f(x, y)= c,
for various constants c. Figure 1(a) shows a colour plot of the HI(x, y) function, including the
zero contour (HI(x, y)=0 is the white dashed curve). While it may seem that finding solutions
to HI(x, y)=0 is a 2D problem, there is a way to apply the 1D methods presented in class.
Specifically, given a point (xn, yn) on the level curve we seek the next point
xn+1= xn + h cos(\theta n), yn+1= yn + h sin(\theta n),
at a fixed distance h >0 and some angle \theta satisfying
f(xn+1, yn+1)= f(xn + h cos(\theta n), yn + h sin(\theta n))=0.
This is a 1D root-finding problem in the variable \theta n! The parameter h is referred to as the step
size, and is a numerical constant. It will determine the accuracy of the computed contour. The
MATLAB script CA3 demo.m implements the above procedure using MATLABs fzero command.
For illustration purposes it use a large stepsize value h =0.6 and produces a 24-point contour that
is, unsurprisingly, a rather poor approximation to the true level curve (Figure 1, red curve).
An illustration for our procedure is in Figure 1(b) where the point P3 on the contour (thick blue
curve) has just been located at the angle \theta 2. Note that there is actually a second point on the
(green) circle around P2, but it is the previous point P1! Hence, special care needs to be taken
that our root-finding algorithm doesnt reverse itself. We can now repeat the procedure on the
(magenta) circle around P3 to iterate the search procedure to find P4.
But how can we find the first point? We can use the same angle solve procedure provided that we
begin from a point P0 that only needs to be within a distance h from our contour. Note in the
illustration, P0 is not on the contour, but the general procedure still works. For this assignment,
you can manually set P0 as an eyeballed point that sits near your contour.
1
(a)(b)
Figure 1: (a) The function HI(x, y) and the trace determined by MATLABs fzero command. (b)
The root-finding algorithm illustrated.
The goal of this assignment is to compare the secant method to the MATLABs fzero, in terms
of efficiency, and robustness (use tic, toc for the former) when computing the zero contour of 2D
functions. Begin by downloading CA3 demo.m, a code that does the root-finding using Matlabs
fzero command you will need to replace fzero calls inside the contour finding loop. Make sure
you download secant.m from Canvas to help you modify CA3 demo.m.
The secant method needs an initial interval for this you will need to think about the geometry.
It turns out that the right interval for finding the angle \theta n is [\theta n \delta ,\theta n +\delta ], where \delta gives
HI(x(\theta n), y(\theta n)) opposite signs at the endpoints. You should start by setting \delta =\pi /2, but you
will be required to experiment with this parameter, as well as the h parameter. Consider all of the
following when completing your report:
Start by trying to reproduce Figure 1 using the secant method, with h =0.6 and \delta =\pi /2.
What happens?
Test your root finder for a variety of (h,\delta ) values to determine one where you can get all the
way around the curve. How many steps do you need to get around the curve.
What kind of convergence failures do you observe in your experiment? Offer explanations for
the failures.
How do these calculations compare against MATLABs fzero?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions

Question

What is the role of cognition and thought in learning?

Answered: 1 week ago