Académique Documents
Professionnel Documents
Culture Documents
Group 02 Instructor: Prof. Dr. Eres Sylemez (Rm C205, email:eres@metu.edu.tr ) Class Hours and Room: Monday 13:40 - 15:30 Rm: B101 Rm: B103 Wendesday 12:40 - 13:30
Course TextBook: "Numerical Methods for Engineers" by S.C. Chapra and R.P. Canale, 4th ed., McGraw Hill. Web Page: http://www.me.metu.edu.tr/me310 Preriquisite: Calculus, Linear Algebra, Differentiation and integration, Differential Equations, Taylor and binomial expansion. Computer literacy and a programming language such as C, Pascal, VBA, Delphi, Fortran, etc.
Grading
Homework and Lab assignments and attendance (25%) 2 Midterms (2nd midterm using computer) (22% and 23%) 1 Final (30%)
Cheating!!!!
Will be very severely punished. Please read
Study regularly Do your homeworks on your own. If you have any questions, please ask (to your friends, to the assistants and to me) Attendance is compulsory. No excuse. %2n-2
AIM of ME Education
Solve mechanical engineering problems
Simplify and obtain
analytical solutions Graphical solutions Solutions using calculator Solutions using computer at all levels
AIM of ME310
Algorithmic Thinking Solution of complex engineering problems using numerical techniques.
Programming on a computer Use new mathematical tools Learn methods of Numerical Analysis Analyze errors due to digital computation
Efficient way of learning computer logic and programming Learn how math is utilized in engineering Introduction to the logic of package programs Solving problems that cannot be solved by the available package programs
Scientist =4
2+2 =? Engineer =4
Approximations and Errors Math vs Engineering significant digits. =? =3.1415 =3.1415926 =3.14159265358979
(5 digit)
(8 digit)
(15 digit)
Accuracy P r e c i s s i o n
We can use m terms. There will be some error Round-off errors i.e. =3.1415
True Value = Approximation + error True Value= Approximate Value + true Or: Et= True Value- Approximation
Etrue Fractional Relative Error= % t = TrueValue 100
Approximate Relative Error =
% a = Pr esentApprox. Pr eviousApprox. *100 Pr esentApprox
Example
x= /4 = 0.785398163397448 (450) sin(/4)=0.707106781186547
x3 x5 x 7 x9 x 2 n +1 sin( x) = x + + ........ = + (1) n 3! 5! 7! 9! (2n + 1)! n =1
#Terms 1 2 3 4 5 6 7 8 9 10
f(x) 0.785398163397448 0.704652651209168 0.707143045779360 0.707106469575178 0.707106782936867 0.707106781179619 0.707106781186568 0.707106781186547 0.707106781186547 0.707106781186547
% t 11.072073453959200 0.347066389783707 0.005128587898981 0.000044068502476 0.000000247532581 0.000000000979769 0.000000000002889 0.000000000000000 0.000000000000000 0.000000000000000
Example
x= 1.553343034274950 (890) sin(x)=0.999847695156391
Terms 1 2 3 4 5 6 7 8 9 10
f(x) 1.553343034274950 0.928672713486365 1.004035270448470 0.999705737159465 0.999850829115375 0.999847646490898 0.999847695717011 0.999847695151409 0.999847695156426 0.999847695156391
%t 55.357965198088200 7.118582361575920 0.418821317723176 0.014197962111061 0.000313443637339 0.000004867290675 0.000000056070528 0.000000000498300 0.000000000003520 0.000000000000022
Review of Calculus: Taylors Theorem If the function f(x) and its n+1 derivatives are continuous on an interval containing a and x, then the value of the funxtion at x is given by:
( x t ) n n +1 Rn = f (t )dt n! a
x
Integral form
If the function g is continuous and integrable in the interval containing a and x, then there exists a point between a and x such that
g (t )dt = g ( )( x a)
a
g(t) g()
=
a x t a
g()(x-a)
Let
g=fn+1(t)
and
( x t )n h(t ) = n!
f ( n +1) ( ) Rn = ( x a ) n +1 (n + 1)!
a<<x
f ( n +1) ( ) Rn = ( xi +1 xi ) n +1 (n + 1)!
f we let : h=(xi+1
xi)
f ( xi ) 2 f ( xi ) 3 f n ( xi ) n f ( xi +1 ) = f ( xi ) + f ( xi )h + h + h + .......... + h + Rn n! 2! 3!
f ( n +1) ( ) n +1 Rn = h (n + 1)!
f ( x0 ) = sin(0) = 0,
df = cos(0) = 1, dx x
0
d 2f d 3f = cos(0) = 1, =-sin(0)=0, 2 3 dx dx
x0 x0
d 4f = sin(0) = 0 4 dx
x0
dnf = 0 if n is even, n dx
x0
n +3 dnf = ( 1) 2 if n is odd n dx x0
(x-x 0 ) n = x n
x3 x5 x7 x9 sin( x) = 0 + x + 0 + 0 + + 0 + 0 + 3! 5! 7! 9!
x3 x5 x7 x9 sin( x) = 0 + x + 0 + 0 + + 0 + 0 + 3! 5! 7! 9!
One term appoximation: (n=2)
sin( ) = + = 0.785398163 4 4
( 4 ) f ( n +1) ( ) n +1 Rn = h = f ( ) (n + 1)! 3!
3
0< < 4
Rn =
( 4 ) f ( )
3!
-0.0807455122<R n <-0.0570956992
sin( ) = + 4 4
( 4 )
3!
= 0.704652651
Rn =
( 4 ) v f ( )
0< < 4
Rn = f v ( )
( 4 )
5!
0.00176097489<R n <0.00249039457
Accumulation of errors (Due to Round off errors) Small errors add up due to very large numbers of mathematical operations.
Division of a large number with a small number, or division of a small number with a large number may result in loss of significant digits.
f ( x ) = f ( x ) + f ( x )( x x )
Relative Error on x: Relative error on f(x): Condition Number:
[ x] =
xx x
f ( x) f ( x) f ( x)
If the condition number is large, then the function is ill conditioned in the region of interest
[ f ( x) ] =
[ f ( x)] xf ( x) = [ x] f ( x)
Condition Number:
[ f ( x)] xf ( x) = [ x] f ( x)
ex 1 f ( x) = x
for x=0.01
[ f ( x)] xf ( x) = [ x] f ( x)
e0.01 1 e0.01 e0.01 1 f (0.01) = =1.0050167 f '(0.01) = =0.50334587 0.01 0.01 0.012 0.01*0.50334587 The Condition Number= =0.005 (well behaving at x=0.01) 1.0050167
f ( x) =
2.5 1 x2
for x=0.999000
2.5 2 x * 2.5 5*0.999 = =1250.62531 f '(0.999) = =1249999.686 1 0.9992 (1 x 2 ) 2 (1 0.9992 ) 2 0.999*1249999.686 The Condition Number= =999 1250.62531 (too large, function is ill conditioned at x=0.999) f (0.999) =