You are on page 1of 9

Dashboard / My courses / ENGR 391 (Fall 2020) / Assessments / Assignment 2 - Nonlinear Equations

Started on Wednesday, 23 September 2020, 7:04 PM


State Finished
Completed on Monday, 28 September 2020, 11:09 PM
Time taken 5 days 4 hours
Grade 13.00 out of 20.00 (65%)
Feedback
Make sure to understand well where you did mistakes and review the corresponding lecture topics.

Be careful not to fall behind by postponing the review of the topics.

Question 1 By checking the "yes" answer below I confirm


Complete
1. that I have neither given nor received unauthorized aid to answer the questions of this assignment.
Not graded
2. I agree to follow the rules in regard of online assignments as posted in the course outline
3. I used only octave or Matlab to solve the questions (I am allowed to consult all course material and my
own notes)

Select one:
a. Yes I agree

b. No I do not agree

Your answer is correct.


The correct answer is: Yes I agree

Question 2
Find the absolute backward and forward error for the following functions, where the true root is 𝑟 = 0.5 and
Correct
the approximated root is 𝑥𝑟 = 0.48 .
Mark 1.00 out
of 1.00 Fill out the following table to answer the question (use as many digits as possible)

𝑓(𝑥) Backward error Forward error

𝑓(𝑥) = 2𝑥 − 1 0.04 ! 0.02 !

𝑓(𝑥) = (2𝑥 − 1)2 0.0016 ! 0.02 !

𝑓(𝑥) = (2𝑥 − 1)3 0.000064 ! 0.02 !

The absolute forward error is for all cases |𝑟 − 𝑥𝑟 | = 0.02 .


The absolute backward error is different for each case and is computed as |𝑓(𝑥𝑟 )| .
The important element to understand here: even with a same forward error, one can have different backward
errors.
This problem illustrates once more that computing the backward error doesn't tell us anything about the
This study source was downloaded by 100000834826368 from CourseHero.com on 11-08-2023 16:02:54 GMT -06:00

https://www.coursehero.com/file/81041391/Assignment-2-Nonlinear-Equations-Attempt-reviewpdf/
This problem illustrates once more that computing the backward error doesn't tell us anything about the
forward error.
Reference: lecture on forward and backward errors in Lesson 2 "Solving nonlinear equations"

Question 3 We solve the equation 𝑥3 + 4𝑥2 − 10 = 0 using the false-position method.


Correct
If 𝑎0 = 1 and 𝑏 0 = 2 then 𝑎1 and 𝑏 1 are?
Mark 1.00 out
of 1.00
Select one:
a. 𝑎1 = 1 and 𝑏 1 = 1.263

b. 𝑎1 = 1.5 and 𝑏 1 = 2

c. 𝑎1 = 1.263 and 𝑏 1 = 2 !

d. 𝑎1 = 1 and 𝑏 1 = 1.5

Your answer is correct.


Reference: lecture on false position in Lesson 2 "Solving nonlinear equations"

The correct answer is: 𝑎1 = 1.263 and 𝑏 1 = 2

Question 4 Consider the function 𝑓(𝑥) = 3−𝑥 − 𝑥 . We apply Newton's method to find a root of this function.
Correct
If 𝑥2 = 0.5 then the value of 𝑥3 is given as
Mark 1.00 out
of 1.00
Select one:
a. -0.4554

b. 0.5965

c. 0.5473 !

d. 0.3748

Your answer is correct.


Reference: lecture on Newton's method in Lesson 2 "Solving nonlinear equations"
The correct answer is: 0.5473

Question 5 You have to solve an equation 𝑓(𝑥) = 0 with a precision below a relative error of 10−5 .

If ∣∣ 𝑥 ∣∣ < 10−5 then


Incorrect 𝑓(𝑥𝑟 )
𝑟
Mark 0.00 out
of 1.00
Select one:
a. you can't conclude anything

b. you have found an approximation 𝑥𝑟 to the specified precision

c. you have found an approximation 𝑥𝑟 to the specified precision if 𝑥𝑟 is not a multiple root

d. you have found an approximation 𝑥𝑟 to the specified precision as long as 𝑥𝑟 ≠ 0


"

Your answer is incorrect.


This study source was downloaded by 100000834826368 from CourseHero.com on 11-08-2023 16:02:54 GMT -06:00

https://www.coursehero.com/file/81041391/Assignment-2-Nonlinear-Equations-Attempt-reviewpdf/
Your answer is incorrect.
The quantity |𝑓(𝑥𝑟 )| , which is the backward error, doesn't tell you anything about |𝑟 − 𝑥𝑟 | which is the
absolute error.

