Application 7.6A The Runge-Kutta Method for 2-Dimensional Systems

Similar documents
Application 2.4 Implementing Euler's Method

Math 126 Final Examination Autumn CHECK that your exam contains 9 problems on 10 pages.

4 Visualization and. Approximation

Workpackage 5 - Ordinary Differential Equations

Contents 10. Graphs of Trigonometric Functions

Goals: Course Unit: Describing Moving Objects Different Ways of Representing Functions Vector-valued Functions, or Parametric Curves

Module1: Numerical Solution of Ordinary Differential Equations. Lecture 6. Higher order Runge Kutta Methods

Contents 10. Graphs of Trigonometric Functions

Precalculus 2 Section 10.6 Parametric Equations

MA 243 Calculus III Fall Assignment 1. Reading assignments are found in James Stewart s Calculus (Early Transcendentals)

Trigonometric Functions of Any Angle

ChE 400: Applied Chemical Engineering Calculations Tutorial 6: Numerical Solution of ODE Using Excel and Matlab

Math 126 Winter CHECK that your exam contains 8 problems.

You ll use the six trigonometric functions of an angle to do this. In some cases, you will be able to use properties of the = 46

MAT 275 Laboratory 3 Numerical Solutions by Euler and Improved Euler Methods (scalar equations)

Math 5BI: Problem Set 2 The Chain Rule

Approximate First and Second Derivatives

PRECALCULUS MATH Trigonometry 9-12

Math 124 Final Examination Autumn Turn off all cell phones, pagers, radios, mp3 players, and other similar devices.

Checkpoint 1 Define Trig Functions Solve each right triangle by finding all missing sides and angles, round to four decimal places

Topic 5.1: Line Elements and Scalar Line Integrals. Textbook: Section 16.2

SENIOR HIGH MATH LEAGUE April 24, GROUP IV Emphasis on TRIGONOMETRY

International Conference Las Vegas, NV, USA March 7-9, 2014

Practice problems from old exams for math 233

Mathematics for chemical engineers

Since a projectile moves in 2-dimensions, it therefore has 2 components just like a resultant vector: Horizontal Vertical

MA 114 Worksheet #17: Average value of a function

x=2 26. y 3x Use calculus to find the area of the triangle with the given vertices. y sin x cos 2x dx 31. y sx 2 x dx

You ll use the six trigonometric functions of an angle to do this. In some cases, you will be able to use properties of the = 46

Introduction to Simulink

Calculators ARE NOT Permitted On This Portion Of The Exam 28 Questions - 55 Minutes

Matlab Tutorial. Get familiar with MATLAB by using tutorials and demos found in MATLAB. You can click Start MATLAB Demos to start the help screen.

Unit 6: Triangle Geometry

over The idea is to construct an algorithm to solve the IVP ODE (8.1)

Introduction to Scientific Computing Lecture 8

Inverses of Trigonometric. Who uses this? Hikers can use inverse trigonometric functions to navigate in the wilderness. (See Example 3.

f( x ), or a solution to the equation f( x) 0. You are already familiar with ways of solving

Find the component form and magnitude of the vector where P = (-3,4), Q = (-5, 2), R = (-1, 3) and S = (4, 7)

MAT 275 Laboratory 3 Numerical Solutions by Euler and Improved Euler Methods (scalar equations)

Ch 7 & 8 Exam Review. Note: This is only a sample. Anything covered in class or homework may appear on the exam.

During the timed portion for Part A, you may work only on the problems in Part A.

MAT 271 Recitation. MAT 271 Recitation. Sections 10.1,10.2. Lindsey K. Gamard, ASU SoMSS. 22 November 2013

(Part - 1) P. Sam Johnson. April 14, Numerical Solution of. Ordinary Differential Equations. (Part - 1) Sam Johnson. NIT Karnataka.

Practice problems from old exams for math 233 William H. Meeks III December 21, 2009

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

Algebra 1 Fall Final Review Answers

You are not expected to transform y = tan(x) or solve problems that involve the tangent function.

LAB #8 Numerical Methods

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

Updated: August 24, 2016 Calculus III Section Math 232. Calculus III. Brian Veitch Fall 2015 Northern Illinois University

Semester 2 Review Problems will be sectioned by chapters. The chapters will be in the order by which we covered them.

1. Be sure to complete the exploration before working on the rest of this worksheet.

Year 10 Term 3 Homework

Polar (BC Only) They are necessary to find the derivative of a polar curve in x- and y-coordinates. The derivative

: Find the values of the six trigonometric functions for θ. Special Right Triangles:

Math Exam 2a. 1) Take the derivatives of the following. DO NOT SIMPLIFY! 2 c) y = tan(sec2 x) ) b) y= , for x 2.

