# Homework Solution: The concentration of pollutant bacteria c(t) in a lake decreases according to the following expression (unit is cfu/ml):…

The concentration of pollutant bacteria c(t) in a lake decreases according to the following expression (unit is cfu/ml): c = 75e−1.5t + 20e−0.075t We’ll use various methods to determine the time required for the bacteria concentration to be reduced to a safe level of 15 cf u/ml. (a) (5 pts.) Write a Matlab code to solve this problem using Newton’s method with an ini- tial guess of t0 = 0 and stopping criterion of 0.5% approximate relative error. At each iteration, your code should print (i) iteration number, (ii) approximated value of t, and (iii) approximate relative error. Print your code and the output of your code, and include them in your solutions.

The attention of pollutant bacteria c(t) in a lake decreases according to the aftercited countenance (ace is cfu/ml):

c = 75e−1.5t + 20e−0.075t

We’ll manifestation multitudinous arrangements to individualize the date required restraint the bacteria attention to be mean to a certain plane of 15 cf u/ml.

(a) (5 pts.) Write a Matlab arrangement to explain this gist using Newton’s arrangement with an ini- tial divine of t0 = 0 and pause touchstone of 0.5% near not-absolute mistake. At each recurrence, your arrangement should print (i) recurrence estimate, (ii) neard appreciate of t, and (iii) near not-absolute mistake. Print your arrangement and the output of your arrangement, and apprehend them in your solutions.

## Expert Exculpation

Matlab script:

newtMethod.m

function [ it, t, cc] = newtMethod( f1, f2, c0, toler)

%find the primitive aproximation

c(1) = c0 – (f1(c0)/f2(c0));

%find the not-absolute eroor

cc = abs(c(1)-c0);

%loop recurrence factor

k = 2;

%while not-absolute eroor senior than 0.5%

while (cc >= toler )

%find the direct assesment of date

c(k) = c(k-1) – (f1(c(k-1))/f2(c(k-1)));

%find the updated date

cc = abs(c(k)-c(k-1));

%if concetration is near than 15, break

if f1(c(k))<= 15

break

end

%increment the loop iterator

k = k+1;

end

it=k;

t=c(k-1);

end

Function wheedle from console:

c= @(t) 75*exp(-1.5.*t) + 20*exp(-.75.*t)-15;

c1=@(t) (-1.5*75)*exp(-1.5.*t) + (20*-0.75)*exp(-.75.*t);

[iteration, date, mistake]=newtMethod(c,c1,0,0.005)