Ordinary Differential Equations

Size: px
Start display at page:

Download "Ordinary Differential Equations"

Transcription

1 Ordinary Differential Equations 1 An Oscillating Pendulum applying the forward Euler method 2 Celestial Mechanics simulating the n-body problem 3 The Tractrix Problem setting up the differential equations MCS 507 Lecture 24 Mathematical, Statistical and Scientific Software Jan Verschelde, 22 October 2012 Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

2 Ordinary Differential Equations 1 An Oscillating Pendulum applying the forward Euler method 2 Celestial Mechanics simulating the n-body problem 3 The Tractrix Problem setting up the differential equations Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

3 a simple pendulum Imagine a sphere attached to a massless rod oscilating back and forth due to gravity: where t is time, starting at 0; θ (t) + α sin(θ(t)) = 0, θ is the angle of deviation the rod makes from its (vertical) position at rest; α = g/l, where g is the gravitational constant and L is the length of the rod. Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

4 using sympy For small angles, θ 0: sin(θ) θ. >>> from sympy import * >>> L, t, g = var( L, t, g ) >>> theta = Function( theta ) >>> eq = L*Derivative(theta(t),t,2) + g*t >>> dsolve(eq,theta(t)) theta(t) == C1 + C2*t - g*t**3/(6*l) Using more terms in a series approximation for sin(θ), we obtain more accurate solutions. Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

5 first order equations Introducing an auxiliary variable v(t) = θ (t), we transform θ (t) + α sin(θ(t)) = 0 into a system of first order differential equations: θ (t) = v(t) v (t) = α sin(θ(t)) θ with initial conditions: θ(0) = π/6 and v(0) = 0. Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

6 forward Euler method We use the definition θ θ(t + h) θ(t) (t) = lim h 0 h to discretize the time domain with step size t. At t = t k, we approximate θ(t k ) θ k and θ(t k+1 ) θ k+1 for and t k+1 = t k + t. So θ (t) = v(t) is approximated by θ k+1 θ k t Then we compute θ k+1 = θ k + tv k. Similarly, v (t) = α sin(θ(t)) is approximated by v k+1 = v k α t sin(θ k ). = v k. Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

7 plotting the evolution Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

8 programming the Euler method import scipy as sp import matplotlib.pyplot as plt def pendulum(t,n,theta0,v0,alpha): Return the motion (theta, v, t) of a pendulum, governed by the ODE: theta (t) + alpha*sin(theta(t)) = 0, where the parameters are T : time t ranges from 0 to T, n : the number of time steps, theta0 : angle at t = 0, v0 : velocity at t = 0, alpha : value for the parameter. Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

9 the code in pendulum dt = T/float(n) t = sp.linspace(0,t,n+1) v = sp.zeros(n+1) theta = sp.zeros(n+1) v[0] = v0 theta[0] = theta0 for k in range(n): theta[k+1] = theta[k] + dt*v[k] v[k+1] = v[k] - alpha*dt*sp.sin(theta[k+1]) return theta, v, t Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

10 the constants def test_values(): Returns values for the input data: T, n, theta0, v0, and alpha. theta0 = sp.pi/6 n = 1000 T = 10 v0 = 0 alpha = 5 return T, n, theta0, v0, alpha Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

11 the function main def main(): Defines the test values and computes the trajectory of the pendulum. T,n,p0,v0,a = test_values() theta,v,t = pendulum(t,n,p0,v0,a) f = plt.figure() f.add_subplot(211) plt.plot(t,theta) plt.title( angle as function of time ) f.add_subplot(212) plt.plot(t,v,label= velocity(t) ) plt.title( velocity as function of time ) plt.show() Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

12 Ordinary Differential Equations 1 An Oscillating Pendulum applying the forward Euler method 2 Celestial Mechanics simulating the n-body problem 3 The Tractrix Problem setting up the differential equations Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

13 calling ODEPACK do from scipy.integrate.odepack import odeint then help(odeint) shows odeint(func, y0, t,...) Solve a system of ordinary differential equations using lsoda from the FORTRAN library odepack. Solves the initial value problem for stiff or non-stiff systems of first order ode-s:: dy/dt = func(y,t0,...) where y can be a vector. ODEPACK is a FORTRAN77 library which implements Alan Hindmarsh s solvers for ordinary differential equations, available at Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

14 defining the right hand side import scipy as sp import matplotlib.pyplot as plt from scipy.integrate.odepack import odeint def f(y,t): Is the right hand side of the ODE dy/dt = f(y,t). r = sp.array([0,0],float) r[0] = y[1] r[1] = -5.0*sp.sin(y[0]) return r Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

15 the function main def main(): Computes the motion of a pendulum, governed by the ODE: theta (t) + alpha*sin(theta(t)) = 0, T = 10; n = 1000 theta0 = sp.pi/6; v0 = 0 tspan = sp.linspace(0,t,n+1) initc = sp.array([theta0,v0]) y = odeint(f,initc,tspan) theta = y[:,0] v = y[:,1] then plot (tspan,theta) and (tspan,v). Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

16 Ordinary Differential Equations 1 An Oscillating Pendulum applying the forward Euler method 2 Celestial Mechanics simulating the n-body problem 3 The Tractrix Problem setting up the differential equations Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

17 differential equations Consider three bodies with masses m 1, m 2, m 3 with positions (x 1 (t), y 1 (t)), (x 2 (t), y 2 (t)), (x 3 (t), y 3 (t)). For the first body: d 2 x 1 (t) dt 2 m = 2 (x 1 (t) x 2 (t)) ( (x1 (t) x 2 (t)) 2 + (y 1 (t) y 2 (t)) 2) 3/2 m 3 (x 1 (t) x 3 (t)) ( (x1 (t) x 3 (t)) 2 + (y 1 (t) y 3 (t)) 2) 3/2 d 2 y 1 (t) dt 2 =... Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

