Euler s method for solving a differential equation (approximately)

Similar documents
Numerical Solution of Differential Equations

5.5. The Substitution Rule

Predicting the future with Newton s Second Law

Unit #16 : Differential Equations

Identifying the Graphs of Polynomial Functions

Linear Second-Order Differential Equations LINEAR SECOND-ORDER DIFFERENTIAL EQUATIONS

Numerical method for approximating the solution of an IVP. Euler Algorithm (the simplest approximation method)

INHOMOGENEOUS LINEAR SYSTEMS OF DIFFERENTIAL EQUATIONS

Algebra 1B notes and problems March 12, 2009 Factoring page 1

This lecture is a review for the exam. The majority of the exam is on what we ve learned about rectangular matrices.

Mathematical Induction Again

Mathematical Induction Again

Chapter 4. A simple method for solving first order equations numerically

Business Statistics. Lecture 9: Simple Regression

A quadratic expression is a mathematical expression that can be written in the form 2

Definition: A "system" of equations is a set or collection of equations that you deal with all together at once.

Earthquake Model Investigations

22 Approximations - the method of least squares (1)

Partial Fractions. (Do you see how to work it out? Substitute u = ax + b, so du = a dx.) For example, 1 dx = ln x 7 + C, x x (x 3)(x + 1) = a

MAT 311 Midterm #1 Show your work! 1. The existence and uniqueness theorem says that, given a point (x 0, y 0 ) the ODE. y = (1 x 2 y 2 ) 1/3

The Derivative of a Function

PHYSICS 211 LAB #8: Periodic Motion

Polynomial Models Studio Excel 2007 for Windows Instructions

Multiple Choice Review Problems

Coordinate Systems. S. F. Ellermeyer. July 10, 2009

Section 9.8. First let s get some practice with determining the interval of convergence of power series.

Coordinate Systems. Recall that a basis for a vector space, V, is a set of vectors in V that is linearly independent and spans V.

CHAPTER 3 : MATHEMATICAL MODELLING PRINCIPLES

3 COMPLEX NUMBERS. 3.0 Introduction. Objectives

Partial Fractions. June 27, In this section, we will learn to integrate another class of functions: the rational functions.

POD. A) Graph: y = 2e x +2 B) Evaluate: (e 2x e x ) 2 2e -x. e 7x 2

Numerical method for approximating the solution of an IVP. Euler Algorithm (the simplest approximation method)

Physics 351 Monday, April 23, 2018

Polynomials Patterns Task

Problem Sheet 0: Numerical integration and Euler s method. If you find any typos/errors in this problem sheet please

Examples from Section 6.3: Volume by Cylindrical Shells Page 1

Solving Linear Equations (in one variable)

APPLICATIONS OF DIFFERENTIATION

MA 1128: Lecture 08 03/02/2018. Linear Equations from Graphs And Linear Inequalities

Math 5a Reading Assignments for Sections

Sampling Distributions of the Sample Mean Pocket Pennies

2.2 Average vs. Instantaneous Description

Activity 3.2: What holds the atoms of a molecule together?

CHAPTER 6 VECTOR CALCULUS. We ve spent a lot of time so far just looking at all the different ways you can graph

Math Real Analysis II

Infinite Limits. By Tuesday J. Johnson

Introduction to Optimization

Introduction to Algebra: The First Week

Slope Fields and Differential Equations. Copyright Cengage Learning. All rights reserved.

DIFFERENTIATION RULES

Using the Derivative. Chapter Local Max and Mins. Definition. Let x = c be in the domain of f(x).

DIFFERENTIAL EQUATIONS

Math Calculus I

Lesson 4. Is it a proportion?

Successful completion of the core function transformations unit. Algebra manipulation skills with squares and square roots.

a n b n ) n N is convergent with b n is convergent.

Note: Final Exam is at 10:45 on Tuesday, 5/3/11 (This is the Final Exam time reserved for our labs). From Practice Test I

Particle Systems. University of Texas at Austin CS384G - Computer Graphics

dx dt = x 2 x = 120

Coordinate systems and vectors in three spatial dimensions

Physics 132 3/31/17. March 31, 2017 Physics 132 Prof. E. F. Redish Theme Music: Benny Goodman. Swing, Swing, Swing. Cartoon: Bill Watterson

Section 2.1 Differential Equation and Solutions

Solving Polynomial and Rational Inequalities Algebraically. Approximating Solutions to Inequalities Graphically

