AM205: Assignment 3 (due 5 PM, October 20)

Similar documents
Numerical Analysis Preliminary Exam 10 am to 1 pm, August 20, 2018

Preliminary Examination in Numerical Analysis

Ordinary Differential Equations II

Ordinary Differential Equations II

Exam in TMA4215 December 7th 2012

Chapter 6 - Ordinary Differential Equations

Do not turn over until you are told to do so by the Invigilator.

(f(x) P 3 (x)) dx. (a) The Lagrange formula for the error is given by

LECTURE 16 GAUSS QUADRATURE In general for Newton-Cotes (equispaced interpolation points/ data points/ integration points/ nodes).

AIMS Exercise Set # 1

8.3 Numerical Quadrature, Continued

Numerical Methods for Differential Equations

CS 257: Numerical Methods

Romberg Integration and Gaussian Quadrature

Bindel, Fall 2011 Intro to Scientific Computing (CS 3220) Week 12: Monday, Apr 18. HW 7 is posted, and will be due in class on 4/25.

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

Research Computing with Python, Lecture 7, Numerical Integration and Solving Ordinary Differential Equations

Numerical Methods for Differential Equations

Lecture V: The game-engine loop & Time Integration

Logistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations

Review for Exam 2 Ben Wang and Mark Styczynski

MTH 452/552 Homework 3

KINGS COLLEGE OF ENGINEERING DEPARTMENT OF MATHEMATICS ACADEMIC YEAR / EVEN SEMESTER QUESTION BANK

Name of the Student: Unit I (Solution of Equations and Eigenvalue Problems)

Numerical Analysis II. Problem Sheet 12

Review. Numerical Methods Lecture 22. Prof. Jinbo Bi CSE, UConn

Scientific Computing: Numerical Integration

Ph 22.1 Return of the ODEs: higher-order methods

Numerical integration and differentiation. Unit IV. Numerical Integration and Differentiation. Plan of attack. Numerical integration.

Department of Applied Mathematics and Theoretical Physics. AMA 204 Numerical analysis. Exam Winter 2004

Lecture 4: Numerical solution of ordinary differential equations

Multistage Methods I: Runge-Kutta Methods

EAD 115. Numerical Solution of Engineering and Scientific Problems. David M. Rocke Department of Applied Science

Numerical Methods for the Solution of Differential Equations

Lecture IV: Time Discretization

Consistency and Convergence

CS 450 Numerical Analysis. Chapter 8: Numerical Integration and Differentiation

Lösning: Tenta Numerical Analysis för D, L. FMN011,

Ordinary differential equation II

Applied Numerical Analysis

Numerical Methods. King Saud University

CS 450 Numerical Analysis. Chapter 9: Initial Value Problems for Ordinary Differential Equations

2013/2014 SEMESTER 1 MID-TERM TEST. 1 October :30pm to 9:30pm PLEASE READ THE FOLLOWING INSTRUCTIONS CAREFULLY:

Integration, differentiation, and root finding. Phys 420/580 Lecture 7

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

Chapter 9 Implicit Methods for Linear and Nonlinear Systems of ODEs

Section 7.4 Runge-Kutta Methods

AP Calculus Testbank (Chapter 9) (Mr. Surowski)

Lecture 17: Ordinary Differential Equation II. First Order (continued)

The Direct Transcription Method For Optimal Control. Part 2: Optimal Control

TABLE OF CONTENTS INTRODUCTION, APPROXIMATION & ERRORS 1. Chapter Introduction to numerical methods 1 Multiple-choice test 7 Problem set 9

Scientific Computing: An Introductory Survey

x x2 2 + x3 3 x4 3. Use the divided-difference method to find a polynomial of least degree that fits the values shown: (b)

Final Examination. CS 205A: Mathematical Methods for Robotics, Vision, and Graphics (Fall 2013), Stanford University

An Analysis of N-Body Trajectory Propagation. Senior Project. In Partial Fulfillment. of the Requirements for the Degree

Math 660 Lecture 4: FDM for evolutionary equations: ODE solvers

Ordinary differential equations. Phys 420/580 Lecture 8

SOLUTION OF EQUATION AND EIGENVALUE PROBLEMS PART A( 2 MARKS)

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP

Preliminary Examination, Numerical Analysis, August 2016

Ordinary differential equations - Initial value problems