18 setting up the problem With u 1 (t) and v 1 (t), the velocities of x 1 (t) and y 1 (t): dx 1 (t) dt du 1 (t) dt dy 1 (t) dt dv 1 (t) dt = u 1 (t) =... = v 1 (t) =... Adding the equations for the other two bodies, we get 12 first order differential equations. Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

19 the figure eight Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

20 Ordinary Differential Equations 1 An Oscillating Pendulum applying the forward Euler method 2 Celestial Mechanics simulating the n-body problem 3 The Tractrix Problem setting up the differential equations Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

21 defining the system import scipy as sp import matplotlib.pyplot as plt from scipy.integrate.odepack import odeint def f(z,t): z is a vector with 12 entries ordered in blocks of 4: x[k](t),x [k](t),y[k](t),y [k](t) for k = 1,2,3. L = [0 for k in xrange(12)] r = sp.array(l,float) Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

22 relabeling # take three equal masses m = [1, 1, 1] # relabel input vector z x1 = z[0]; u1 = z[1]; y1 = z[2]; v1 = z[3] x2 = z[4]; u2 = z[5]; y2 = z[6]; v2 = z[7] x3 = z[8]; u3 = z[9]; y3 = z[10]; v3 = z[11] # u and v are first derivatives of x and y r[0] = u1; r[2] = v1 r[4] = u2; r[6] = v2 r[8] = u3; r[10] = v3 Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

23 computing distances # compute squared distances dx12 = x1 - x2; sdx12 = dx12**2 dx13 = x1 - x3; sdx13 = dx13**2 dx23 = x2 - x3; sdx23 = dx23**2 dy12 = y1 - y2; sdy12 = dy12**2 dy13 = y1 - y3; sdy13 = dy13**2 dy23 = y2 - y3; sdy23 = dy23**2 # denominators d12 = (sdx12 + sdy12)**1.5 d13 = (sdx13 + sdy13)**1.5 d23 = (sdx23 + sdy23)**1.5 Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

24 assigning the result # righthandside for second order r[1] = - m[1]*dx12/d12 - m[2]*dx13/d13; r[3] = - m[1]*dy12/d12 - m[2]*dy13/d13; r[5] = - m[0]*(-dx12)/d12 - m[2]*dx23/d23; r[7] = - m[0]*(-dy12)/d12 - m[2]*dy23/d23; r[9] = - m[0]*(-dx13)/d13 - m[1]*(-dx23)/d23; r[11] = - m[0]*(-dy13)/d13 - m[1]*(-dy23)/d23; return r Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

25 the function main def main(): Plots the trajectories of 3 equal masses forming a figure 8. # initial positions ip1 = [ , ] ip2 = [-ip1[0], -ip1[1]]; ip3 = [0, 0] # initial velocities iv3 = [ , ] iv2 = [-iv3[0]/2, -iv3[1]/2]; iv1 = iv2 # input for initial righthandside vector initz = [ip1[0], iv1[0], ip1[1], iv1[1], \ ip2[0], iv2[0], ip2[1], iv2[1], \ ip3[0], iv3[0], ip3[1], iv3[1]] Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

26 solving the problem T = 2*sp.pi/3; n = 1000 tspan = sp.linspace(0,t,n+1) z = odeint(f,initz,tspan) # extracting the trajectories x1 = z[:,0]; y1 = z[:,2] x2 = z[:,4]; y2 = z[:,6] x3 = z[:,8]; y3 = z[:,10]; # plotting the trajectories fig = plt.figure() plt.plot(x1,y1, r,x2,y2, g,x3,y3, b ) plt.show() Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

27 an animation def animate(z,nbframes): Makes an animation of the trajectories computed by odeint in z, using nbframes. x1 = z[:,0]; x2 = z[:,4]; x3 = z[:,8] y1 = z[:,2]; y2 = z[:,6]; y3 = z[:,10] n = len(x1); deltaframe = n/nbframes; frame = deltaframe plt.ion(); fig = plt.figure() ax = fig.add_subplot(111) ax.set_xlim(-1.5,1.5); ax.set_ylim(-0.5,0.5) for i in range(nbframes): s1x = x1[1:frame]; s1y = y1[1:frame] s2x = x2[1:frame]; s2y = y2[1:frame] s3x = x3[1:frame]; s3y = y3[1:frame] ax.plot(s1x,s1y, r,s2x,s2y, g,s3x,s3y, b ) fig.canvas.draw(); plt.pause(1) frame = frame + deltaframe Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

28 Ordinary Differential Equations 1 An Oscillating Pendulum applying the forward Euler method 2 Celestial Mechanics simulating the n-body problem 3 The Tractrix Problem setting up the differential equations Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

29 the tractrix problem A tractor is connected to a trailer by a rigid bar of unit length. The tractor moves in a circle. The path of the trailer is the solution of a system of ordinary differential equations. Generalization: trailer is predator, tractor is prey. Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

30 tractor, trailer, and bar Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

31 the model Given are (x 1 (t), x 2 (t)) defining the path of the tractor and L is the length of the rigid bar. Wanted: (y 1 (t), y 2 (t)), the path of the trailer. The velocity vector of the trailer is parallel to the direction of the bar: ( y 1 y 2 ) ( y1 x = λ 1 y 2 x 2 ), λ > 0. Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

32 the ODE system The velocity vector of the trailer is the projection of the velocity vector of the tractor onto the direction of the bar: u = (y 1 x 1, y 2 x 2 ) (y 1 x 1, y 2 x 2 ) and v = (x 1, x 2 ), we compute the projection of the velocity vector as (v T u)u. Then the system of first-order equation that defines the path of the trailer is given by ( ) y 1 y 2 = (v T u)u. with u the normalized vector of the direction of the bar and v the velocity vector of the tractor. Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

33 Ordinary Differential Equations 1 An Oscillating Pendulum applying the forward Euler method 2 Celestial Mechanics simulating the n-body problem 3 The Tractrix Problem setting up the differential equations Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

