Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Lab 2. Bisection Method: 1 Instructions

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Universidad Industrial de Santander, Colombia

Numerical Analysis, 2019-1


Jorge Bacca
September 29, 2019

Lab 2. Bisection Method

1 Instructions
• Make a pdf report including the solution to each point of the practice with name
Lab2 name lastname.pdf.
• Send all files in a rar o zip file with name Lab2 name lastname.rar to analisis-
numero@outlook.com. Write in the subject LAN 2019-2 Lab 2.
• You are allowed to use internet, notes, and .m files that you have created before.

2 Implementing
• (1.5 points) Create a Matlab function called my finding interval name lastname() to
find two adequate initial points [a, b] given a function f (x). Make a script called
run 2a name lastname.m in which you use the created function with and example (start
the search at 0).
• (1.0 points) Create a Matlab function called my bisection function name lastname() to find
the root of a function. The arguments of the function must be: the function to be evaluated
f (x) (as an inline function), the initial points [a, b], and the stopping criteria (the number of
iterations or the relative error). Make a script called run 2b name lastname.m in which you
use the created function to solve any example. For instance,
fun = @ XXXXXX;
a=XX;
b=XX;
Iter=X;
root=my bisection function name lastname(fun,a,b,Iter);

• (1.5 points) Given the function f (x) = (x − 8)(x − 3)2 use your script to find each one of the
roots. Compare the theoretical number of iterations N with respect to the practical number of
iterations when the stopping criteria is established as  = 1e−2 , 1e−4 , 1e−6 , 1e−8 , 1e−10 . Plot
the results where the x-label corresponds to the value of epsilon, and the y-label corresponds to
the number of iterations for both cases: theoretical and practical. Conclude about the figure.

• (1.0 points) Create a Matlab function called my visual bisection function name lastname()
to visualize the behaviour of the Bisection method. The arguments of the function
must be: the function to be evaluated f (x) (as an inline function), the initial points
[a, b], and the number of iterations. Make a script called run 2d name lastname.m in
which you use the created function to visualize the behavior of the bisection method
when solving any example and conclude about the convergence of the method. For instance,
fun = @ XXXXXX;
a=XX;
b=XX;
Iter= XX
P=my visual bisection function name lastname(fun,a,b,Iter);

1
2.1 Interpreting
When the mortality rate is neglected, the world population N can be simulated by a function that
grows in proportion to the number of individuals existing at any time t. Also, if λ is the growth
rate, ϕ is a coefficient that simulates the immigration, and N0 is the population at the beginning of
the simulation, the function to determine the quantity of individuals at any time t is given by

eλt − 1
N (t) = N0 eλt + ϕ (1)
λ
Assume that in t = 0 the world population has 1500 individuals, also assume that the inmigriation
rate is of 475 individuals per year, and after one year (t = 1) the population has amounted to 2264
individuals.

• (0.2 points) Determine a nonlinear equation f (λ) = 0 to calculate the growth rate λ by finding
its root. f (λ) =

• (0.8 points) Make a script to find the root of the nonlinear equation f (λ) = 0 by using the
created function in 2. Also plot the function between λ = 0.01 and λ = 1.

You might also like