Similarly ∣∣ 𝑥 ∣∣ doesn't tell you anything about ∣∣ 𝑥 𝑟 ∣∣ which is the relative error you want to have below the
𝑓(𝑥𝑟 ) 𝑟−𝑥
𝑟 𝑟

specified tolerance.
Reference: lecture on backward and forward errors in Lesson 2 "Solving nonlinear equations".
The correct answer is: you can't conclude anything

Question 6 The equation 𝑥3 − 4𝑥2 − 11𝑥 + 30 = 0 has a solution in 𝑟 = 2 .


Correct
You are using Newton's method to estimate this solution. If the absolute error in iteration 4 is about 0.04, how
Mark 1.00 out
large do you expect to be the absolute error in iteration 5 ?
of 1.00

Select one:
a. 0.005

b. 0.03

c. We can not predict this error with the information given

d. 0.0002 !

Your answer is correct.

Newton's method convergences quadraticaly. The asymptotic error constant 𝜆 is given by ∣


𝑓"(𝑟) ∣
∣ 2𝑓 ′ (𝑟) ∣ .
This is 𝜆 = ∣∣ 2 ∣ ≃ 0.13 .
6𝑟−8
3𝑟 −8𝑟−11 ∣

Consequently 𝐸5 ≃ 𝜆𝐸42 ≃ 0.13 ⋅ 0.04 2 ≃ 0.002

Reference: Lecture on order of convergence form Lesson 2 "Nonlinear equations"


The correct answer is: 0.0002

Question 7 Solve the equation 𝑥3 + 4𝑥2 − 10 = 0 using the bisection algorithm starting with 𝑎0 = 1 and 𝑏 0 = 2.0 .
Correct
Conduct three iterations (i.e. find 𝑥3 ) and report the approximation 𝑥3 of the root computed by the algorithm.
Mark 1.00 out
of 1.00 Use as many digits as possible.

Answer: 1.3125 !

First iteration: 𝑎1 = 1 and 𝑏 1 = 1.5


Second iteration: 𝑎2 = 1.25 and 𝑏 2 = 1.5
Third iteration: 𝑎3 = 1.25 and 𝑏 3 = 1.375
1.125+1.375
Algorithm estimates the root in the third iteration as 𝑥3 = 2
= 1.3125
Reference: lecture on bisection method in lesson 2 "Solving nonlinear equations"
The correct answer is: 1.3125

Question 8 We want to apply the fixed point method to solve the equation 𝑥 = 𝑔(𝑥) .
Partially
correct
Choose among the following examples of functions 𝑔(𝑥) which will lead to a converging fixed point algorithm
whenby
This study source was downloaded using
100000834826368 from 𝑥
the intial guess 0 specified. on 11-08-2023 16:02:54 GMT -06:00
CourseHero.com

https://www.coursehero.com/file/81041391/Assignment-2-Nonlinear-Equations-Attempt-reviewpdf/
when using the intial guess 𝑥0 specified.
Mark 0.50 out
of 1.00
Select one or more:
2
a. 𝑔(𝑥) = and 𝑥0 =1
√𝑥

b. 𝑔(𝑥) = sin 𝑥 + 𝑒𝑥 and 𝑥0 = 0.5

c. 𝑔(𝑥) = 𝑒𝑥 − 7 and 𝑥0 = −2 !

d. 𝑔(𝑥) = 𝑥2 − 3𝑥 cos 𝑥 and 𝑥0 = 1

e. 𝑔(𝑥) = sin 𝑥 + 𝑒𝑥 + 𝑥 − 4 and 𝑥0 = 0.5

Your answer is partially correct.


You have correctly selected 1.
To decide which function 𝑔(𝑥) leads to a converging algorithm you need to try out some iterations and
observe the convergence plot.
Reference: lecture on fixed point method in Lesson 2 "Solving nonlinear equations".
2
The correct answers are: 𝑔(𝑥) = 𝑒𝑥 − 7 and 𝑥0 = −2 , 𝑔(𝑥) = 𝑥 and 𝑥0 = 1

Question 9 You are using the bisection method to solve an equation with an initial guess 𝑎0 = −2.0 and 𝑏 0 = 0.5 .
Correct
It is required to find the approximation of the root with an absolute error less than 0.1
Mark 1.00 out
of 1.00 How many iteration do you have to do at least in order to reach the set precision?

Answer: 4 !

You need at least three iterations.