34 the tractor import scipy as sp import numpy as np import matplotlib.pyplot as plt from scipy.integrate.odepack import odeint def tractor(t): Returns the position (x,y) and velocity vector (u,v) for the tractor at time t. x = sp.cos(t); y = sp.sin(t) u = -sp.sin(t); v = sp.cos(t) return x,y,u,v Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

35 the trailer def trailer(y,t): Defines the right hand side of the system for the trailer. r = np.array([0,0],float) x1, x2, x1v, x2v = tractor(t) r[0] = y[0] - x1 r[1] = y[1] - x2 r = r/np.linalg.norm(r) d = x1v*r[0] + x2v*r[1] r = d*r return r Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

36 solving the IVP def main(): Defines the setup for the system for the trailer and solves it. T = 20; n = 100 tspan = sp.linspace(0,t,n+1) initc = sp.array([2,0]) path = odeint(trailer,initc,tspan) x = path[:,0]; y = path[:,1] x1, x2, x1v, x2v = tractor(tspan) fig = plt.figure() plt.plot(x1,x2, r,x,y, g ) for i in xrange(0,n,6): plt.plot(sp.array([x1[i],x[i]]), \ sp.array([x2[i],y[i]]), b ) plt.show() Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

37 Summary + Exercises Appendices C, D, and E of the book are on differential equations. SciPy.integrate exports odeint() of odepack. A.C. Hindmarsh: ODEPACK, A Systematized Collection of ODE Solvers. In IMACS Transactions on Scientific Computation, Volume 1, pages 55-64, 1983, edited by R.S. Stepleman. 1 Extend the model for the n-body problem so it works for any number of bodies. 2 Instead of odeint() for the planar 3-body problem, write code for the forward Euler method. For which value(s) of the step size do you get the figure eight? 3 Make an animation of the trajectories of tractor, trailer, and the moving bar. Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

38 more exercises 4 Solving y = s(t)w where s(t) is the speed and w the normalized direction vector of a predator chasing a prey gives in y the coordinates of the predator. Set up a model for a prey to move in a straight line and let s(t) be a large enough constant so the prey gets caught. Plot the trajectories of prey and predator. 5 Read the documentation about solving ODEs in Sage and use Sage to plot the trajectories either for the figure eight planar 3-body or the tractrix problem. Scientific Software (MCS 507) Ordinary Differential Equations 22 October / 38

Ordinary Differential Equations

Ordinary Differential Equations Ordinary Differential Equations 1 2 3 MCS 507 Lecture 30 Mathematical, Statistical and Scientific Software Jan Verschelde, 31 October 2011 Ordinary Differential Equations 1 2 3 a simple pendulum Imagine

More information

Ordinary Differential Equations

Ordinary Differential Equations Ordinary Differential Equations 1 An Oscillating Pendulum applying the forward Euler method 2 Celestial Mechanics simulating the n-body problem 3 The Tractrix Problem setting up the differential equations

More information

Uniform and constant electromagnetic fields

Uniform and constant electromagnetic fields Fundamentals of Plasma Physics, Nuclear Fusion and Lasers Single Particle Motion Uniform and constant electromagnetic fields Nuno R. Pinhão 2015, March In this notebook we analyse the movement of individual

More information

MAS212 Scientific Computing and Simulation

MAS212 Scientific Computing and Simulation MAS212 Scientific Computing and Simulation Dr. Sam Dolan School of Mathematics and Statistics, University of Sheffield Autumn 2017 http://sam-dolan.staff.shef.ac.uk/mas212/ G18 Hicks Building s.dolan@sheffield.ac.uk

More information

The Shooting Method for Boundary Value Problems

The Shooting Method for Boundary Value Problems 1 The Shooting Method for Boundary Value Problems Consider a boundary value problem of the form y = f(x, y, y ), a x b, y(a) = α, y(b) = β. (1.1) One natural way to approach this problem is to study the

More information

The Inverted Pendulum

The Inverted Pendulum Lab 1 The Inverted Pendulum Lab Objective: We will set up the LQR optimal control problem for the inverted pendulum and compute the solution numerically. Think back to your childhood days when, for entertainment

More information

APPLICATIONS OF FD APPROXIMATIONS FOR SOLVING ORDINARY DIFFERENTIAL EQUATIONS

APPLICATIONS OF FD APPROXIMATIONS FOR SOLVING ORDINARY DIFFERENTIAL EQUATIONS LECTURE 10 APPLICATIONS OF FD APPROXIMATIONS FOR SOLVING ORDINARY DIFFERENTIAL EQUATIONS Ordinary Differential Equations Initial Value Problems For Initial Value problems (IVP s), conditions are specified

More information

3 Space curvilinear motion, motion in non-inertial frames

3 Space curvilinear motion, motion in non-inertial frames 3 Space curvilinear motion, motion in non-inertial frames 3.1 In-class problem A rocket of initial mass m i is fired vertically up from earth and accelerates until its fuel is exhausted. The residual mass

More information

Lecture 19: Calculus of Variations II - Lagrangian

Lecture 19: Calculus of Variations II - Lagrangian Lecture 19: Calculus of Variations II - Lagrangian 1. Key points Lagrangian Euler-Lagrange equation Canonical momentum Variable transformation Maple VariationalCalculus package EulerLagrange 2. Newton's

More information

Mathematical Models. MATH 365 Ordinary Differential Equations. J. Robert Buchanan. Spring Department of Mathematics

Mathematical Models. MATH 365 Ordinary Differential Equations. J. Robert Buchanan. Spring Department of Mathematics Mathematical Models MATH 365 Ordinary Differential Equations J. Robert Buchanan Department of Mathematics Spring 2018 Ordinary Differential Equations The topic of ordinary differential equations (ODEs)

More information

1 The pendulum equation

