Homework 2 Solutions



Similar documents
1 Error in Euler s Method

Numerical Methods for Differential Equations

5 Numerical Differentiation

Numerical Methods for Ordinary Differential Equations

4.3 Lagrange Approximation

The Method of Least Squares. Lectures INF2320 p. 1/80

Solving ODEs in Matlab. BP205 M.Tremont

Mathematics. ( : Focus on free Education) (Chapter 5) (Complex Numbers and Quadratic Equations) (Class XI)

Numerical Solution of Differential

Linear and quadratic Taylor polynomials for functions of several variables.

Chapter 5. Methods for ordinary differential equations. 5.1 Initial-value problems

Second Order Linear Nonhomogeneous Differential Equations; Method of Undetermined Coefficients. y + p(t) y + q(t) y = g(t), g(t) 0.

16.1 Runge-Kutta Method

Representation of functions as power series

Stability Analysis for Systems of Differential Equations

Student name: Earlham College. Fall 2011 December 15, 2011

PSTricks. pst-ode. A PSTricks package for solving initial value problems for sets of Ordinary Differential Equations (ODE), v0.7.

Computational Geometry Lab: FEM BASIS FUNCTIONS FOR A TETRAHEDRON

CITY UNIVERSITY LONDON. BEng Degree in Computer Systems Engineering Part II BSc Degree in Computer Systems Engineering Part III PART 2 EXAMINATION

Zeros of Polynomial Functions

Numerical Methods for Differential Equations

JUST THE MATHS UNIT NUMBER 1.8. ALGEBRA 8 (Polynomials) A.J.Hobson

Lectures 5-6: Taylor Series

Euler s Method and Functions

Numerical Methods for Solving Systems of Nonlinear Equations

ab = c a If the coefficients a,b and c are real then either α and β are real or α and β are complex conjugates

1 Cubic Hermite Spline Interpolation

Partial Fractions. Combining fractions over a common denominator is a familiar operation from algebra:

t := maxγ ν subject to ν {0,1,2,...} and f(x c +γ ν d) f(x c )+cγ ν f (x c ;d).

1 Review of Newton Polynomials

AP Calculus BC 2006 Free-Response Questions

Designing Efficient Software for Solving Delay Differential Equations. C.A.H. Paul. Numerical Analysis Report No Oct 2000

Notes for AA214, Chapter 7. T. H. Pulliam Stanford University

1.(6pts) Find symmetric equations of the line L passing through the point (2, 5, 1) and perpendicular to the plane x + 3y z = 9.

Numerical Analysis An Introduction

Differentiation of vectors

Inner Product Spaces

Name: ID: Discussion Section:

MARK SCHEME for the October/November 2012 series 9709 MATHEMATICS. 9709/11 Paper 1, maximum raw mark 75

AP CALCULUS BC 2008 SCORING GUIDELINES

Review Solutions MAT V (a) If u = 4 x, then du = dx. Hence, substitution implies 1. dx = du = 2 u + C = 2 4 x + C.

Mark Howell Gonzaga High School, Washington, D.C.

The Logistic Function

Math 22B, Homework #8 1. y 5y + 6y = 2e t

CS Software Engineering for Scientific Computing. Lecture 16: Particle Methods; Homework #4

Heriot-Watt University. M.Sc. in Actuarial Science. Life Insurance Mathematics I. Tutorial 5

Numerical Solution of Differential Equations

Linearly Independent Sets and Linearly Dependent Sets

Let s examine the response of the circuit shown on Figure 1. The form of the source voltage Vs is shown on Figure 2. R. Figure 1.

Zeros of Polynomial Functions

Roots of Equations (Chapters 5 and 6)

Lecture Notes to Accompany. Scientific Computing An Introductory Survey. by Michael T. Heath. Chapter 10

Zeros of a Polynomial Function

SIXTY STUDY QUESTIONS TO THE COURSE NUMERISK BEHANDLING AV DIFFERENTIALEKVATIONER I

3 Contour integrals and Cauchy s Theorem

Nonlinear Algebraic Equations. Lectures INF2320 p. 1/88

Course Notes for Math 162: Mathematical Statistics Approximation Methods in Statistics

TTT4120 Digital Signal Processing Suggested Solution to Exam Fall 2008

MATH 132: CALCULUS II SYLLABUS

Zero: If P is a polynomial and if c is a number such that P (c) = 0 then c is a zero of P.

Math Numerical Analysis Homework #2 Solutions

Homework 2 Solutions

88 CHAPTER 2. VECTOR FUNCTIONS. . First, we need to compute T (s). a By definition, r (s) T (s) = 1 a sin s a. sin s a, cos s a

AP Calculus BC 2010 Free-Response Questions

Integration. Topic: Trapezoidal Rule. Major: General Engineering. Author: Autar Kaw, Charlie Barker.

Taylor Polynomials. for each dollar that you invest, giving you an 11% profit.

