Lecture 2 Computational Methods For Engineers
Lecture 2 Computational Methods For Engineers
Engineers
Lecture 2
Reuel C. Pallugna
instructor
Topics
• Roots of equations
• Open Methods
• Fixed point iteration Method
• Newton Raphson Method
• Secant Method
• Polynomials using Matlab
• Solutions to Linear Algebraic Equations
• Curve Fitting
• Numerical Differentiation and Integration
• Numerical Solutions to Ordinary Differential Equations
• Numerical Solution to Partial Differential Equations
Fixed Point Iteration Method
• This is called a method of Example:
successive substitution Solve for the roots of
• A function f(x) is rearranged
such that the x is on the left
side of the equation Solution:
Solution:
Newton-Raphson Method Algorithm and Matlab Code
xr = 0.5000
xr = 0.5663
xr = 0.5671
xr = 0.5671
Secant Method
Basic Concept of the Secant Method
• Is an open method ( no need to bracket the root)
• Similar to the Newton Raphson method but
requires two initial guesses to determine the slope
of the secant line
• Whereas the NR uses the derivative to determine
the slope of the tangent line, the secant method
uses the two initial guesses to determine the
slope of the secant line
• The point in the secant line that crosses the x-axis
is used to estimate of the root of the curve Substituting the value of
• A numerical equivalent to the NR
Solution:
Initial guesses
Solution:
Matlab m-file using roots function Matlab Output
% this m-file is an illustration of using
the Matlab roots function
% to solve for the roots of the equation x=
% f(x) = x^5 - 3.5x^4 + 2.75x^3 + 2.125x^2
-3.875x +1.25 2.0000 + 0.0000i
c = [1 -3.5 2.75 2.125 -3.875 1.25]; -1.0000 + 0.0000i
x = roots(c) 1.0000 + 0.5000i
1.0000 - 0.5000i
0.5000 + 0.0000i
Activity 2
• Solve problems 6.1 to 6.6 of Applied Numerical Methods with Matlab,
2nd Ed., by S.C. Chapra