0.5+2.0
Indeed the initial error is about 2
= 1.25 .
1.25
After one iteration the error will be 2 which is larger than 0.1.
1.25
After two iterations the error will be 2 which is larger than 0.1.
2
1.25
After three iterations the error will be 3 which is larger than 0.1.
2
1.25
After four iterations you have an error of 4 which is less than 0.1.
2
Alternatively you can use the formula of the lecture:
log(0.5+2)−log 0.1
𝑛≥ log 2
− 1 ≃ 3.6
Again we find that at least 4 iterations will be needed.
Reference: lecture on bisection method (error control) in Lesson 2 "Solving nonlinear equations"

The correct answer is: 4

Question 10 You are implementing on a computer a numerical algorithm to solve an equation of the form 𝑓(𝑥) = 0 .
Incorrect
In order to check your algorithm you decide to test it with the function 𝑓(𝑥) = sin(𝑥) − 𝑥 .
Mark 0.00 out
of 1.00
Select one:
a. This is a valid choice for the function 𝑓(𝑥) to test the programmed algorithm "

This study source was downloadedb.byThis is not a good


100000834826368 choice
from for the function
CourseHero.com 𝑓(𝑥) to
on 11-08-2023 test the
16:02:54 programmed
GMT -06:00 algorithm

https://www.coursehero.com/file/81041391/Assignment-2-Nonlinear-Equations-Attempt-reviewpdf/
b. This is not a good choice for the function 𝑓(𝑥) to test the programmed algorithm

Your answer is incorrect.


The function 𝑓(𝑥) = sin(𝑥) − 𝑥 is flat around the root 𝑟 = 0 as it is a root of multiplicity 3.
Any numerical algorithm will face problems to find this root accurately. Some of them may even behave
differently compared to what they should (see the examples with Newton's algorithm covered in class where a
root finding problem with multiple roots becomes problematic).
It is not a good idea to check an implementation of an algorithm with a challenging problem.
Reference: lecture on challenging problems in Lesson 2 "Solving nonlinear equations"
The correct answer is: This is not a good choice for the function 𝑓(𝑥) to test the programmed algorithm

Question 11 The root 𝑟 = 0 of the equation 𝑒𝑥 − 𝑥 − 1 has a multiplicity of


Correct

Mark 1.00 out


of 1.00
Answer: 2 !

Indeed 𝑟 = 0 is a root as 𝑒𝑟 − 𝑟 − 1 = 0.
Define 𝑓(𝑥) = 𝑒𝑥 − 𝑥 − 1 .
Then 𝑓 ′ (𝑥) = 𝑒𝑥 − 1 .
As 𝑓 ′ (𝑟) = 0 the root is at least a double root.
Further 𝑓 " (𝑥) = 𝑒𝑥 and 𝑓 " (𝑟) ≠ 0 . Consequently the root is a double root.

Reference: lecture on challenging problems in Lesson 2 "Solving nonlinear equations"


The correct answer is: 2

Question 12 Consider the equation 3𝑥2 − 𝑒𝑥 = 0.


Incorrect
Find an approximation of it's root in [3, 5] to an absolute error less than 10−12 with one of the methods
Mark 0.00 out
covered in class.
of 1.00

Answer: 3.7330790 "

Regardless on which technique you use and which initial guess, you need to perform enough iterations until
reaching the asked precision.
For this you need in each iteration to estimate your error and check if it falls or not below the target precision.
It is recommended to go a few iterations more to double check and ideally try with more than one method to
verify the answer

Example calculation (Using Newton algorithm)


First we note based on a plot of 𝑦 = 𝑓(𝑥) that the root is of multiplicity 𝑚 = 1 (needed to know in order to
estimate correctly the error).
The plot allows us as well to choose an initial guess to start the algorithm
𝑥𝑜 =by4 100000834826368 from CourseHero.com on 11-08-2023 16:02:54 GMT -06:00
This study source was downloaded

https://www.coursehero.com/file/81041391/Assignment-2-Nonlinear-Equations-Attempt-reviewpdf/
𝑥𝑜 = 4
𝑥1 = 3.784361145167370
𝑥2 = 3.735379375079544
𝑥3 = 3.733083897874097
𝑥4 = 3.733079028654685
𝑥5 = 3.733079028632814
We see that in iteration 5 we have an estimated absolute error of

|𝑟 − 𝑥𝑟 | ≃ ∣∣ ′ 5 ∣∣ ≃ 4 ⋅ 10−16
𝑓(𝑥 )
𝑓 (𝑥5 )

Consequently 𝑥5 is an approximation to the root with an absolute error less than 10−12 .

The correct answer is: 3.7330790286328

Question 13 Consider the following function:


Partially
correct
𝑓(𝑥) = 2 + cos(𝑒𝑥 − 2) − 𝑒𝑥 .
Mark 0.50 out Use Newton's algorithm with 𝑥𝑜 = 0.5 and perform four iterations to compute 𝑥4 . Use 16 digits in your
of 2.00 calculations.
We use 𝑥4 as the approximation of the root 𝑟 of 𝑓(𝑥)

How much is the backward error (give the answer with one significant digit) ? 0.4 "

Estimate the multiplicity of the root : 1 !

Estimate the absolute error |𝑟 − 𝑥4 | of 𝑥4 to one significant digit : 0.0 "

How many correct significant digits contains 𝑥4 if used to estimate the root of 𝑓 ? 4 "

To apply Newton's algorithm you need to compute the first derivative of 𝑓 :


𝑓 ′ (𝑥) = 𝑒𝑥 (− sin(𝑒𝑥 − 2) − 1)
Iterating Newton's algorithm gives:
𝑥𝑜 = 0.5
𝑥1 = 1.693096115738836
𝑥2 = 0.5541812360355938
𝑥3 = 1.501688006679172
𝑥4 = 1.046498587535354
The backward error is given by |𝑓(𝑥4 )|.
A plot of 𝑦 = 𝑓(𝑥) shows that the root near 𝑥4 is of multiplicity 𝑚 = 1 .

To estimate the error of 𝑥4 one uses: |𝑟 − 𝑥4 | ≃ ∣ ′


𝑓(𝑥4 ) ∣
∣𝑓 (𝑥4 ) ∣

Based on the estimation of |𝑟 − 𝑥4 | one can immediately see how many digits in 𝑥4 are correct.
Reference: lectures on backward/forward errors and challenging problems of Lesson 2 "Solving nonlinear
equations"

Question 14 Consider the following equation:


This study source was downloaded by 100000834826368 from CourseHero.com on 11-08-2023 16:02:54 GMT -06:00

https://www.coursehero.com/file/81041391/Assignment-2-Nonlinear-Equations-Attempt-reviewpdf/
Partially
correct
𝑥2 − 2𝑥𝑒−𝑥 + 𝑒−2𝑥 = 0 .
Mark 1.00 out A numerical algorithm produced the following approximation of a root 𝑟 of this equation
of 2.00
𝑥𝑟 = 0.567143470743 .

How much is the backward error (give the answer with one significant digit) ? 0.0 "

Estimate the multiplicity of the root the algorithm is trying to approximate : 2 !

Estimate the absolute error |𝑟 − 𝑥𝑟 | of 𝑥𝑟 to one significant digit : 0.00000001 "

How many correct significant digits contains 𝑥𝑟 ? 6 !

Define 𝑓(𝑥) = 𝑥2 − 2𝑥𝑒−𝑥 + 𝑒−2𝑥 .


The backward error is given by |𝑓(𝑥𝑟 )| .
A plot of 𝑦 = 𝑓(𝑥) shows that the root near 𝑥𝑟 is of multiplicity 𝑚 > 1 and must be of even multiplicity.
Computing 𝑓 ′ (𝑥𝑟 ) , 𝑓 (2) (𝑥𝑟 ) and 𝑓 (3) (𝑥𝑟 ) allows to conclude that the multiplicity is 𝑚 = 2

To estimate the error of 𝑥𝑟 one uses: |𝑟 − 𝑥𝑟 | ≃ ∣


∣ 𝑚!⋅𝑓(𝑥𝑟 ) ∣∣1/𝑚 with 𝑚 = 2
∣ 𝑓 (𝑚) (𝑥𝑟 ) ∣
Based on the estimation of |𝑟 − 𝑥𝑟 | one can immediately see how many digits in 𝑥𝑟 are correct.
Reference: lectures on backward/forward errors and challenging problems of Lesson 2 "Solving nonlinear
equations"

Question 15 Consider the following equation:


Partially
correct
(𝑥 − 2)2 − ln 𝑥 = 0 .
Mark 1.00 out A numerical algorithm produced the following approximation of a root 𝑟 of this equation
of 2.00
𝑥𝑟 = 3.057107083749 .

How much is the backward error (give the answer with one significant digit) ? 0.000006 !

Estimate the multiplicity of the root the algorithm is trying to approximate : 2 "

Estimate the absolute error |𝑟 − 𝑥𝑟 | of 𝑥𝑟 to one significant digit : 0.000004 !

How many correct significant digits contains 𝑥𝑟 ? 5 "

Define 𝑓(𝑥) = (𝑥 − 2)2 − ln 𝑥 .


The backward error is given by |𝑓(𝑥𝑟 )| .
A plot of 𝑦 = 𝑓(𝑥) shows that the root near 𝑥𝑟 is of multiplicity 𝑚 = 1 .

