Mathematical Methods and Modeling Laboratory class. Numerical Integration of Ordinary Differential Equations

Similar documents
Module 2: Single Step Methods Lecture 4: The Euler Method. The Lecture Contains: The Euler Method. Euler's Method (Analytical Interpretations)

ODE IVP. An Ordinary Differential Equation (ODE) is an equation that contains a function having one independent variable:

Euler s Methods (a family of Runge- Ku9a methods)

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

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

Ordinary differential equations solving methods

Review Initial Value Problems Euler s Method Summary

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

Finite difference methods

Mathematics for chemical engineers

A Study on Numerical Exact Solution of Euler, Improved Euler and Runge - Kutta Method

Polynomials tend to oscillate (wiggle) a lot, even when our true function does not.

Ordinary Differential Equations

Application 2.4 Implementing Euler's Method

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

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

Contents Computing with Formulas

MATH2071: LAB 2: Explicit ODE methods

The listing says y(1) = How did the computer know this?

Ordinary Differential Equation Solver Language (ODESL) Reference Manual

x n x n stepnumber k order r error constant C r+1 1/2 5/12 3/8 251/720 abs. stab. interval (α,0) /11-3/10

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

Math 225 Scientific Computing II Outline of Lectures

Simulation in Computer Graphics. Particles. Matthias Teschner. Computer Science Department University of Freiburg

4 Visualization and. Approximation

Experiment 8 SIMULINK

8 Piecewise Polynomial Interpolation

CS 130. Scan Conversion. Raster Graphics

dy = dx y dx Project 1 Consider the following differential equations: I. xy II. III.

Queens College, CUNY, Department of Computer Science Numerical Methods CSCI 361 / 761 Spring 2018 Instructor: Dr. Sateesh Mane.

Polymath 6. Overview

Numerical Integration

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

NUMERICAL INTEGRATION AND FUNCTION FUNCTIONS

AOE 5204: Homework Assignment 4 Due: Wednesday, 9/21 in class. Extended to Friday 9/23 Online Students:

Determination of Inner and Outer Bounds of Reachable Sets

Surfaces and Partial Derivatives

Using Modified Euler Method (MEM) for the Solution of some First Order Differential Equations with Initial Value Problems (IVPs).

Math 133A, September 10: Numerical Methods (Euler & Runge-Kutta) Section 1: Numerical Methods

Geometric Modeling Assignment 3: Discrete Differential Quantities

An interesting related problem is Buffon s Needle which was first proposed in the mid-1700 s.

MAT 275 Laboratory 2 Matrix Computations and Programming in MATLAB

Homework 14 solutions

Exact equations are first order DEs of the form M(x, y) + N(x, y) y' = 0 for which we can find a function f(x, φ(x)) so that

Sparse Optimization Lecture: Proximal Operator/Algorithm and Lagrange Dual

LAB #8 Numerical Methods

Asymptotic Error Analysis

Euler s Method with Python

Surfaces and Partial Derivatives

An ε-uniform Initial Value Technique For Convection-Diffusion Singularly Perturbed Problems

D.K.M.COLLEGE FOR WOMEN (AUTONOMOUS), VELLORE-1.

Index. C m (Ω), 141 L 2 (Ω) space, 143 p-th order, 17

Lecture 8: Euler s Methods

Continuity and Tangent Lines for functions of two variables

Natural Quartic Spline

Optimization with Gradient and Hessian Information Calculated Using Hyper-Dual Numbers

MAT 275 Laboratory 2 Matrix Computations and Programming in MATLAB

Deficient Quartic Spline Interpolation

Numerical Simulation of Dynamic Systems XXIV

AMSC/CMSC 460 Final Exam, Fall 2007

The Euler and trapezoidal stencils to solve d d x y x = f x, y x

A First Course on Kinetics and Reaction Engineering Example S4.5

Reals 1. Floating-point numbers and their properties. Pitfalls of numeric computation. Horner's method. Bisection. Newton's method.

Chapter 3 Numerical Methods

Natasha S. Sharma, PhD

B. Examples Set up the integral(s) needed to find the area of the region bounded by

Euler s Method for Approximating Solution Curves

Calculus I Review Handout 1.3 Introduction to Calculus - Limits. by Kevin M. Chevalier

1. Chapter 1, # 1: Prove that for all sets A, B, C, the formula

ORDINARY DIFFERENTIAL EQUATIONS

General properties of staircase and convex dual feasible functions

Objectives. Materials

7.1 First-order initial-value problems

Introduction to Programming for Engineers Spring Final Examination. May 10, Questions, 170 minutes

DD2429 Computational Photography :00-19:00

Numerical Methods for PDEs : Video 9: 2D Finite Difference February 14, Equations / 29

Mathematica CalcCenter

A Brief Look at Optimization

99 International Journal of Engineering, Science and Mathematics

Approximate Solutions to Differential Equations Slope Fields (graphical) and Euler s Method (numeric) by Dave Slomer

Lesson 20: Four Interesting Transformations of Functions

Real-Time Architectures 2004/2005