Physics 202 Laboratory 3. Root-Finding 1. Laboratory 3. Physics 202 Laboratory

Half of Final Exam Name: Practice Problems October 28, 2014

Numerical Integration (Quadrature) Another application for our interpolation tools!

ECE257 Numerical Methods and Scientific Computing. Ordinary Differential Equations

NUMERICAL ANALYSIS PROBLEMS

Examination paper for TMA4215 Numerical Mathematics

Astrodynamics (AERO0024)

Numerical Methods I Solving Nonlinear Equations

AP Calculus (BC) Chapter 9 Test No Calculator Section Name: Date: Period:

Numerical Algorithms for ODEs/DAEs (Transient Analysis)

Answer Key for AP Calculus AB Practice Exam, Section I

Chapter 9b: Numerical Methods for Calculus and Differential Equations. Initial-Value Problems Euler Method Time-Step Independence MATLAB ODE Solvers

Numerical Methods for Engineers. and Scientists. Applications using MATLAB. An Introduction with. Vish- Subramaniam. Third Edition. Amos Gilat.

7.2 Trapezoidal Approximation

Finite Differences for Differential Equations 28 PART II. Finite Difference Methods for Differential Equations

Differential Equations

10.34: Numerical Methods Applied to Chemical Engineering. Lecture 19: Differential Algebraic Equations

The problems that follow illustrate the methods covered in class. They are typical of the types of problems that will be on the tests.

Numerical Integration of Ordinary Differential Equations for Initial Value Problems

Differentiation and Integration

Solving systems of ODEs with Matlab

Chapter 5 Exercises. (a) Determine the best possible Lipschitz constant for this function over 2 u <. u (t) = log(u(t)), u(0) = 2.

Lecture 8: Calculus and Differential Equations

Lecture 8: Calculus and Differential Equations

MATH 1014 Tutorial Notes 8

Numerical Analysis. A Comprehensive Introduction. H. R. Schwarz University of Zürich Switzerland. with a contribution by

12.0 Properties of orthogonal polynomials

Examples of solutions to the examination in Computational Physics (FYTN03), October 24, 2016

Module 6: Implicit Runge-Kutta Methods Lecture 17: Derivation of Implicit Runge-Kutta Methods(Contd.) The Lecture Contains:

Initial Value Problems

Additional exercises with Numerieke Analyse

Do not turn over until you are told to do so by the Invigilator.

PHYS-4007/5007: Computational Physics Course Lecture Notes Appendix G

Numerical Integra/on

Linear Multistep Methods I: Adams and BDF Methods

A first order divided difference

Lecture 5: Single Step Methods

Ordinary Differential Equations

Math 113 (Calculus 2) Exam 4

Transcription:

AM25: Assignment 3 (due 5 PM, October 2) For this assignment, first complete problems 1, 2, 3, and 4, and then complete either problem 5 (on theory) or problem 6 (on an application). If you submit answers for both, then your grade will be calculated using the maximum score from the two. 1. Convergence rates of two integrals. Consider the function (a) It can be shown that 1 f (x) =. (1) 5 4 cos x I A = π/3 f (x)dx = 8π 9. (2) Write a program to numerically evaluate I A using the composite trapezoid rule with n intervals of equal size h, for n = 1, 2,..., 5, and make a log log plot of the absolute error as a function h. On the same axes, overlay the composite trapezoid error bound from the lectures, E(h) = h2 π 36 f, and show that your numerically computed results are smaller than the bound. (b) It can be shown that I B = 2π f (x)dx = 8π 3. (3) Write a program to numerically evaluate I B using the composite trapezoid rule with n equally sized intervals, for n = 1, 2,..., 5. Make a log log plot of the absolute error as a function h. Does the absolute error scale like h m for some m? (c) Optional. Use residue calculus to prove the integral in Eq. 3. 2. (a) Adaptive integration. Given that the cubic Legendre polynomial is P 3 (x) = 1 2 x(5x2 3), derive the 3-point Gauss quadrature rule on the interval [, 1] by evaluating the relevant integrals by hand. Demonstrate that this quadrature rule integrates all polynomials up to the expected degree exactly. (b) In the lectures we discussed a method of evaluating integrals b f (x)dx by adaptively refining the calculation in regions where the function varies rapidly. To begin, a tolerance level T is introduced, and the calculation starts using a single integration interval [a, b]. Let I a,b be the integral of f over this interval using the three-point quadrature rule from part (a). In addition, define c = a+b 2 and calculate Î a,b = I a,c + I c,b as a more refined estimate of the integral. Then E a,b = I a,b Î a,b is an estimate of the error of I a,b. If E a,b < Tl, where l is the length of the interval, then the error is acceptable, and the method can terminate. Otherwise this interval must be subdivided into [a, c] and [c, b], and the above procedure must be applied to these two intervals. The procedure must be applied recursively until the errors become smaller than the tolerance. Write a function to implement this adaptive integration scheme. Using T = 1 6, apply it to the integrals 5/4 (x m x 2 + 1)dx (4) a 1

