hw6_solution

hw6_solution - Numerical Analysis in Engineering ME 140A,...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Numerical Analysis in Engineering ME 140A, Fall 2007 Homework #6 Solution Dec 6, 2007 By: Mohamad Nasr-Azadani: mmnasr@engr.ucsb.edu 1. a) One can integrate dy dx = (1 + 2 x ) y, y (0) = 1 (1) using separation of variables technique. Toward this goal, we may write dy y = (1 + 2 x ) dx Z dy y = Z (1 + 2 x ) dx 2 y = x + x 2 + C, y (0) = 1 C = 2 y = 1 2 ( x + x 2 ) + 1 2 (2) b) Euler scheme is applied as following to solve equation (1), numeri- cally y n +1 = y n + f ( x n , y n ) x (3) where f ( x, y ) is given by f ( x, y ) = (1 + 2 x ) y (4) One can see the results obtained with Euler scheme in figure 1 for vaious x s. 1 c) Heun (predictor-corrector) scheme (with no iteration) is implemented as following to solve equation (1), numerically y n +1 = y n + f ( x n , y n ) x y n +1 = y n + f ( x n , y n ) + f ( x n +1 , y n +1 ) 2 x. (5) One can see the results obtained with Heun scheme in figure 2 for vaious x s. d) Fourth order Runge-Kutta is implemented as following to solve equa- tion (1), numerically k 1 = f ( x n , y n ) k 2 = f ( x n + 0 . 5 x, y n + 0 . 5 xk 1 ) k 3 = f ( x n + 0 . 5 x, y n + 0 . 5 xk 2 ) k 4 = f ( x n + x, y n + xk 3 ) y n +1 = y n + x 6 ( k 1 + 2 k 2 + 2 k 3 + k 4 ) (6) One can see the results obtained with 4th order Runge-Kutta method in figure 3 for vaious x s. In figure 4), the results for x = 0 . 025 obtained using the mentioned methods are plotted and comnpared with the analytical solutions. Also, in figure 5, relative error at y (1) is plotted vs x in logarithmic scale. The slope of each line would give us the order of accuracy of each numerical technique.each numerical technique....
View Full Document

This note was uploaded on 11/05/2009 for the course ME 140A taught by Professor Meiburg during the Fall '08 term at UCSB.

Page1 / 13

hw6_solution - Numerical Analysis in Engineering ME 140A,...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online