Semester 2 Review Problems will be sectioned by chapters. The chapters will be in the order by which we covered them.

Mars Pinpoint Landing Trajectory Optimization Using Sequential Multiresolution Technique

MATLAB/Octave Tutorial

Secondary Math 3- Honors. 7-4 Inverse Trigonometric Functions

Problem #3 Daily Lessons and Assessments for AP* Calculus AB, A Complete Course Page Mark Sparks 2012

SHORT ANSWER. Write the word or phrase that best completes each statement or answers the question.

A Brief Introduction to Mathematica

Part I. There are 5 problems in Part I, each worth 5 points. No partial credit will be given, so be careful. Circle the correct answer.

USING TEMATH S VISUALIZATION TOOLS IN CALCULUS 1

Trigonometry Final Review Exercises

Zero Launch Angle. since θ=0, then v oy =0 and v ox = v o. The time required to reach the water. independent of v o!!

Lab 3: Acceleration of Gravity

(Type your answer in radians. Round to the nearest hundredth as needed.)

3. The three points (2, 4, 1), (1, 2, 2) and (5, 2, 2) determine a plane. Which of the following points is in that plane?

EE 301 Signals & Systems I MATLAB Tutorial with Questions

Computational Methods of Scientific Programming

Section 7.1. Standard position- the vertex of the ray is at the origin and the initial side lies along the positive x-axis.

Name: Period: Final Exam Review

Name Period. (b) Now measure the distances from each student to the starting point. Write those 3 distances here. (diagonal part) R measured =

Week 8 Problems. #2 Points possible: 1. Total attempts: 2 Enter your answer rounded to two decimal places.

ENCM 339 Fall 2017 Lecture Section 01 Lab 9 for the Week of November 20

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

Lesson 5.6: Angles in Standard Position

8 Piecewise Polynomial Interpolation

10.2 Calculus with Parametric Curves

MATH 1112 Trigonometry Final Exam Review

9 Find the area of the figure. Round to the. 11 Find the area of the figure. Round to the

MATH 104 Sample problems for first exam - Fall MATH 104 First Midterm Exam - Fall (d) 256 3

4. Describe the correlation shown by the scatter plot. 8. Find the distance between the lines with the equations and.

Lecture 15. Lecturer: Prof. Sergei Fedotov Calculus and Vectors. Length of a Curve and Parametric Equations

Name: Block: What I can do for this unit:

PART I You must complete this portion of the test without using a calculator. After you

11/3/2011. What You ll See in This Chapter. Word Cloud. How Much Calculus is Needed? A Modest Proposal. Ian Parberry University of North Texas

1) The domain of y = sin-1x is The range of y = sin-1x is. 2) The domain of y = cos-1x is The range of y = cos-1x is

Youngstown State University Trigonometry Final Exam Review (Math 1511)

EE 301 Lab 1 Introduction to MATLAB

Study Guide and Review - Chapter 10

Math 11 Fall 2016 Section 1 Monday, October 17, 2016

Study Guide and Review - Chapter 10

Catholic Central High School

The Chase Problem (Part 1) David C. Arney

A. Incorrect! You rounded to the nearest ten instead of the nearest tenth. B. Incorrect! Review how to round decimal numbers and try again.

10-1. Three Trigonometric Functions. Vocabulary. Lesson

A Quick Review of Trigonometry

Transcription:

Application 7.6A The Runge-Kutta Method for -Dimensional Systems Figure 7.6. in the text lists TI-85 and BASIC versions of the program RKDIM that implements the Runge-Kutta iteration k (,, ) = f tn xn yn l (,, ) = g tn xn yn k = f( t + h, x + hk, y + hl ) n n n l = g( t + h, x + h k, y + hl ) n n n k = f( t + h, x + h k, y + hl ) 3 n n n l = g( t + h, x + h k, y + hl ) 3 n n n k = f( t + h, x + h k, y + hl ) () 4 n n 3 n 3 l = f( t + h, x + h k, y + hl ) 4 n n 3 n 3 k = k + k + k + k, ( 3 4) ( ) 6 l = l+ l + l3+ l4 6 x = n x + + n hk y y hl = + n+ n t t h = + n+ n for the two dimensional system x = y = f(, t x, y), g(, t x, y) () You should note that RKDIM closely parallels the one-dimensional Runge-Kutta program listed in Fig..6., with a single line to calculate one value or slope there replaced (where appropriate) with two lines here to calculate a pair of x- and y-values or slopes. Note also that the notation used is essentially that of Equations (3) and (4) in Section 7.6. The sections below illustrate the use of Maple, Mathematica, and MATLAB to implement the Runge-Kutta iteration in (), and apply it to the initial value problem x = π y, x (0) = y = π x, y (0) = 0 (3) Application 7.6A 45

whose exact solution is given by x() t = cos( π t), yt () = sin( π t). This exercise should prepare you for the following investigations. Investigation A Let a be the largest and b the smallest nonzero digit of your student ID number. Then use the Runge-Kutta method to approximate the solution of the initial value problem defined by x = ay, y = b x with x(0) being the next smallest digit and y(0) the next largest digit of your ID. Also use your system's "dsolve" function to find the exact symbolic solution. Finally, compare your approximate solution points with the corresponding exact solution points. Investigation B Suppose that you jump from an airplane at an initial altitude of 0,000 ft, and that your downward position x() t and velocity yt () (in ft/sec after t seconds) satisfy the initial value problem x = y, x (0) = 0 ( W / g) y = W (0.005)(00 y+ y ), y (0) = 0 where W denotes your weight in pounds and g = 3 ft/sec. Use the Runge-Kutta method to solve numerically for x() t and yt () during your first 5 to 0 seconds of free fall, with successive step sizes h and h/ small enough to get results consistent to decimal places. How far have you free-fallen after 0 seconds? After 0 seconds? Use your results (for the first 0 seconds) to determine the total time required for your descent to the ground. Investigation C Your spacecraft is traveling at constant velocity V, approaching a distant earth-like planet with mass M and radius R. When activated, your deceleration system provides a constant thrust T until impact with the planet's surface. During the deceleration period, your distance x(t) from the planet's center satisfies the differential equation d x = T dt GM x where G 6.676 0 N (m/kg) is the usual gravitational constant. Your question is At what altitude above the planet's surface should your deceleration system be activated in order to achieve a soft touchdown? For a reasonable problem, you can take 46 Chapter 7

M = 5.97 0 4 kg R = 6.38 0 6 m V = p 0 4 km/hr T = g + q m/s, where g = GM/R is the planet's surface gravitational acceleration, while p is the smallest nonzero digit and q the next-smallest digit in your student ID number. Find the "ignition altitude" accurate to the nearest meter, and the resulting "descent time" accurate to the nearest tenth of a second. Using Maple To apply the Runge-Kutta method to the initial value problem in (3), we let Digits := 6: pi := evalf(pi) # numerical value of Pi and define the right-hand side functions in our two differential equations: f := (t,x,y) -> -pi*y: g := (t,x,y) -> pi*x: Suppose that we want to approximate the solution functions x = cos( πt) and y= sin( π t) on the interval [0, /] corresponding to angular arguments between 0 and π/. To approximate the solution with initial values x( t0) = x0, yt ( 0) = y0 on the interval [ t0, t f ], we enter first the initial values (and final t-value) t0 := 0: x0 := : y0 := 0: tf := 0.5: and then the desired number n of steps, the interval at which we want to print results, and the resulting step size h. n := : # number of subintervals m := : # to print every mth step h := evalf((tf - t0)/n): # step size After we initialize the values of t, x, and y, t := t0: x := x0: y := y0: Application 7.6A 47

