0% found this document useful (0 votes)
40 views3 pages

Nonlinear Equations: NR Method Guide

Uploaded by

Harsh Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views3 pages

Nonlinear Equations: NR Method Guide

Uploaded by

Harsh Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Module 04

Numerical solution of nonlinear equations

Please follow the guidelines mentioned below:

1. Create a separate folder corresponding to each problem. For example, for problem
3, make a folder: "Problem 3". All the codes and output files for problem 3, for
example, should be inside this folder.
2. Write separate C functions for function evaluation and derivative evaluation
for all problems.
3. Do not hard code data inside the code. All the parameters should be defined before
the main () function.
4. All the results should be saved as text/pdf/png files in the same folder as that of
the problem. This means, for example, the output files of problem no 2 should be
in the folder "Problem 2".
5. All output files should be named as instructed in the problems below.
6. While submitting the assignment, please put all the problem folders in one main
folder. The name of the folder should be your roll number. For example, if your
roll number is 12345678, then the folder should be named: "12345678". Then, zip
the folder as "[Link]". You should upload this zip file on MS Teams.
7. NOT FOLLOWING THE GUIDELINES WILL ATTRACT PENALTIES.

3
Question – 1: Find out the value of √13 using Newton-Raphson Method. Print your
results output file "Output_Problem_1.txt". The output file should have three columns.
3
The first column is the iteration number, and the second column is the value of √13
calculated by the NR method, the third column should be the error in the corresponding
NR step. Your answer should be accurate to 5 decimal places. [10]

Question – 2: Find the value of √𝝅 using the Newton-Raphson Method. Print your results
output file "Output_Problem_2.txt". The output file should have three columns. The first
column is the iteration number; the second column is the value of √𝝅 calculated by the
NR method; the third column should be the error in the corresponding NR step. Your
answer should be accurate to 5 decimal places. [10]
Figure 1

Question – 3: Ritam has developed a 2D CAD representation system that can represent
curves with different strokes. It illuminates a pixel when its center falls inside the circle
of diameter '𝑑,' with the center on the curve, as shown in figure 1. [10]

At what stroke value (𝑑) (accurate to 5 decimal places) a pixel (2, 0) will illuminate
while displaying a curve 𝑦 = 𝑥 2 (1 + sin2 𝑥 )?

a) Prepare a one-page document to define the problem statement "formulation_3.pdf".


b) Print your results output file "Output_Problem_3.txt". The output file should have
three columns. The first column is the iteration number, the second column is the
value of the stroke calculated by the NR method, and the third column should be the
error in the corresponding NR step.
c) Plot your curve with the calculated stroke in GeoGebra and verify your answer. Add
results as "GeGe_Problem_3.png".
Question – 4: Solve the following system of non-linear equations using the NR method.

𝑒 𝑥1 − 8𝑥1 sin(𝑥2 ) = 0,
𝑥1 + 𝑥2 − 1 = 0,
(𝑥3 − 1)3 = 0.
0.1
Start with 𝑥 0 = [0.5] and tolerance 𝑇𝑂𝐿 = 1 × 10−10 . Observe the error 𝐸 = ||𝑥 𝑘 − 𝑥 𝑘−1 || for

0.5
each value of 𝑘. Print your results in the output file "output_problem_4.txt". The output
file should have five columns. The first column is the iteration number, and the second,
third, and the fourth column should be the values of 𝑥1 , 𝑥2 and 𝑥3 and the fifth column
should be the error 𝐸 in the corresponding Newton-Raphson step.

Question – 5: Through previous examples, you might have observed that the process of
finding roots by Newton Raphson's method can be uncertain for some equations, and the
outcome can be extremely sensitive to the location of the initial guess. One such
interesting equation is 4𝑥 4 − 4𝑥 2 = 0.
a) Plot the graph of equation 𝑦 = 4𝑥 4 − 4𝑥 2 in interval 𝑥 = [−1, +1] with step 0.001.
b) Write a code for the NR method and find out the roots of 4𝑥 4 − 4𝑥 2 = 0
corresponding to all initial guesses between [−1, +1] with step size 0.001 and the
tolerance as 𝑇𝑂𝐿 = 1 × 10−10 . The output file should have four columns. The first
column is the initial guess; the second column is the iteration number; the third
column is the value of 4𝑥 4 − 4𝑥 2 and the fourth column should be the error in the
corresponding step, Output_problem_5.txt.
c) With the help of a graph, show that: If any initial guess (with 3 decimal places) is in
√2 √21 √21 √2
the interval (−1, − ) , (− , 7 ), and ( 2 , 1), it leads to roots -1, 0, and +1,
2 7
√21
respectively. If the initial guess is = ± it leads to each other. If the initial guess is
7
√21 √2
between and , then there are infinitely many open intervals of points attracted
7 2
to −1 and open intervals of points attracted to +1. Save the file as Zones_5.png.
Hint: You can plot the initial guess as a point (𝑥0 , 0) in; red if it leads to root -1, green
if it leads to root 0, blue if it leads to root −1, and black if it does not converge. This
graph will have different zones on X-axis in different colors.
d) Prepare a one-page document to explain the fundamental phenomena behind this
behavior of the NR method for this particular problem with the help of sketches and
text, "explaination_5.pdf".

You might also like