for m = 4, 5, 6, 7, 8. For each case, report the value of the integral, the total estimated error (by summing the relevant E α,β terms), and the total number of intervals that are used. (c) Use your adaptive integration routine from part (a) and T = 1 6 to evaluate the three integrals 1 x dx, 2 x dx, 1 x 3/4 sin 1 x dx. For each case, report the value of the integral, the total estimated error (by summing the relevant E α,β terms), and the total number of intervals that are used. 3. Integration of a family of functions. For a given parameter φ (, 1), define a sequence of functions recursively on the interval x [ 1 2, 1 2 ] by putting f (x; φ) = x and f k (x; φ) = f k (x; φ) φ k. Let g be the limiting function, given by g(x; φ) = lim k f k (x; φ). (5) For a given φ, the function g can be numerically approximated by f n, where n is taken to be the smallest value such that φ n < 1 6. (a) Plot g(x; 1 3 ) on the interval [ 1 2, 1 2 ]. (b) Using your adaptive integration routine from question 2 and a tolerance of T = 1 6, make a plot of I(φ) = 1/2 /2 g(x; φ)dx (6) for φ (, 1). To do this, you should calculate I(φ) at 99 points φ =.1,.2,...,.99. In addition, make a plot of the number of integration intervals used as a function of φ. Approximately what range of values of φ require the most intervals? 4. Error analysis of a numerical integration rule. Applying the midpoint quadrature rule (i.e. n = Newton Cotes with the quadrature point at the midpoint) on the interval [t k, t k+1 ] to y(t k+1 ) = y(t k ) + t k+1 f (t, y(t))dt leads to the implicit midpoint method, t k where t k+1/2 = t k + h 2. y k+1 = y k + h f (t k+1/2, (y k + y k+1 )/2), (7) (a) Use Taylor series expansions to show that the order of accuracy of this method is 2. (b) What is the stability region of the method for the equation y = λy? In other words, for what values of h = hλ C is the method stable? 5. (a) A multi-step method. Consider solving the differential equation y = f (t, y) at timepoints t k with corresponding numerical solutions y k. The multi-step Nyström numerical method is based upon the integral relation tk+1 y(t k+1 ) = y(t k ) + f (t, y)dt. (8) t k 2

Derive an implicit multi-step numerical method by approximating the integrand f (t, y) with the polynomial interpolant using the function values at t k 2, t k, t k, and t k+1. Your method should have the form y k+1 = y k + h(α f k 2 + β f k + γ f k + η f k+1 ) (9) where α, β, γ, and η are constants to be determined, h is the timestep interval size, and f l = f (t l, y l ) for an arbitrary l. (b) Find the exact solution to the second-order differential equation subject to the initial conditions y() = 1, y () =. y (t) + 2y (t) + 17y(t) =. (1) (c) Write Eq. 1 as a coupled system of two first-order differential equations for y = (y, v) = (y, y ). Solve the system over the interval t 3 with a timestep of h =.2 using your multi-step method from part (a). 1 Before Eq. 9 can be applied, y 1 and y 2 must be calculated accurately. Use one of the following two approaches: i. set them based on the exact solution from part (b), ii. calculate them using the classical fourth-order Runge Kutta method. Plot the exact and numerical solutions over the range t 3. Make a log log plot of the absolute error between the numerical and exact values of y at t = 3 as a function of h, over the range from h = 1 3 to h = 1. Show that your method is fourth-order accurate. (d) Suppose that instead of setting y 1 and y 2 accurately, you instead make use of forward Euler steps. Create a log log plot of the absolute error of y at t = 3 as a function of h. Determine the order of accuracy, and discuss why this is the case. 6. Asteroid collision. An asteroid is detected near the Earth and the Moon in the plane of their orbits. Use your ODE-solving skills to determine if there is danger of collision. This problem can be treated as a circular restricted three-body problem, which considers the motion of an object of negligible mass in the presence of two massive gravitating bodies that circularly orbit each other. The motion of the object is assumed to be restricted to the 2D plane of the circular orbit of the two massive bodies. The Earth and Moon have circular orbits about each other. If we work in a co-rotating frame, we can consider the Earth and Moon to be at fixed locations and then we only need to determine the trajectory of the asteroid. In dimensionless units, fix the Earth at position (x, y) = (, ) and the Moon at position (x, y) = (1, ). The Earth has radius R Earth =.2 and the Moon has radius R Moon =.5. The asteroid (which has negligible mass) will move according to the gravitational forces it feels from the Earth and the Moon. The motion of the asteroid is described by its position 1 Even though Eq. 9 is an implicit method and would be hard to solve in general, the linearity of the system in Eq. 1 means that for this case, the update equation for y k+1 can be derived analytically. 3