1 The pendulum equation Math 270 Honors ODE I Fall, 2008 Class notes # 5 A longer than usual homework assignment is at the end. The pendulum equation We now come to a particularly important example, the equation for an oscillating

More information

Mathematical Models. MATH 365 Ordinary Differential Equations. J. Robert Buchanan. Fall Department of Mathematics

Mathematical Models. MATH 365 Ordinary Differential Equations. J. Robert Buchanan. Fall Department of Mathematics Mathematical Models MATH 365 Ordinary Differential Equations J. Robert Buchanan Department of Mathematics Fall 2018 Ordinary Differential Equations The topic of ordinary differential equations (ODEs) is

More information

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

Research Computing with Python, Lecture 7, Numerical Integration and Solving Ordinary Differential Equations Research Computing with Python, Lecture 7, Numerical Integration and Solving Ordinary Differential Equations Ramses van Zon SciNet HPC Consortium November 25, 2014 Ramses van Zon (SciNet HPC Consortium)Research

More information

Exercise_set7_programming_exercises

Exercise_set7_programming_exercises Exercise_set7_programming_exercises May 13, 2018 1 Part 1(d) We start by defining some function that will be useful: The functions defining the system, and the Hamiltonian and angular momentum. In [1]:

More information

Math 266: Ordinary Differential Equations

Math 266: Ordinary Differential Equations Math 266: Ordinary Differential Equations Long Jin Purdue University, Spring 2018 Basic information Lectures: MWF 8:30-9:20(111)/9:30-10:20(121), UNIV 103 Instructor: Long Jin (long249@purdue.edu) Office

More information

Ordinary Differential Equations (ODE)

Ordinary Differential Equations (ODE) Ordinary Differential Equations (ODE) Why study Differential Equations? Many physical phenomena are best formulated mathematically in terms of their rate of change. Motion of a swinging pendulum Bungee-jumper

More information

The Pendulum. The purpose of this tab is to predict the motion of various pendulums and compare these predictions with experimental observations.

The Pendulum. The purpose of this tab is to predict the motion of various pendulums and compare these predictions with experimental observations. The Pendulum Introduction: The purpose of this tab is to predict the motion of various pendulums and compare these predictions with experimental observations. Equipment: Simple pendulum made from string

More information

Motion in Two or Three Dimensions

Motion in Two or Three Dimensions Chapter 3 Motion in Two or Three Dimensions PowerPoint Lectures for University Physics, Thirteenth Edition Hugh D. Young and Roger A. Freedman Lectures by Wayne Anderson Goals for Chapter 3 To use vectors

More information

On Schemes for Exponential Decay

On Schemes for Exponential Decay On Schemes for Exponential Decay Hans Petter Langtangen 1,2 Center for Biomedical Computing, Simula Research Laboratory 1 Department of Informatics, University of Oslo 2 Sep 24, 2015 1.0 0.8 numerical

More information

n-dimensional LCE code

n-dimensional LCE code n-dimensional LCE code Dale L Peterson Department of Mechanical and Aeronautical Engineering University of California, Davis dlpeterson@ucdavisedu June 10, 2007 Abstract The Lyapunov characteristic exponents

More information

Chapter 3: 2D Kinematics Tuesday January 20th

Chapter 3: 2D Kinematics Tuesday January 20th Chapter 3: 2D Kinematics Tuesday January 20th Chapter 3: Vectors Review: Properties of vectors Review: Unit vectors Position and displacement Velocity and acceleration vectors Relative motion Constant

More information

Modeling with First-Order Equations

Modeling with First-Order Equations Modeling with First-Order Equations MATH 365 Ordinary Differential Equations J. Robert Buchanan Department of Mathematics Spring 2018 Radioactive Decay Radioactive decay takes place continuously. The number

More information

Lecture 20/Lab 21: Systems of Nonlinear ODEs

Lecture 20/Lab 21: Systems of Nonlinear ODEs Lecture 20/Lab 21: Systems of Nonlinear ODEs MAR514 Geoffrey Cowles Department of Fisheries Oceanography School for Marine Science and Technology University of Massachusetts-Dartmouth Coupled ODEs: Species

More information

Math 104: l Hospital s rule, Differential Equations and Integration

Math 104: l Hospital s rule, Differential Equations and Integration Math 104: l Hospital s rule, and Integration Ryan Blair University of Pennsylvania Tuesday January 22, 2013 Math 104:l Hospital s rule, andtuesday Integration January 22, 2013 1 / 8 Outline 1 l Hospital

More information

Problem Set 1 solutions