The AP exams will ask you to find derivatives using the various techniques and rules including

AP Calculus Worksheet: Chapter 2 Review Part I

2 Discrete Dynamical Systems (DDS)

X. Numerical Methods

Introduction to Differential Equations

ACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS 1 MATH00030 SEMESTER / Lines and Their Equations

Distance and Velocity

MATH 280 Multivariate Calculus Fall 2012

Math 5311 Constrained Optimization Notes

An Introduction to Partial Differential Equations

Subsequences and Limsups. Some sequences of numbers converge to limits, and some do not. For instance,

Exploring Substitution

Math 2250 Lab 3 Due Date : 2/2/2017

Lecture 9: Taylor Series

Lab #2 - Two Degrees-of-Freedom Oscillator

MATH The Derivative as a Function - Section 3.2. The derivative of f is the function. f x h f x. f x lim

Linear Systems of ODE: Nullclines, Eigenvector lines and trajectories

Shifting Reactions B

Introduction Derivation General formula List of series Convergence Applications Test SERIES 4 INU0114/514 (MATHS 1)

Location Latitude Longitude Durham, NH

It is difficult to overestimate the power of the equation

What do derivatives tell us about functions?

Numerical Solutions to PDE s

Lecture 5 - Logarithms, Slope of a Function, Derivatives

3 Algebraic Methods. we can differentiate both sides implicitly to obtain a differential equation involving x and y:

APPM 2360: Midterm exam 1 February 15, 2017

Calculus with business applications, Lehigh U, Lecture 03 notes Summer

Math 1241, Spring 2014 Section 3.3. Rates of Change Average vs. Instantaneous Rates

Chapter 3 Acceleration

CS173 Strong Induction and Functions. Tandy Warnow

Math Lab 10: Differential Equations and Direction Fields Complete before class Wed. Feb. 28; Due noon Thu. Mar. 1 in class

Linear Systems of ODE: Nullclines, Eigenvector lines and trajectories

y 2y = 4 x, Name Form Solution method

The Definite Integral. Day 6 Motion Problems Strategies for Finding Total Area

SPH4U1 Lesson 02 Measurement & Graphing

Intermediate Tier - Algebra revision

Derivatives: Gradient of a line, gradient of a curve

Transcription:

Euler s method for solving a differential equation (approximately) Department of Mathematics, UW - Madison March 4, 2013

A chemical reaction A B A B A A A chemical reactor contains two kinds of molecules, A and B

A chemical reaction A B A B A A A chemical reactor contains two kinds of molecules, A and B Whenever an A and B molecule bump into each other the B turns into an A: A + B 2A

A chemical reaction A B A B A A A chemical reactor contains two kinds of molecules, A and B Whenever an A and B molecule bump into each other the B turns into an A: A + B 2A As the reaction proceeds, all B gets converted to A How long does this take?

Reaction rate for A+B 2A The total number of molecules (A and B) stays constant

Reaction rate for A+B 2A The total number of molecules (A and B) stays constant Let s call x(t) the fraction of all molecules that at time t are of type A: amount of A x(t) = amount of A + amount of B

Reaction rate for A+B 2A The total number of molecules (A and B) stays constant Let s call x(t) the fraction of all molecules that at time t are of type A: amount of A x(t) = amount of A + amount of B Then 0 x(t) 1, and the fraction of all molecules in the reactor which (at time t) are of type B is 1 x(t)

Reaction rate for A+B 2A The total number of molecules (A and B) stays constant Let s call x(t) the fraction of all molecules that at time t are of type A: amount of A x(t) = amount of A + amount of B Then 0 x(t) 1, and the fraction of all molecules in the reactor which (at time t) are of type B is 1 x(t) Every time a reaction takes place, the ratio x(t) increases, so dx is proportional to the reaction rate

Reaction rate for A+B 2A Chemistry tells us that dx = K amount of A amount of B = Kx(1 x)

Reaction rate for A+B 2A Chemistry tells us that dx = K amount of A amount of B = Kx(1 x) K is a proportionality constant, which depends on the particular kind of molecules A and B in this reaction You would have to measure it to find its value

Reaction rate for A+B 2A Chemistry tells us that dx = K amount of A amount of B = Kx(1 x) K is a proportionality constant, which depends on the particular kind of molecules A and B in this reaction You would have to measure it to find its valuethis is a calculus class, so let s assume K = 1