x(t) = (x(t), y(t)), and velocity v(t) = (u(t), v(t)) as functions of time. Throughout the asteroid s movement, the Jacobi integral, J, is a constant of motion, and is given by J(x, y, u, v) = (x µ) 2 + y 2 + 2(1 µ) x2 + y 2 + 2µ (x 1)2 + y 2 u2 v 2 (11) where µ =.1 is the ratio of the Moon s mass to the total mass of the Earth and Moon. The asteroid s equations of motion are given by the system of ODEs, x = 1 J 2 u, y = 1 J 2 v, u = v + 1 J 2 x, v = u + 1 J 2 y. (12) (a) Write the system of ODEs to be solved in terms of x, y, u, and v. (b) In the subsequent analysis, we will need to determine if the computed asteroid trajectory intersects the Earth or Moon. To aid with this, write a program that determines whether a line segment from x = (x, y ) to x 1 = (x 1, y 1 ) intersects a circle of radius R centered at (, ). (c) Two observations of the asteroid s position have been made: x obs () = (1.798, ), x obs (.2) = (1.82,.189). (13) However, there is some uncertainty in these observations. The true position x(t) is given by x(t) = x obs (t) + (E x, E y ) where for each separate observation, E x and E y are independent normal random variables with mean zero and standard deviation.2. Assuming that the asteroid trajectory is linear between t = and t =.2, calculate v() in terms of x() and x(.2). Using your favorite ODE solver, 2 integrate the system from part (a) over the range t 1, for ten initial conditions for x() and v(), sampled according to the procedure described above. Make a figure showing the Earth and Moon as circles with the given radii, and the ten computed trajectories overlaid. Use axis ranges of.4 x 2 and.2 y 1.2. (d) Now simulate 2,5 or more trajectories over the range t 1 using initial conditions from part (c). For each trajectory, determine whether i. it first collides with the Moon, ii. it first collides with the Earth, iii. it collides with neither. To determine collisions for a given trajectory, take the numerically computed asteroid positions x, x 1,..., and use your program from part (b) to find whether each line segment from x k to x k+1 intersects with either the Moon or Earth. Based on the trajectories, calculate the probability that asteroid will collide with the Moon, and the probability that the asteroid will collide with the Earth. Plot one or more trajectories that collide with the Earth, and one or more that collide with the Moon. 2 In Python, a good choice would be the odeint routine. In MATLAB, the ode45 routine could be used, using the additional command odeset( RelTol,1e-1, AbsTol,1e-1) to improve accuracy. 4

(e) Optional. If this ODE system were solved exactly, the Jacobi integral would be exactly constant as a function of time, since it is a conserved quantity of the system. We can therefore use the value of the Jacobi integral to check the robustness of our numerical approximation. For the initial conditions x() = (1.8, ) and v() = (,.49), plot the relative error in the Jacobi integral, J(t) J() /J(), for t [, 1] and explain what you observe. (f) Optional. Find trajectories over the interval t 2 that neither undergo a collision, nor escape the Earth Moon system. You should find several different types of trajectory. Estimate the probability of each type occurring. (g) Optional. In part (c), we assumed that the trajectory was linear from t = to t =.2, but it will actually follow a curved path due to the gravitational interaction. Improve your analysis in part (d) to handle this, and determine the alteration in the collision probabilities. 5