Problem Set 1 solutions University of Alabama Department of Physics and Astronomy PH 301 / LeClair Fall 2018 Problem Set 1 solutions 1. If a(t), b(t), and c(t) are functions of t, verify the following results: ( d [a (b c)] =

More information

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

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

More information

Lecture Notes for PHY 405 Classical Mechanics

Lecture Notes for PHY 405 Classical Mechanics Lecture Notes for PHY 45 Classical Mechanics From Thorton & Marion s Classical Mechanics Prepared by Dr. Joseph M. Hahn Saint Mary s University Department of Astronomy & Physics October 11, 25 Chapter

More information

Here we consider soliton solutions of the Korteweg-de Vries (KdV) equation. This equation is given by u t + u u x + 3 u

Here we consider soliton solutions of the Korteweg-de Vries (KdV) equation. This equation is given by u t + u u x + 3 u Lab 3 Solitons Lab Objective: We study traveling wave solutions of the Korteweg-de Vries (KdV) equation, using a pseudospectral discretization in space and a Runge-Kutta integration scheme in time. Here

More information

UNIVERSITETET I OSLO

UNIVERSITETET I OSLO (Continued on page 2.) UNIVERSITETET I OSLO Det matematisk-naturvitenskapelige fakultet Examination in: INF1100 Introduction to programming with scientific applications Day of examination: Tuesday, December

More information

SOLUTIONS, PROBLEM SET 11

SOLUTIONS, PROBLEM SET 11 SOLUTIONS, PROBLEM SET 11 1 In this problem we investigate the Lagrangian formulation of dynamics in a rotating frame. Consider a frame of reference which we will consider to be inertial. Suppose that

More information

Lorenz Equations. Lab 1. The Lorenz System

Lorenz Equations. Lab 1. The Lorenz System Lab 1 Lorenz Equations Chaos: When the present determines the future, but the approximate present does not approximately determine the future. Edward Lorenz Lab Objective: Investigate the behavior of a

More information

Modeling with First-Order Equations

Modeling with First-Order Equations Modeling with First-Order Equations MATH 365 Ordinary Differential Equations J. Robert Buchanan Department of Mathematics Fall 2018 Radioactive Decay Radioactive decay takes place continuously. The number

More information

Math221: HW# 2 solutions

Math221: HW# 2 solutions Math: HW# solutions Andy Royston October, 5 8..4 Integrate each side from to t: t d x dt dt dx dx (t) dt dt () g k e kt t t ge kt dt g k ( e kt ). () Since the object starts from rest, dx dx () v(). Now

More information

Old Math 330 Exams. David M. McClendon. Department of Mathematics Ferris State University

Old Math 330 Exams. David M. McClendon. Department of Mathematics Ferris State University Old Math 330 Exams David M. McClendon Department of Mathematics Ferris State University Last updated to include exams from Fall 07 Contents Contents General information about these exams 3 Exams from Fall

More information

Chapter 6 Nonlinear Systems and Phenomena. Friday, November 2, 12

Chapter 6 Nonlinear Systems and Phenomena. Friday, November 2, 12 Chapter 6 Nonlinear Systems and Phenomena 6.1 Stability and the Phase Plane We now move to nonlinear systems Begin with the first-order system for x(t) d dt x = f(x,t), x(0) = x 0 In particular, consider

More information

Ordinary Differential Equations

Ordinary Differential Equations Ordinary Differential Equations Swaroop Nandan Bora swaroop@iitg.ernet.in Department of Mathematics Indian Institute of Technology Guwahati Guwahati-781039 Modelling a situation We study a model, a sort

More information

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

AM205: Assignment 3 (due 5 PM, October 20) 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

More information

Phys 7221 Homework # 8

Phys 7221 Homework # 8 Phys 71 Homework # 8 Gabriela González November 15, 6 Derivation 5-6: Torque free symmetric top In a torque free, symmetric top, with I x = I y = I, the angular velocity vector ω in body coordinates with

More information

Lecture 2. Introduction to Differential Equations. Roman Kitsela. October 1, Roman Kitsela Lecture 2 October 1, / 25

Lecture 2. Introduction to Differential Equations. Roman Kitsela. October 1, Roman Kitsela Lecture 2 October 1, / 25 Lecture 2 Introduction to Differential Equations Roman Kitsela October 1, 2018 Roman Kitsela Lecture 2 October 1, 2018 1 / 25 Quick announcements URL for the class website: http://www.math.ucsd.edu/~rkitsela/20d/

More information

First Order Systems of Linear Equations. or ODEs of Arbitrary Order

First Order Systems of Linear Equations. or ODEs of Arbitrary Order First Order Systems of Linear Equations or ODEs of Arbitrary Order Systems of Equations Relate Quantities Examples Predator-Prey Relationships r 0 = r (100 f) f 0 = f (r 50) (Lokta-Volterra Model) Systems

More information

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

10.34: Numerical Methods Applied to Chemical Engineering. Lecture 19: Differential Algebraic Equations 10.34: Numerical Methods Applied to Chemical Engineering Lecture 19: Differential Algebraic Equations 1 Recap Differential algebraic equations Semi-explicit Fully implicit Simulation via backward difference

More information

Volumes of Solids of Revolution Lecture #6 a

Volumes of Solids of Revolution Lecture #6 a Volumes of Solids of Revolution Lecture #6 a Sphereoid Parabaloid Hyperboloid Whateveroid Volumes Calculating 3-D Space an Object Occupies Take a cross-sectional slice. Compute the area of the slice. Multiply

More information

strings, dictionaries, and files

strings, dictionaries, and files strings, dictionaries, and 1 2 MCS 507 Lecture 18 Mathematical, Statistical and Scientific Software Jan Verschelde, 3 October 2011 strings, dictionaries, and 1 2 data structures Python glues with strings,,

More information

Experiment 9: Compound Pendulum

Experiment 9: Compound Pendulum COMSATS nstitute of nformation Technology, slamabad Campus PHYS - 108 Experiment 9: Compound Pendulum A compound pendulum (also known as a physical pendulum) consists of a rigid body oscillating about

More information

AIMS Exercise Set # 1

AIMS Exercise Set # 1 AIMS Exercise Set #. Determine the form of the single precision floating point arithmetic used in the computers at AIMS. What is the largest number that can be accurately represented? What is the smallest

More information

Ordinary Differential equations

Ordinary Differential equations Chapter 1 Ordinary Differential equations 1.1 Introduction to Ordinary Differential equation In mathematics, an ordinary differential equation (ODE) is an equation which contains functions of only one

More information

28. Pendulum phase portrait Draw the phase portrait for the pendulum (supported by an inextensible rod)

28. Pendulum phase portrait Draw the phase portrait for the pendulum (supported by an inextensible rod) 28. Pendulum phase portrait Draw the phase portrait for the pendulum (supported by an inextensible rod) θ + ω 2 sin θ = 0. Indicate the stable equilibrium points as well as the unstable equilibrium points.

More information

Problem 1. Mathematics of rotations

Problem 1. Mathematics of rotations Problem 1. Mathematics of rotations (a) Show by algebraic means (i.e. no pictures) that the relationship between ω and is: φ, ψ, θ Feel free to use computer algebra. ω X = φ sin θ sin ψ + θ cos ψ (1) ω

More information

STABILITY. Phase portraits and local stability

STABILITY. Phase portraits and local stability MAS271 Methods for differential equations Dr. R. Jain STABILITY Phase portraits and local stability We are interested in system of ordinary differential equations of the form ẋ = f(x, y), ẏ = g(x, y),

More information

Driven, damped, pendulum

Driven, damped, pendulum Driven, damped, pendulum Note: The notation and graphs in this notebook parallel those in Chaotic Dynamics by Baker and Gollub. (There's a copy in the department office.) For the driven, damped, pendulum,

More information

SMA 208: Ordinary differential equations I

SMA 208: Ordinary differential equations I SMA 208: Ordinary differential equations I First Order differential equations Lecturer: Dr. Philip Ngare (Contacts: pngare@uonbi.ac.ke, Tue 12-2 PM) School of Mathematics, University of Nairobi Feb 26,

More information

Study guide: Generalizations of exponential decay models

Study guide: Generalizations of exponential decay models Study guide: Generalizations of exponential decay models Hans Petter Langtangen 1,2 Center for Biomedical Computing, Simula Research Laboratory 1 Department of Informatics, University of Oslo 2 Sep 13,

More information

Chapter 14 Periodic Motion

Chapter 14 Periodic Motion Chapter 14 Periodic Motion 1 Describing Oscillation First, we want to describe the kinematical and dynamical quantities associated with Simple Harmonic Motion (SHM), for example, x, v x, a x, and F x.

More information

Solutions to Math 53 Math 53 Practice Final

Solutions to Math 53 Math 53 Practice Final Solutions to Math 5 Math 5 Practice Final 20 points Consider the initial value problem y t 4yt = te t with y 0 = and y0 = 0 a 8 points Find the Laplace transform of the solution of this IVP b 8 points

More information

Engineering Computation in

Engineering Computation in Engineering Computation in Dr. Kyle Horne Department of Mechanical Engineering Spring, 2018 What is It? 140 Explicit Implicit 120 100 Temperature T [C] Position y [px] 15 10 5 0 5 10 15 24.5 24.0 23.5

More information

Computers, Lies and the Fishing Season

Computers, Lies and the Fishing Season 1/47 Computers, Lies and the Fishing Season Liz Arnold May 21, 23 Introduction Computers, lies and the fishing season takes a look at computer software programs. As mathematicians, we depend on computers

More information

Ordinary Differential Equations. Monday, October 10, 11

Ordinary Differential Equations. Monday, October 10, 11 Ordinary Differential Equations Monday, October 10, 11 Problems involving ODEs can always be reduced to a set of first order differential equations. For example, By introducing a new variable z, this can

More information

The Principle of Least Action

The Principle of Least Action The Principle of Least Action In their never-ending search for general principles, from which various laws of Physics could be derived, physicists, and most notably theoretical physicists, have often made

More information

Ordinary Differential Equations (ODEs) Background. Video 17

Ordinary Differential Equations (ODEs) Background. Video 17 Ordinary Differential Equations (ODEs) Background Video 17 Daniel J. Bodony Department of Aerospace Engineering University of Illinois at Urbana-Champaign In this video you will learn... 1 What ODEs are

More information

{ } is an asymptotic sequence.

{ } is an asymptotic sequence. AMS B Perturbation Methods Lecture 3 Copyright by Hongyun Wang, UCSC Recap Iterative method for finding asymptotic series requirement on the iteration formula to make it work Singular perturbation use

More information

ν(u, v) = N(u, v) G(r(u, v)) E r(u,v) 3.

ν(u, v) = N(u, v) G(r(u, v)) E r(u,v) 3. 5. The Gauss Curvature Beyond doubt, the notion of Gauss curvature is of paramount importance in differential geometry. Recall two lessons we have learned so far about this notion: first, the presence

More information

Department of Aerospace Engineering AE602 Mathematics for Aerospace Engineers Assignment No. 6

Department of Aerospace Engineering AE602 Mathematics for Aerospace Engineers Assignment No. 6 Department of Aerospace Engineering AE Mathematics for Aerospace Engineers Assignment No.. Find the best least squares solution x to x, x 5. What error E is minimized? heck that the error vector ( x, 5

More information

Practice Final Solutions

Practice Final Solutions Practice Final Solutions Math 1, Fall 17 Problem 1. Find a parameterization for the given curve, including bounds on the parameter t. Part a) The ellipse in R whose major axis has endpoints, ) and 6, )