COWLEY COLLEGE & Area Vocational Technical School

Lecture 13 Linear quadratic Lyapunov theory

Code: MATH 274 Title: ELEMENTARY DIFFERENTIAL EQUATIONS

TMA4213/4215 Matematikk 4M/N Vår 2013

Approximating functions by Taylor Polynomials.

Numerical Methods for Option Pricing

3.3. Solving Polynomial Equations. Introduction. Prerequisites. Learning Outcomes

I. Pointwise convergence

Math 115 Spring 2011 Written Homework 5 Solutions

Maximizing volume given a surface area constraint

A First Course in Elementary Differential Equations. Marcel B. Finan Arkansas Tech University c All Rights Reserved

Differentiation and Integration

1 Review of Least Squares Solutions to Overdetermined Systems

EVALUATING A POLYNOMIAL

Readings this week. 1 Parametric Equations Supplement. 2 Section Sections Professor Christopher Hoffman Math 124

Review of Fundamental Mathematics

GenOpt (R) Generic Optimization Program User Manual Version 3.0.0β1

INTRODUCTION (Syllabus, Numerical Methods & Computational Tools)

Method To Solve Linear, Polynomial, or Absolute Value Inequalities:

Math Assignment 6

THE COMPLEX EXPONENTIAL FUNCTION

HIGH ORDER WENO SCHEMES ON UNSTRUCTURED TETRAHEDRAL MESHES

System of First Order Differential Equations

General Theory of Differential Equations Sections 2.8, , 4.1

7.6 Approximation Errors and Simpson's Rule

2010 Solutions. a + b. a + b 1. (a + b)2 + (b a) 2. (b2 + a 2 ) 2 (a 2 b 2 ) 2

MATH 108 REVIEW TOPIC 10 Quadratic Equations. B. Solving Quadratics by Completing the Square

AP Calculus BC 2008 Scoring Guidelines

arxiv:hep-th/ v1 25 Jul 2005

Transcription:

Homework Solutions Igor Yanovsky Math 5B TA Section 5.3, Problem b: Use Taylor s method of order two to approximate the solution for the following initial-value problem: y = + t y, t 3, y =, with h = 0.5. problem Let us first derive the Taylor s method or order two for general initial value y = ft, y, a t b, ya = α. Expand the solution yt in terms of its second Taylor polynomial about t i and evaluate at t i+, we obtain yt i+ = yt i + hy t i + h y t i + h3 6 y ξ i, 3 for some ξ i t i, t i+. Since we have y t = ft, yt, differentiating y t twice gives y t = f t, yt, y t = f t, yt. Plugging these into 3 gives yt i+ = yt i + hft i, yt i + h f t i, yt i + h3 6 f ξ i, yξ i. 4 When h is small, the last term in 4 is small, and thus, we can ignore it. The Taylor s method of order two for general initial value problem is therefore w i+ = w i + hft i, w i + h f t i, w i. 5 For the initial value problem, we have ft, yt = + t y, f t, yt = d dt + t y = t y y = t y + t y = t y 3. Equation 5, with t i = + 0.5i, becomes w i+ = w i + h + t i w i h t i w i 3 = w i + 0.5 + + 0.5i w i 0.5 + 0.5i w i 3.

Hence, with w 0 =, we have w = w 0 + 0.5 + w 0 0.5 w 0 3 = + 0.5 + 0.5 =.75, w = w + 0.5 + + 0.5 w 0.5 + 0.5 w 3 =.75 + 0.5 + + 0.5.75 0.5 + 0.5.75 3 =.4578. Section 5.3, Problem c: Use Taylor s method of order two to approximate the solution for the following initial-value problem: y = + y t, t, y =, 6 with h = 0.5. The Taylor s method of order two for general initial value problem is given by equation 5. For the initial value problem 6, we have ft, yt = + y t, f t, yt = d + y = y t y dt t t Equation 5, with t i = + 0.5i, becomes w i+ = w i + h + w i t i = w i + 0.5 + Hence, with w 0 =, we have + h t i w i + 0.5i = + y t t y t = t. + 0.035 + 0.5i w = w 0 + 0.5 + w 0 + 0.035 =.785, w = w + 0.5 + w + 0.035 = 3.65,.5.5 and, similarly, calculate w 3 and w 4..

