Numerical Methods and Computer Programming Lab: Tutorial 01 - Roots of Equations
Numerical Methods and Computer Programming Lab: Tutorial 01 - Roots of Equations
Numerical Methods and Computer Programming Lab: Tutorial 01 - Roots of Equations
Chapra SC, Canale RP. Numerical methods for engineers. McGraw Hill
Education. 2015: Chapter 5 – section 5.1, 5.2, 5.3
Tutorial 1: Roots of Equations…
• Q2
Chapra SC, Canale RP. Numerical methods for engineers. McGraw Hill Education.
2015: Chapter 6 – section 6.2, 6.3
• Last date of submission – (Tue) 21 Aug 2018 - 3 pm
Report Format
• Title page – Tutorial number, tutorial title, roll number and date of
submission
• For each completed answer
• 1st page – graph paper
• 2nd page – Flowchart for bisection method
• 3rd page – c program for bisection method
• 4th page - Flowchart for false position method
• 5th page – c program for false position method
• 6th page – output of bisection program
• 7th page – output of false position program
• 8th page – comparison of the results using graphical, bisection and false position
method and write conclusion
Tutorial 1: Roots of Equations
• Q1
Q1 - Graphically
• f(x) = -25 + 82 x – 90 x2 + 44 x3 – 8 x4 + 0.7 x5
• xl = 0.5 xu = 1.0
4.0
x f(x)
0.5 -1.478 3.0
0.6 0.322
0.7 1.589 2.0
0.8 2.481
1.0
f(x)
0.9 3.141
1 3.700
0.0
0.5 0.6 0.7 0.8 0.9 1
0.579361 -0.001 -1.0
-2.0
x
Q1 - Bisection
• Error estimate
• Stop program when error estimate reaches 10% and report the value of the root
Q1 - Steps
• Define variables
• Compute f(xl) and f(xu). Compute f(xl)*f(xu). Check that f(xl)*f(xu)<0
• Bisection
• Estimate xr (average of xl and xu).
• Compute f(xr), f(xr)*f(xl)
• Conditions
• If f(xr)*f(xl) < 0 xu=xr
• If f(xr)*f(xl) > 0 xl=xr
• If f(xr)*f(xl) = 0 end loop
• Compute error and check error criteria (10%)
• Repeat
• Print output
Q1 – False Position
Tutorial 1: Roots of Equations…
• Q2
Chapra SC, Canale RP. Numerical methods for engineers. McGraw Hill Education.
2015: Chapter 6 – section 6.2, 6.3
• Last date of submission – (Tue) 21 Aug 2018 - 3 pm
Q2 - Newton – Raphson Method
Q2 – Secant Method
First Program
• Login to the computer – password ‘student’
• Create a folder and name it with your roll no.
• Create a subfolder “T0”
• Write a c program to print “Hello World”
• Ensure that the program is saved in “T0” folder
• Compile and run the program
• Save the output in a text file “out0.txt”
Thank You
Open text editor
Type your program
Save it in the desired folder
Chapra SC, Canale RP. Numerical methods for engineers. McGraw Hill
Education. 2015: Chapter 9 – section 9.1, 9.2, 9.3, 9.4
Tutorial 2: Linear Algebraic Equations…
• Q2
Chapra SC, Canale RP. Numerical methods for engineers. McGraw Hill Education.
2015: Chapter 11 – section 11.1, 11.2
• Last date of submission – (Tue) 11 Sept 2018 - 3 pm
Tutorial 01 - Answers
Tutorial 3: Curve Fitting
Group Activity
• Max team size: 5
• Include MIS No. and batch No. of each team member on the first
page
Chapra SC, Canale RP. Numerical methods for engineers. McGraw Hill
Education. 2015: Chapter 17 – section 17.1
Tutorial 3: Curve Fitting
• Q2
Chapra SC, Canale RP. Numerical methods for engineers. McGraw Hill
Education. 2015: Chapter 17 – section 17.3
Tutorial 3: Curve Fitting
• Q3 & Q4
Chapra SC, Canale RP. Numerical methods for engineers. McGraw Hill
Education. 2015: Chapter 18 – section 18.1, 18.2
Tutorial 3: Curve Fitting
• Q5
Chapra SC, Canale RP. Numerical methods for engineers. McGraw Hill
Education. 2015: Chapter 18 – section 18.7
Last date of submission – (Tue) 25 Sept 2018 - 3 pm