More information

Tutorial-1, MA 108 (Linear Algebra)

Tutorial-1, MA 108 (Linear Algebra) Tutorial-1, MA 108 (Linear Algebra) 1. Verify that the function is a solution of the differential equation on some interval, for any choice of the arbitrary constants appearing in the function. (a) y =

More information

Hamiltonian. March 30, 2013

Hamiltonian. March 30, 2013 Hamiltonian March 3, 213 Contents 1 Variational problem as a constrained problem 1 1.1 Differential constaint......................... 1 1.2 Canonic form............................. 2 1.3 Hamiltonian..............................

More information

Math 225 Differential Equations Notes Chapter 1

Math 225 Differential Equations Notes Chapter 1 Math 225 Differential Equations Notes Chapter 1 Michael Muscedere September 9, 2004 1 Introduction 1.1 Background In science and engineering models are used to describe physical phenomena. Often these

More information

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

EAD 115. Numerical Solution of Engineering and Scientific Problems. David M. Rocke Department of Applied Science EAD 115 Numerical Solution of Engineering and Scientific Problems David M. Rocke Department of Applied Science Transient Response of a Chemical Reactor Concentration of a substance in a chemical reactor

More information

MA 102 Mathematics II Lecture Feb, 2015

MA 102 Mathematics II Lecture Feb, 2015 MA 102 Mathematics II Lecture 1 20 Feb, 2015 Differential Equations An equation containing derivatives is called a differential equation. The origin of differential equations Many of the laws of nature