Problem : Assume that yt = 4 cos t 7t 4 3 is the solution to some initial value problem on t 3. a Calculate the local truncation error when Euler s method is applied to this problem. Derive an upper bound for the local truncation error at t = 3 if the stepsize is h = 0.00. b For the same function yt, and also for h = 0.00, find an upper bound for the global error for Euler s method at t = 3, if we assume that the Lipschitz constant is L =. You would likely get a bigger number than the local truncation error. a Since yt = 4 cos t 7t 4 3, we have y t = 4 sin t t 4 and y t = 4 cos t 4t 4. Thus, ft, y = y t = 4 sin t t 4. Euler s method w i+ = w i + hft i, w i has local truncation error τ i+ h = h y i+ y i + hft i, y i = 7 = y i+ y i h For this problem, we have τ i+ h = y i+ y i h ft i, y i. + 4 sin t i + t i 4. Local truncation error measures the accuracy of the method at a specific step, assuming that the method was exact at the previous step. It is important to note that this error depends on the differential equation, the step size, and the particular step in the approximation. We know the differential equation, i.e., we know ft, y. Hence, the local truncation error is a function of the step size h and the particular step i. The local truncation error for Euler s method is: τ i+ h = h y ξ i, for some ξ i in t i, ti +. The upper bound for the local truncation error is τ i+ h h M. At t = 3, we have y 3 = 4 cos 3 43 4 = 45.96. Hence, for h = 0.00, at t = 3 we have τ i+ h = 0.00 0.00 45.96 = 0.03. 3

b The formula for calculating the global error is located on page 37 of the textbook: yt i w i τh L elt i a, where τ i h satisfies τ i h τh. Since y t = 4 cos t 4t 4, we have which gives y t 4 cos t 4t 4 50.4 = M, τh h M = 0.00 Thus, the global error is yt i w i 0.5 50.4 = 0.5. e 3+ = 379. 4

Problem 3: Use the midpoint method to approximate the solution to the initial value problem y = + t y, t 3, y =, 8 with stepsize h = 0.5. The exact solution is yt = t +. Compare the approximate t and exact solutions. The Runge-Kutta Midpoint method for the solution of the initial value problem y = ft, y, a t b, ya = α, can be written as w i+ = w i + hf t i + h, w i + h ft i, w i, i = 0,,.... 9 0 For the initial value problem in 8, t i = + ih, i.e. t 0 =.0, t =.5, t = 3.0, and we need to take only two steps, calculating w at time t, and w at time t. We have: w 0 =, w = w 0 + hf t 0 + h, w 0 + h ft 0, w 0 = + 0.5f + 0.5, + 0.5 + 3 = + 0.5f.5,.5 4 = + 0.5 +.5.5 =.785, 5 w = w + hf t + h, w + h ft, w 6 =.785 + 0.5f.5 + 0.5,.785 + 0.5f.5,.785 7 =.785 + 0.5f.75,.785 + 0.5 +.5.785 8 =.785 + 0.5f.75,.6040 9 =.785 + 0.5 +.75.6040 0 =.455064. The exact solution gives the following values: yt =.5 =.8333 and yt = 3 =.5. Note that these results are more accurate than the results obtained with Euler s method in Homework. 5

Problem 4: Consider the initial value problem y = + y t, t, y =. The exact solution to this problem is yt = t log t + t. a If Euler s method is used to solve this problem and an accuracy of 0 4 is desired for the final value y, what stepsize h should be used approximately? b Write a code for Euler s method and use it to solve this problem using the h in part a. Plot both the numerical and exact solutions at all intermediate mesh points. c Repeat part b with midpoint method. d Repeat part c with step with stepsize h. Then use the numerical results from c and d to estimate the order p of the midpoint method. Hint: Oh p is the global error for the method when a stepsize h is used. a We will use the following formula to obtain the stepsize h: yt i w i hm [ e Lt i a ]. 3 L We first find M and L. We have y t = log t+3, and y t =. The bound M is obtained t from: y t = = M, t. Also, since ft, y = + y, we have t t f y = t = = L, t. 4 Plugging these into 3, we get 0 4 = h [ e ], h =.64 0 4. b Running the code gives: N = 859, h =.640088e 004, t =.00, w = 5.3863664e + 000, y = 5.3869436e + 000, error = 5.89875389e 005. As expected, with stepsize h =.64 0 4 from part a, we obtained the desired accuracy of 0 4. Check the plots of the exact solution and the solution obtained using Euler s method. The plots of the functions are overlaid due to sufficient accuracy. 6

c The Runge-Kutta Midpoint method for the solution of the initial value problem is y = ft, y, a t b, ya = α, w i+ = w i + hf t i + h, w i + h ft i, w i, i = 0,,.... 5 6 Running the Runge-Kutta Midpoint method program gives: N = 859, h =.640088e 004, t =.00, w = 5.386943603e + 000, y = 5.3869436e + 000, error = 8.505300e 00. Thus, RK Midpoint rule gives considerably more accurate results than Euler s method. d Running the Midpoint program gives the following results: N = 78, h = 5.80044e 005, t =.00, w = 5.386943609e+000, y = 5.3869436e+ 000, error =.065689844e 00. Order of convergence: p = log wh y exact 0 w h/ y exact log 0.0 = log 0 8.505300e 00.065689844e 00.04. log 0.0 We obtain the rd, or quadratic, order of convergence, for the second order Runge-Kutta Midpoint method, which is expected. 7