To estimate the error of 𝑥𝑟 one uses: |𝑟 − 𝑥𝑟 | ≃ ∣


∣ 𝑚!⋅𝑓(𝑥𝑟 ) ∣∣1/𝑚 with 𝑚 = 1
∣ 𝑓 (𝑚) (𝑥𝑟 ) ∣
Based on the estimation of |𝑟 − 𝑥𝑟 | one can immediately see how many digits in 𝑥𝑟 are correct.
Reference: lectures on backward/forward errors and challenging problems of Lesson 2 "Solving nonlinear
equations"

This study source was downloaded by 100000834826368 from CourseHero.com on 11-08-2023 16:02:54 GMT -06:00

https://www.coursehero.com/file/81041391/Assignment-2-Nonlinear-Equations-Attempt-reviewpdf/
Question 16 Consider the equation 2𝑥 cos(2𝑥) − (𝑥 − 2)2 = 0.
Correct
Find an approximation of it's root in [2, 3] to an absolute error less than 10−10 with one of the methods
Mark 1.00 out
covered in class.
of 1.00

Answer: 2.370686917565763 !

Regardless on which technique you use and which initial guess, you need to perform enough iterations until
reaching the asked precision.
For this you need in each iteration to estimate your error and check if it falls or not below the target precision.
It is recommended to go a few iterations more to double check and ideally try with more than one method to
verify the answer

Example calculation (Using Newton algorithm)


First we note based on a plot of 𝑦 = 𝑓(𝑥) that the root is of multiplicity 𝑚 = 1 (needed to know in order to
estimate correctly the error).
The plot allows us as well to choose an initial guess to start the algorithm
𝑥𝑜 = 2
𝑥1 = 2.550769198432895
𝑥2 = 2.371358512514945
𝑥3 = 2.370687056826609
𝑥4 = 2.370686917662268
We see that in iteration 4 we have an estimated absolute error of

|𝑟 − 𝑥𝑟 | ≃ ∣∣ 𝑓 ′ (𝑥4 ) ∣∣ ≃ 6 ⋅ 10−15
𝑓(𝑥 )
4

Consequently 𝑥4 is an approximation to the root with an absolute error less than 10−10 .

The correct answer is: 2.3706869176623

Question 17 Consider the following equation:


Correct
2 + cos(𝑒𝑥 − 2) − 𝑒𝑥 = 0 .
Mark 2.00 out
of 2.00 A numerical algorithm produced the following approximation of a root 𝑟 of this equation
𝑥𝑟 = 1.00767372.

How much is the backward error (give the answer with one significant digit) ? 0.0002 !

Estimate the multiplicity of the root the algorithm is trying to approximate : 1 !

Estimate the absolute error |𝑟 − 𝑥𝑟 | of 𝑥𝑟 to one significant digit : 0.00005 !

How many correct significant digits contains 𝑥𝑟 ? 5 !

Define 𝑓(𝑥) = 2 + cos(𝑒𝑥 − 2) − 𝑒𝑥 .


This study source was downloaded by 100000834826368 from CourseHero.com on 11-08-2023 16:02:54 GMT -06:00

https://www.coursehero.com/file/81041391/Assignment-2-Nonlinear-Equations-Attempt-reviewpdf/
𝑓(𝑥) = 2 + cos(𝑒 − 2) − 𝑒
The backward error is given by |𝑓(𝑥𝑟 )| .
A plot of 𝑦 = 𝑓(𝑥) shows that the root near 𝑥𝑟 is of multiplicity 𝑚 = 1 .

To estimate the error of 𝑥𝑟 one uses: |𝑟 − 𝑥𝑟 | ≃ ∣


∣ 𝑚!⋅𝑓(𝑥𝑟 ) ∣∣1/𝑚 with 𝑚 = 1
∣ 𝑓 (𝑚) (𝑥𝑟 ) ∣
Based on the estimation of |𝑟 − 𝑥𝑟 | one can immediately see how many digits in 𝑥𝑟 are correct.
Reference: lectures on backward/forward errors and challenging problems of Lesson 2 "Solving nonlinear
equations"

◀ Assignment 1 - Introduction (Not


Jump to... Assignment 3 - Linear Equations ▶︎
for grade)

This study source was downloaded by 100000834826368 from CourseHero.com on 11-08-2023 16:02:54 GMT -06:00

https://www.coursehero.com/file/81041391/Assignment-2-Nonlinear-Equations-Attempt-reviewpdf/
Powered by TCPDF (www.tcpdf.org)

You might also like