More information

Numerical Methods for the Solution of Differential Equations

Numerical Methods for the Solution of Differential Equations Numerical Methods for the Solution of Differential Equations Markus Grasmair Vienna, winter term 2011 2012 Analytical Solutions of Ordinary Differential Equations 1. Find the general solution of the differential

More information

Updated 2013 (Mathematica Version) M1.1. Lab M1: The Simple Pendulum

Updated 2013 (Mathematica Version) M1.1. Lab M1: The Simple Pendulum Updated 2013 (Mathematica Version) M1.1 Introduction. Lab M1: The Simple Pendulum The simple pendulum is a favorite introductory exercise because Galileo's experiments on pendulums in the early 1600s are

More information

Study guide for Exam 1. by William H. Meeks III October 26, 2012

Study guide for Exam 1. by William H. Meeks III October 26, 2012 Study guide for Exam 1. by William H. Meeks III October 2, 2012 1 Basics. First we cover the basic definitions and then we go over related problems. Note that the material for the actual midterm may include

More information

Lecture 9 Approximations of Laplace s Equation, Finite Element Method. Mathématiques appliquées (MATH0504-1) B. Dewals, C.

Lecture 9 Approximations of Laplace s Equation, Finite Element Method. Mathématiques appliquées (MATH0504-1) B. Dewals, C. Lecture 9 Approximations of Laplace s Equation, Finite Element Method Mathématiques appliquées (MATH54-1) B. Dewals, C. Geuzaine V1.2 23/11/218 1 Learning objectives of this lecture Apply the finite difference

More information

Lecture 6, September 1, 2017

Lecture 6, September 1, 2017 Engineering Mathematics Fall 07 Lecture 6, September, 07 Escape Velocity Suppose we have a planet (or any large near to spherical heavenly body) of radius R and acceleration of gravity at the surface of

More information

Dynamics Final Report

Dynamics Final Report Dynamics Final Report Sophie Li and Hannah Wilk 1 Abstract We set out to develop a n-rigid body solver in MatLab. We wanted a user to define how many rigid bodies there are, and our system creates the

More information

Particles and Cylindrical Polar Coordinates

Particles and Cylindrical Polar Coordinates Chapter 2 Particles and Cylindrical Polar Coordinates TOPICS Here, we discuss the cylindrical polar coordinate system and how it is used in particle mechanics. This coordinate system and its associated

More information

Name: SOLUTIONS Date: 11/9/2017. M20550 Calculus III Tutorial Worksheet 8

Name: SOLUTIONS Date: 11/9/2017. M20550 Calculus III Tutorial Worksheet 8 Name: SOLUTIONS Date: /9/7 M55 alculus III Tutorial Worksheet 8. ompute R da where R is the region bounded by x + xy + y 8 using the change of variables given by x u + v and y v. Solution: We know R is

More information

Python Programs.pdf. University of California, Berkeley. From the SelectedWorks of David D Nolte. David D Nolte. April 22, 2019

Python Programs.pdf. University of California, Berkeley. From the SelectedWorks of David D Nolte. David D Nolte. April 22, 2019 University of California, Berkeley From the SelectedWorks of David D Nolte April 22, 2019 Python Programs.pdf David D Nolte Available at: https://works.bepress.com/ddnolte/26/ Python Scripts for 2D, 3D

More information

Lecture 1. Scott Pauls 1 3/28/07. Dartmouth College. Math 23, Spring Scott Pauls. Administrivia. Today s material.

Lecture 1. Scott Pauls 1 3/28/07. Dartmouth College. Math 23, Spring Scott Pauls. Administrivia. Today s material. Lecture 1 1 1 Department of Mathematics Dartmouth College 3/28/07 Outline Course Overview http://www.math.dartmouth.edu/~m23s07 Matlab Ordinary differential equations Definition An ordinary differential

More information

Chapter 1, Section 1.2, Example 9 (page 13) and Exercise 29 (page 15). Use the Uniqueness Tool. Select the option ẋ = x

Chapter 1, Section 1.2, Example 9 (page 13) and Exercise 29 (page 15). Use the Uniqueness Tool. Select the option ẋ = x Use of Tools from Interactive Differential Equations with the texts Fundamentals of Differential Equations, 5th edition and Fundamentals of Differential Equations and Boundary Value Problems, 3rd edition

More information

Ocean Modeling - EAS Chapter 2. We model the ocean on a rotating planet

Ocean Modeling - EAS Chapter 2. We model the ocean on a rotating planet Ocean Modeling - EAS 8803 We model the ocean on a rotating planet Rotation effects are considered through the Coriolis and Centrifugal Force The Coriolis Force arises because our reference frame (the Earth)

More information

Final Exam December 20, 2011

Final Exam December 20, 2011 Final Exam December 20, 2011 Math 420 - Ordinary Differential Equations No credit will be given for answers without mathematical or logical justification. Simplify answers as much as possible. Leave solutions

More information

Math 215/255 Final Exam, December 2013

Math 215/255 Final Exam, December 2013 Math 215/255 Final Exam, December 2013 Last Name: Student Number: First Name: Signature: Instructions. The exam lasts 2.5 hours. No calculators or electronic devices of any kind are permitted. A formula

More information

Sheet 5 solutions. August 15, 2017

Sheet 5 solutions. August 15, 2017 Sheet 5 solutions August 15, 2017 Exercise 1: Sampling Implement three functions in Python which generate samples of a normal distribution N (µ, σ 2 ). The input parameters of these functions should be

More information

strings, dictionaries, and files

strings, dictionaries, and files strings, dictionaries, and files 1 Polynomials in Several Variables representing and storing polynomials polynomials in dictionaries and in files 2 Two Modules in Python the module randpoly the module

