{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw6_solution

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

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

Numerical Analysis in Engineering ME 140A, Fall 2007 Homework #6 Solution Dec 6, 2007 By: Mohamad Nasr-Azadani: [email protected] 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

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

View Full Document
c) Heun (predictor-corrector) scheme (with no iteration) is implemented as following to solve equation (1), numerically y 0 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 0 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 . x, y n + 0 . xk 1 ) k 3 = f ( x n + 0 . x, y n + 0 . 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.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

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
Ask a homework question - tutors are online