AP Calculus. Slide 1 / 213 Slide 2 / 213. Slide 3 / 213. Slide 4 / 213. Slide 4 (Answer) / 213 Slide 5 / 213. Derivatives. Derivatives Exploration

A parameter corresponding to the symmetry of the problem. m can be slab = 0, cylindrical = 1, or spherical = 2.

Optimizing Finite Automata

1.5 Equations of Lines and Planes in 3-D

Interpolation by Spline Functions

Section 6.1 Estimating With Finite Sums

Today. Motivation. Motivation. Image gradient. Image gradient. Computational Photography

MAT 275 Laboratory 2 Matrix Computations and Programming in MATLAB

3.1 Iterated Partial Derivatives

Comparison of different solvers for two-dimensional steady heat conduction equation ME 412 Project 2

MAT 275 Laboratory 1 Introduction to MATLAB

Homework Set 5 (Sections )

COURSE: NUMERICAL ANALYSIS. LESSON: Methods for Solving Non-Linear Equations

=.1( sin(2πx/24) y) y(0) = 70.

Numerical Integration

Mass-Spring Systems. Last Time?

Real-Time Simulation of Simscape Models

Lecture 9. Curve fitting. Interpolation. Lecture in Numerical Methods from 28. April 2015 UVT. Lecture 9. Numerical. Interpolation his o

Transcription:

Mathematical Methods and Modeling Laboratory class Numerical Integration of Ordinary Differential Equations

Exact Solutions of ODEs Cauchy s Initial Value Problem in normal form: Recall: if f is locally Lipschitz-continuous there is an unique local solution if f is (uniformly) Lipschitz-continuous on all I there is an unique solution in I, i.e. global solution

Numerical Analysis If solution can hardly be explicited numerical Numerical Analysis is the branch of mathematics studying approximation methods for solving equations applications on calculators

Explicit Euler Method For finding an approximate (or numerical) solution of an ODE in normal form, first discretize the domain I into n subintervals of width h: s.t. Discretize the derivative y (x) with the (forward) finite difference: Denote and suppose to be able to calculate

Explicit Euler Method The ODE can then be approximated as Approximate solution: This formula for calculating the approximate solution is called Explicit/Forward Euler Method Necessary: Initially: At each step: Decide discretization step h It can be shown consistent:

Implicit Euler Method Conversely, if we take the backward finite difference we have the approximation: This formula is called Implicit/Backward Euler Method However, in this method we have to solve the equation (with f appearing) in the unknown In practice, when f(x,y) behaves badly, Implicit method is preferred if computationally feasible

Theta-Method Instead, fix in [0,1] and take the intermediate value of f: Then it is easy to derive a generalization of EMs: This formula is called the -method Clearly, with it is Explicit/Implicit EM Is it explicit or implicit? It has better convergence properties

Example Find the numerical solution to Cauchy s IVP Compare it with the exact solution 1. Define the M-file for function f(t,y) = 3t-ty 2. Fix h>0 and find numerical solution u by EEM 3. Draw y, u and the error y-u

Example Let's try to numerically solve previous IVP with IEM. Unluckly, this time it is not possible to use MATLAB for inverting f(t,y) w.r.t. y. Hence, invert it with paper & pencil That yields Compare IEM's to EEM's and exact solution y, finding maximum absolute error and sum-ofsquares error

MATLAB ODE Solver Luckly, MATLAB already has algorithms for ODEs ode45 function finds approximate solutions for most of simple non-stiff problems. Basic syntax: [T,Y] = ode45(@fun,[x0 xf],initvals); @fun is handle to funcion fun defining f(x,y) x0,xf are initial and final values of interval I vector initvals contains Cauchy s initial value(s) of the solution(s): y(x0) odeset function can set some options of ODE Solver specified as additional argument. Eg.: odeopt = odeset('reltol',1e-4,'abstol', [1e-4 1e-4 1e-5]);

Example Find the numerical solution to Cauchy s IVP Compare it with the exact solution 1. Define the function f(t,y) = 3t-ty 2. Call ode45 function 3. Draw y, u and the error y-u

Example Find the numerical solution to Cauchy s IVP Compare it with the exact solution 1. Define the function f(t,y) 2. Call ode45 function 3. Draw y, u and the error y-u

Higher order ODE A n-th order ODE y (n) =f(t,y,y',...,y (n-1) ) can be transformed into a system of n ODEs with n variables Example: equation of Van der Pol Oscillator after assigning y=x', it can be rewritten as system Try solving through MATLAB with in the interval [0, 20]

Higher order ODE Create the M-file vaderpol.m defining the vector function f(t,y) needed by ode45: function out = vanderpol(t,x) %as stated in the documentation this function has %to take as arguments: time t and state-variable x. mu = 2; %parameter of the Van der Pol oscillator end out = [0; 0]; out(1) = x(2); out(2) = mu*(1-x(1)^2)*x(2) - x(1);

Higher order ODE Then in the command window run the instruction [T,Y] = ode45(@vanderpol, [0 20], [2 0]); and draw the trajectory: plot3(t,y(:,1),y(:,2)); xlabel('t'); ylabel('x'), zlabel('y');