More information

Solving systems of first order equations with ode Systems of first order differential equations.

Solving systems of first order equations with ode Systems of first order differential equations. A M S 20 MA TLA B NO T E S U C S C Solving systems of first order equations with ode45 c 2015, Yonatan Katznelson The M A T L A B numerical solver, ode45 is designed to work with first order differential

More information

Differential Equations and Modeling

Differential Equations and Modeling Differential Equations and Modeling Preliminary Lecture Notes Adolfo J. Rumbos c Draft date: March 22, 2018 March 22, 2018 2 Contents 1 Preface 5 2 Introduction to Modeling 7 2.1 Constructing Models.........................

More information

Classical Mechanics and Statistical/Thermodynamics. August 2018

Classical Mechanics and Statistical/Thermodynamics. August 2018 Classical Mechanics and Statistical/Thermodynamics August 2018 1 Handy Integrals: Possibly Useful Information 0 x n e αx dx = n! α n+1 π α 0 0 e αx2 dx = 1 2 x e αx2 dx = 1 2α 0 x 2 e αx2 dx = 1 4 π α

More information

Practice Final Exam Solutions

Practice Final Exam Solutions Important Notice: To prepare for the final exam, study past exams and practice exams, and homeworks, quizzes, and worksheets, not just this practice final. A topic not being on the practice final does

More information

Boyce/DiPrima/Meade 11 th ed, Ch 1.1: Basic Mathematical Models; Direction Fields

Boyce/DiPrima/Meade 11 th ed, Ch 1.1: Basic Mathematical Models; Direction Fields Boyce/DiPrima/Meade 11 th ed, Ch 1.1: Basic Mathematical Models; Direction Fields Elementary Differential Equations and Boundary Value Problems, 11 th edition, by William E. Boyce, Richard C. DiPrima,

More information

Math 308, Sections 301, 302, Summer 2008 Review before Test I 06/09/2008

Math 308, Sections 301, 302, Summer 2008 Review before Test I 06/09/2008 Math 308, Sections 301, 302, Summer 2008 Review before Test I 06/09/2008 Chapter 1. Introduction Section 1.1 Background Definition Equation that contains some derivatives of an unknown function is called

More information

Least squares and Eigenvalues

Least squares and Eigenvalues Lab 1 Least squares and Eigenvalues Lab Objective: Use least squares to fit curves to data and use QR decomposition to find eigenvalues. Least Squares A linear system Ax = b is overdetermined if it has

More information

Linear Transformations

Linear Transformations Lab 4 Linear Transformations Lab Objective: Linear transformations are the most basic and essential operators in vector space theory. In this lab we visually explore how linear transformations alter points

More information

Study guide: Generalizations of exponential decay models. Extension to a variable coecient; Crank-Nicolson

Study guide: Generalizations of exponential decay models. Extension to a variable coecient; Crank-Nicolson Extension to a variable coecient; Forward and Backward Euler Study guide: Generalizations of exponential decay models Hans Petter Langtangen 1,2 Center for Biomedical Computing, Simula Research Laboratory

More information

Matlab-Based Tools for Analysis and Control of Inverted Pendula Systems

Matlab-Based Tools for Analysis and Control of Inverted Pendula Systems Matlab-Based Tools for Analysis and Control of Inverted Pendula Systems Slávka Jadlovská, Ján Sarnovský Dept. of Cybernetics and Artificial Intelligence, FEI TU of Košice, Slovak Republic sjadlovska@gmail.com,

More information

Chapter 14. Oscillations. Oscillations Introductory Terminology Simple Harmonic Motion:

Chapter 14. Oscillations. Oscillations Introductory Terminology Simple Harmonic Motion: Chapter 14 Oscillations Oscillations Introductory Terminology Simple Harmonic Motion: Kinematics Energy Examples of Simple Harmonic Oscillators Damped and Forced Oscillations. Resonance. Periodic Motion

More information

Physics 351, Spring 2017, Homework #2. Due at start of class, Friday, January 27, 2017

Physics 351, Spring 2017, Homework #2. Due at start of class, Friday, January 27, 2017 Physics 351, Spring 2017, Homework #2. Due at start of class, Friday, January 27, 2017 Course info is at positron.hep.upenn.edu/p351 When you finish this homework, remember to visit the feedback page at

More information

Mathematical Methods - Lecture 7

Mathematical Methods - Lecture 7 Mathematical Methods - Lecture 7 Yuliya Tarabalka Inria Sophia-Antipolis Méditerranée, Titane team, http://www-sop.inria.fr/members/yuliya.tarabalka/ Tel.: +33 (0)4 92 38 77 09 email: yuliya.tarabalka@inria.fr

More information

Matlab homework assignments for modeling dynamical systems

Matlab homework assignments for modeling dynamical systems Physics 311 Analytical Mechanics - Matlab Exercises C1.1 Matlab homework assignments for modeling dynamical systems Physics 311 - Analytical Mechanics Professor Bruce Thompson Department of Physics Ithaca

More information

Solving Constrained Differential- Algebraic Systems Using Projections. Richard J. Hanson Fred T. Krogh August 16, mathalacarte.

Solving Constrained Differential- Algebraic Systems Using Projections. Richard J. Hanson Fred T. Krogh August 16, mathalacarte. Solving Constrained Differential- Algebraic Systems Using Projections Richard J. Hanson Fred T. Krogh August 6, 2007 www.vni.com mathalacarte.com Abbreviations and Terms ODE = Ordinary Differential Equations

More information

Linear Differential Equations. Problems

Linear Differential Equations. Problems Chapter 1 Linear Differential Equations. Problems 1.1 Introduction 1.1.1 Show that the function ϕ : R R, given by the expression ϕ(t) = 2e 3t for all t R, is a solution of the Initial Value Problem x =

More information