SALVATORE LUISO 0000707745 UNIVERSITY OF BOLOGNA - FACULTY OF ENGINEERING A.Y. 2013/2014 INTRODUCTION TO NUMERICAL METHODS Exercise 1) The finite difference method used to find a solution of this problem is based on Taylor Series expansion of the function: An approximation for the first derivative of f is obtained by first truncation of this polynomial: Forward: Error x x f x f x f i i i ) ( ) ( ) ( ' 1 Backward: Error x x f x f x f i i i ) ( ) ( ) ( ' 1 Centered: Error x x f x f x f i i i 2 ) ( ) ( ) ( ' 1 1 As we are in 1D problem (u=u(x)) the centered formula for the second derivative is: (1) )] ( [ ) ( ) ( 2 ) ( ) ( ' ' 2 2 1 1 x O E x x f x f x f x f i i i i We can use the centered approximation because we have the boundary conditions at each extremum (if we have b. c. f(x 0 ), in eq. (1) for i=1 f(x i-1 )= f(x 0 ), if we have b. c. f(x n ), in eq. (1) for i=n-1 f(x i+1 )= f(x n ), so we will not need any further points out of our range) and it is more convenient because the error order is second: it is more precise than the others. Substituting f with u the equation of the problem becomes: (2) ) ( ) ( ) ( ) ( 2 ) ( 2 1 1 i i i i i i x f x u x h x u x u x u Where h is the discretization step Δx 2 and ) 4 sin( ) 16 ( ) 1 ( ) ( 2 i i i x i x x x e x f i . Rewriting (2): ) ( ) ( ) 2 )( ( ) ( 2 1 2 1 i i i i i x f h x u h x x u x u We can develop each step for 0i n: i=0 1 ) ( 0 x u From Dirichlet boundary conditions