the Runge-Kutta method is implemented by the for loop below, which carries out the iteration in () n times in successtion to take n steps across the interval from t = t 0 to t = t f. It simplies the printing to define in advance the "formatting string" fmt := `%0.0f %0.4f %0.4f \n`: where the notation %w.df specifies printing the corresponding value in a "field" w spaces wide and with d decimal places. Then Runge-Kutta loop is then for i from to n do k := f(t,x,y): l := g(t,x,y): # left-hand slopes k := f(t+h/,x+h*k/,y+h*l/): l := g(t+h/,x+h*k/,y+h*l/): # st midpt slopes k3 := f(t+h/,x+h*k/,y+h*l/): l3 := g(t+h/,x+h*k/,y+h*l/): # nd midpt slopes k4 := f(t+h,x+h*k3,y+h*l3): l4 := g(t+h,x+h*k3,y+h*l3): # right-hand slopes k := (k+*k+*k3+k4)/6: # average x-slope l := (l+*l+*l3+l4)/6: # average y-slope x := x + h*k: # update x y := y + h*l: # update y t := t + h: # update t if trunc(i/m) =i/m then # display each printf(fmt,80*t,x,y) fi; # mth value od: 5.9659.588 30.8660.5000 45.707.707 60.5000.8660 75.588.9659 90.0000.0000 Note that we have arranged to print angles in degrees in the first column of output. The second and third columns give the corresponding approximate values of the cosine and sine functions. Noting the familiar values cos60 = sin30 =, cos 30 = sin 60 = 3 0.8660, and cos 45 = sin 45 = 0.707, we see that the Runge-Kutta method with only n = subintervals has provided 4 decimal places of accuracy on the whole range from 0 o to 90 o. If only the final endpoint result is wanted explicitly, then the print command can be removed from the loop and executed immediately following it (just as we did with the Euler loop in Application.4). For a different initial value problem, we need only enter the appropriate functions f ( xy, ) and g( xy, ) for our new differential equations and 48 Chapter 7

the desired initial and final values in the initial commands above, then re-execute the subsequent ones. Using Mathematica To apply the Runge-Kutta method to the initial value problem in (3), we let pi = N[Pi]; (* numerical value of Pi *) and define the right-hand side functions in our two differential equations: f[t_,x_,y_] := -pi*y g[t_,x_,y_] := pi*x Suppose that we want to approximate the solution functions x = cos( π t) and y= sin( π t) on the interval [0, /] corresponding to angular arguments between 0 and π/. To approximate the solution with initial values x( t0) = x0, yt ( 0) = y0 on the interval [ t0, t f ], we enter first the initial values (and final t-value) t0 = 0; x0 = ; y0 = 0; tf = 0.5; and then the desired number n of steps, the interval at which we want to print results, and the resulting step size h. n = ; (* number of subintervals *) m = ; (* to print every mth step *) h = (tf - t0)/n; (* step size *) After we initialize the values of t, x, and y, t = t0; x = x0; y = y0; the Runge-Kutta method itself is implemented by the Do loop below, which carries out the iteration in () n times in successtion to take n steps across the interval from t = t 0 to t = t f. Do[ k = f[t,x,y]; l = g[t,x,y]; (* left-hand slopes *) k = f[t+h/,x+h*k/,y+h*l/]; l = g[t+h/,x+h*k/,y+h*l/];(* st midpt slopes *) k3 = f[t+h/,x+h*k/,y+h*l/]; l3 = g[t+h/,x+h*k/,y+h*l/];(* nd midpt slopes *) k4 = f[t+h,x+h*k3,y+h*l3]; l4 = g[t+h,x+h*k3,y+h*l3]; (* right-hand slopes *) Application 7.6A 49

k = (k+*k+*k3+k4)/6; (* average x-slope *) l = (l+*l+*l3+l4)/6; (* average y-slope *) x = x + h*k; (* update x *) y = y + h*l; (* update y *) t = t + h; (* update t *) If[ Floor[i/m] == i/m, Print[80*t,PaddedForm[x,{0,4}], PaddedForm[y,{0,4}]]], (* display each mth value *) {i,,n} ] 5. 0.9659 0.588 30. 0.8660 0.5000 45. 0.707 0.707 60. 0.5000 0.8660 75. 0.588 0.9659 90. 0.0000.0000 Note that we have arranged to print angles in degrees in the first column of output. The second and third columns give the corresponding approximate values of the cosine and sine functions. The PaddedForm[x,{0,4}] specification formats a result by printing it in a "field" 0 spaces wide and with 4 decimal places. Noting the familiar values cos60 = sin30 =, cos 30 = sin 60 = 3 0.8660, and cos 45 = sin 45 = 0.707, we see that the Runge-Kutta method with only n = subintervals has provided 4 decimal places of accuracy on the whole range from 0 o to 90 o. If only the final endpoint result is wanted explicitly, then the print command can be removed from the loop and executed immediately following it (just as we did with the Euler loop in Application.4). For a different initial value problem, we need only enter the appropriate functions f ( xy, ) and g( xy, ) for our new differential equations and the desired initial and final values in the initial commands above, then re-execute the subsequent ones. Using MATLAB To apply the Runge-Kutta method to the initial value problem in (3), we begin by defining the right-hand side functions f (, txy, ) and g(, txy, ) in our two differential equations: f = inline('-pi*y','t','x','y'); g = inline('pi*x','t','x','y'); 50 Chapter 7