Solving dx = x(1 x) We have to solve the diffeq dx = x(1 x) The solution will have an arbitrary constant ( C ) If we know what x(0) is then we can compute C

Solving dx = x(1 x) We have to solve the diffeq dx = x(1 x) The solution will have an arbitrary constant ( C ) If we know what x(0) is then we can compute C So (as an example) let s try to solve the following problem:

Solving dx = x(1 x) We have to solve the diffeq dx = x(1 x) The solution will have an arbitrary constant ( C ) If we know what x(0) is then we can compute C So (as an example) let s try to solve the following problem: Suppose the tank initially holds 2% A and 98% B,

Solving dx = x(1 x) We have to solve the diffeq dx = x(1 x) The solution will have an arbitrary constant ( C ) If we know what x(0) is then we can compute C So (as an example) let s try to solve the following problem: Suppose the tank initially holds 2% A and 98% B, x(0) = 002

Solving dx = x(1 x) We have to solve the diffeq dx = x(1 x) The solution will have an arbitrary constant ( C ) If we know what x(0) is then we can compute C So (as an example) let s try to solve the following problem: Suppose the tank initially holds 2% A and 98% B, x(0) = 002 Then what is the fraction of A molecules at time t?

Solving dx = x(1 x) We have to solve the diffeq dx = x(1 x) The solution will have an arbitrary constant ( C ) If we know what x(0) is then we can compute C So (as an example) let s try to solve the following problem: Suppose the tank initially holds 2% A and 98% B, x(0) = 002 Then what is the fraction of A molecules at time t? x(t) =?

Summary of the problem We are going to solve an initial value problem:

Summary of the problem We are going to solve an initial value problem: Find x(t) if you know dx = x(1 x) } {{} diffeq, holds for t>0 and x(0) = 002 }{{} initial value

Summary of the problem We are going to solve an initial value problem: Find x(t) if you know dx = x(1 x) } {{} diffeq, holds for t>0 and x(0) = 002 }{{} initial value The solution is x(t) = (to be explained later this hour) 1 1 + 49e t

Leonhard e πi + 1 = 0 Euler (1707-1783)

Solving dx = x(1 x) Euler s idea:

Solving dx = x(1 x) Euler s idea: I can t solve the equation because I don t know what dx pick a small number h > 0 and say that is So dx x(t + h) x(t) h

Solving dx = x(1 x) Euler s idea: I can t solve the equation because I don t know what dx pick a small number h > 0 and say that is So dx The diffeq then becomes x(t + h) x(t) h x(t + h) x(t) h x(t)(1 x(t))

Solving dx = x(1 x) Euler s idea: I can t solve the equation because I don t know what dx pick a small number h > 0 and say that is So dx The diffeq then becomes x(t + h) x(t) h x(t + h) x(t) h x(t)(1 x(t)) If you know x(t) and h then you can solve this equation for x(t + h)

Solving dx = x(1 x) has as solution x(t + h) x(t) h x(t)(1 x(t)) x(t + h) x(t) + h x(t)(1 x(t))

Solving dx = x(1 x) has as solution x(t + h) x(t) h x(t)(1 x(t)) x(t + h) x(t) + h x(t)(1 x(t)) Example (t = 0): If we know x(0), then this equation allows us to compute x(0 + h) = x(h)

Solving dx = x(1 x) has as solution x(t + h) x(t) h x(t)(1 x(t)) x(t + h) x(t) + h x(t)(1 x(t)) Example (t = 0): If we know x(0), then this equation allows us to compute x(0 + h) = x(h) Example (t = h): Knowing x(h) you can find x(h + h) = x(2h)

Solving dx = x(1 x) has as solution x(t + h) x(t) h x(t)(1 x(t)) x(t + h) x(t) + h x(t)(1 x(t)) Example (t = 0): If we know x(0), then this equation allows us to compute x(0 + h) = x(h) Example (t = h): Knowing x(h) you can find x(h + h) = x(2h), And then x(2h + h) = x(3h),

Solving dx = x(1 x) has as solution x(t + h) x(t) h x(t)(1 x(t)) x(t + h) x(t) + h x(t)(1 x(t)) Example (t = 0): If we know x(0), then this equation allows us to compute x(0 + h) = x(h) Example (t = h): Knowing x(h) you can find x(h + h) = x(2h), And then x(2h + h) = x(3h), x(3h + h) = x(4h), etc

Euler s (approximate) solution Pick a small number h > 0, and compute x(h) = x(0) + h x(0)[1 x(0)]

Euler s (approximate) solution Pick a small number h > 0, and compute x(h) = x(0) + h x(0)[1 x(0)] x(2h) = x(h) + h x(h)[1 x(h)]

Euler s (approximate) solution Pick a small number h > 0, and compute x(h) = x(0) + h x(0)[1 x(0)] x(2h) = x(h) + h x(h)[1 x(h)] x(3h) = x(2h) + h x(2h)[1 x(2h)]

Euler s (approximate) solution Pick a small number h > 0, and compute x(h) = x(0) + h x(0)[1 x(0)] x(2h) = x(h) + h x(h)[1 x(h)] x(3h) = x(2h) + h x(2h)[1 x(2h)] x(4h) = x(3h) + h x(3h)[1 x(3h)]

Euler s (approximate) solution Pick a small number h > 0, and compute x(h) = x(0) + h x(0)[1 x(0)] x(2h) = x(h) + h x(h)[1 x(h)] x(3h) = x(2h) + h x(2h)[1 x(2h)] x(4h) = x(3h) + h x(3h)[1 x(3h)]

Euler s (approximate) solution Pick a small number h > 0, and compute x(h) = x(0) + h x(0)[1 x(0)] x(2h) = x(h) + h x(h)[1 x(h)] x(3h) = x(2h) + h x(2h)[1 x(2h)] x(4h) = x(3h) + h x(3h)[1 x(3h)] Now let s choose h = 02 and x(0) = 002, and compute x(02), x(04), x(06), x(08), x(10),

Doing the calculations Doing all these calculations is a drag of course How did Euler do this? By hand!! (and with a lot of patience)

Doing the calculations Doing all these calculations is a drag of course How did Euler do this? By hand!! (and with a lot of patience) How do we do this in the 21st century? With a computer

Doing the calculations Doing all these calculations is a drag of course How did Euler do this? By hand!! (and with a lot of patience) How do we do this in the 21st century? With a computer For more complicated diffeqs one should learn to program a computer, but for the example we ve been looking at you can get Excel (or some other spreadsheet program like Open Office) to compute and plot the solutions

What the spreadsheet computed Here are the numbers, and graphs The exact solution is x(t) = 1/(1 + 49e t ) Solving x'=x(1-x) by Euler's method h t x(t) x'(t) exact solution 02 0 0020000 0019600 0020000 02 02 0023920 0023348 0024320 02 04 0028590 0027772 0029546 02 06 0034144 0032978 0035853 02 08 0040740 0039080 0043446 02 1 0048556 0046198 0052559 02 12 0057795 0054455 0063458 02 14 0068686 0063968 0076434 02 16 0081480 0074841 0091803 02 18 0096448 0087146 0109894 02 2 0113877 0100909 0131037 02 22 0134059 0116087 0155537 02 24 0157277 0132541 0183649 02 26 0183785 0150008 0215545 02 28 0213786 0168082 0251276 02 3 0247403 0186195 0290734 02 32 0284642 0203621 0333628 02 34 0325366 0219503 0379465 02 36 0369266 0232909 0427558 02 38 0415848 0242918 0477061 02 4 0464432 0248735 0527019 02 42 0514179 0249799 0576441 02 44 0564138 0245886 0624380 02 46 0613316 0237160 0669999 02 48 0660748 0224160 0712628 02 5 0705580 0207737 0751790 02 52 0747127 0188928 0787208 02 54 0784913 0168825 0818791 02 56 0818678 0148445 0846600 02 58 0848367 0128641 0870815 02 6 0874095 0110053 0891696 02 62 0896105 0093101 0909552 02 64 0914725 0078003 0924713 02 66 0930326 0064820 0937508 02 68 0943290 0053494 0948249 02 7 0953989 0043894 0957229 02 72 0962768 0035846 0964708 02 74 0969937 0029159 0970920 02 76 0975769 0023644 ("$!!!!!# ("!!!!!!#!"'!!!!!#!"&!!!!!#!"%!!!!!#!"$!!!!!#!"!!!!!!#!# (# $# )# %# *# &# +# '#,-/# 0,12#3456748#

Point and click on-line diffeq solver There are several graphical on-line solvers for differential equations If you go to this web page: http://virtualmathmuseumorg/ode/1o1d-massaction you can see graphs of the solution to our equation dx = x(1 x)