DOC PREVIEW
CSUN ME 501A - Homework Solutions

This preview shows page 1 out of 3 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

College of Engineering and Computer ScienceMechanical Engineering DepartmentMechanical Engineering 501ASeminar in Engineering AnalysisFall 2004 Number: 17472 Instructor: Larry CarettoNovember 9 Homework SolutionsKeryszig, pages 951-952, problems 11-14 – Solve xxxydxdy 1ln2, y(1) = 0 for y at x =1.8 using the methods listed below and compare the results. Verify that the exact solution is y = (ln x)2 + ln x and compute the error. Compare the errors for the methods used.- (Problem 11): Euler’s method with h = 0.1- (Problem 12): Improved Euler method with h = 0.2- (Problem 13): Classic Runge-Kutta method with h = 0.4- (Problem 14): Classic Runge-Kutta method with h = 0.1We can verify the exact solution by substituting it into the left and right hand sides of the differential equation. This gives xxxxxxxxxxxyRHSRHSxxxxxdxddxdy1ln21lnln)(ln21ln2?1ln2ln)(ln22So, the exact solution satisfies the differential equation; it also satisfies the initial condition that y(1) = 0.The Euler method algorithm, ym+1 = ym + hf(xm,ym), is implemented for h = 0.1, with the results shown inthe table below. For each row after the first row, the new y value is the old y value plus the derivative in the last column of the previous row times the step size, h = 0.1.x y Exact y Error f1 0 0 0 11.1 0.1 0.104394 0.004394 1.0336041.2 0.20336 0.215563 0.012202 1.0750801.3 0.310868 0.331199 0.020331 1.1080561.4 0.421674 0.449686 0.028012 1.1312761.5 0.534802 0.569867 0.035065 1.1461781.6 0.649419 0.690907 0.041488 1.1544691.7 0.764866 0.812195 0.047328 1.1576251.8 0.880629 0.933280 0.052651 1.156832The improved Euler or Huen method uses the following algorithm: ym+1 = ym + (k1 + k2)/2, where k1= hf(xm, ym) and k2 = hf(xm+1, ym + k1). This algorithm is implemented in the table below for h = 0.2.The values of k1 and k2 are shown. The average of these two values in a given row is added to the y value in that row to get the y value in the next row.Engineering Building Room 1333 Mail Code Phone: 818.677.6448Email: [email protected] 8348 Fax: 818.677.7062x y Exact y Error k1 k21 0 0 0 0.2 0.2109871.2 0.205493 0.215563 0.010069 0.217408 0.2268541.4 0.427624 0.449686 0.022062 0.229118 0.2330331.6 0.65870 0.690907 0.032207 0.233598 0.2337391.8 0.892368 0.933280 0.040912The classic Runge-Kutta algorithm uses four derivative function evaluations per step to compute ym+1 = ym + (k1 + 2k2 + 2k3 + k4)/6, where k1 = hf(xm, ym), k2 = hf(xm+h/2, ym + k1/2), k3 = hf(xm+h/2, ym + k2/2), and k4 = hf(xm+1, ym + k3). This algorithm is implemented for h = 0.4 and h = 0.1 in the two tables below. In each table the value of y and k1 to k4 in a given row are used to compute the new value, ym+1 that is shown in the next row.x y Exact y Error k1 k2 k3 k41 0 0 0 0.4 0.421974 0.446205 0.4750061.4 0.435227 0.449686 0.014459 0.465287 0.472411 0.474404 0.4743621.8 0.907441 0.93328 0.025839 0.473502 0.468639 0.467914x y Exact y Error k1 k2 k3 k41 0 0 0 0.1 0.101863 0.104053 0.1079091.1 0.10329 0.104394 0.001104 0.107151 0.109701 0.110534 0.1129151.2 0.21338 0.215563 0.002183 0.112705 0.114535 0.114872 0.1164131.3 0.328035 0.331199 0.003164 0.116348 0.117546 0.117697 0.1186491.4 0.445616 0.449686 0.00407 0.118624 0.119337 0.119404 0.1199261.5 0.564954 0.569867 0.004913 0.119915 0.120263 0.120289 0.1204921.6 0.685206 0.690907 0.005701 0.120487 0.120563 0.120568 0.1205341.7 0.805753 0.812195 0.006441 0.120532 0.120404 0.120398 0.1201881.8 0.926141 0.93328 0.007139 0.120187 0.119907 0.119894Comparing the final errors for the first three methods, where the total number of derivative evaluations, a measure of the work in the algorithm, is the same, shows that the error decreases from 0.052651 to 0.040912 to 0.025839 as we go from the Euler to the improved Euler to the Runge-Kutta. This example shows that the error decreases for higher order of the error at an equivalent amount of work. When we cut the step size in the classical Runge-Kutta from 0.4 to 0.1, a factor of 0.24, the error is reduced from 0.025839 to 0.007139, a factor of 0.276; this is not the fourth-order error that we would expect. This shows that the order may change depending onthe problem solved. Although it is generally a good indication of the error, it is not a fixed and immutable quantity.Hoffman, page 418, problems 21 – Solve dy/dx = 1 + 0.5 h2, by the explicit Euler method from t = 0.0 to t = 1.0 with Dt = 0.2 and 0.1. The problem statement provides the exact solution: 5)5.0(tan5.0tan01yty. You were not required to use this solution in this problem, however it has been used been used below to compute the error.The Euler method algorithm, ym+1 = ym + hf(xm,ym), is implemented for both step sizes, with the results shown in the table below. For each row after the first row, the new y value is the old y value plus the derivative in the last column of the previous row times the appropriate step size, x = h = 0.2 or 0.1.Engineering Building Room 1333 Mail Code Phone: 818.677.6448Email: [email protected] 8348 Fax: 818.677.7062Results for h = 0.1 Results for h = 0.2i tiyifiy(xi) error i tiyifiy(xi) error0 0 0.5 1.125 0.5 0 0 0 0.5 1.125 0.5 01 0.1 0.61250 1.18758 0.61558 0.003082 0.2 0.73126 1.26737 0.73852 0.00726 1 0.2 0.72500 1.26281 0.73852 0.013523 0.3 0.85799 1.36808 0.87090 0.012904 0.4 0.99480 1.49482 1.01535 0.02055 2 0.4 0.97756 1.47781 1.01535 0.037795 0.5 1.14428 1.65469 1.17528 0.031006 0.6 1.30975 1.85773 1.35522 0.04547 3 0.6 1.27313 1.81042 1.35522 0.082107 0.7 1.49553 2.11830 1.56137 0.065848 0.8 1.70736 2.45753 1.80249 0.09513 4 0.8 1.63521 2.33696 1.80249 0.167289 0.9 1.95311 2.90732 2.09146 0.1383510 1 2.24384 3.51741 2.44805 0.20421 5 1.0 2.10260 3.21047 2.44805 0.34545The errors for h = 0.2 are about twice the errors for h = 0.1 showing the first order global error for the Euler method.Engineering Building Room 1333 Mail Code Phone: 818.677.6448Email: [email protected] 8348 Fax:


View Full Document
Download Homework Solutions
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Homework Solutions and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Homework Solutions 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?