Suppose that we want to approximate the solution functions x = cos( π t) and y= sin( π t) on the interval [0, /] corresponding to angular arguments between 0 and π/. To approximate the solution with initial values x( t0) = x0, yt ( 0) = y0 on the interval [ t0, t f ], we enter first the initial values (and final t-value) t0 = 0; x0 = ; y0 = 0; tf = 0.5; and then the desired number n of steps, the interval at which we want to print results, and the resulting step size h. n = ; % number of subintervals m = ; % to print every mth step h = (tf - t0)/n; % step size After we initialize the values of t, x, and y, t = t0; x = x0; y = y0; and the first line of our desired table of values, result = [t0,x0,y0]; result = 0 0 the Runge-Kutta method itself is implemented by the for loop below, which carries out the iteration in () n times in successtion to take n steps across the interval from t = t 0 to t = t f. for i = :n, k = f(t,x,y); l = g(t,x,y); % left-hand slopes k = f(t+h/,x+h*k/,y+h*l/); l = g(t+h/,x+h*k/,y+h*l/); % st midpt slopes k3 = f(t+h/,x+h*k/,y+h*l/); l3 = g(t+h/,x+h*k/,y+h*l/); % nd midpt slopes k4 = f(t+h,x+h*k3,y+h*l3); l4 = g(t+h,x+h*k3,y+h*l3); % right-hand slopes k = (k+*k+*k3+k4)/6; % average x-slope l = (l+*l+*l3+l4)/6; % average y-slope x = x + h*k; % Euler step to update x y = y + h*l; % Euler step to update y Application 7.6A 5

Then the command t = t + h; % update t if floor(i/m) == i/m, result = [result;[80*t,x,y]]; end % adjoin new row of data end result result = 0.0000 0 5.0000 0.9659 0.588 30.0000 0.8660 0.5000 45.0000 0.707 0.707 60.0000 0.5000 0.8660 75.0000 0.588 0.9659 90.0000 0.0000.0000 displays our table of Runge-Kutta results. Note that we have arranged to print angles in degrees in the first column of output. The second and third columns give the corresponding approximate values of the cosine and sine functions. Noting the familiar values cos60 = sin30 =, cos 30 = sin 60 = 3 0.8660, and cos 45 = sin 45 = 0.707, we see that the Runge-Kutta method with only n = subintervals has provided 4 decimal places of accuracy on the whole range from 0 o to 90 o. For a different initial value problem, we need only re-define the functions f ( xy, ) and g( xy, ) corresponding to our new differential equations and the desired initial and final values in the initial commands above, then re-execute the subsequent ones. 5 Chapter 7