AMS 147 Computational Methods and Applications Lecture 13 Copyright by Hongyun Wang, UCSC

Similar documents
AMS 212A Applied Mathematical Methods I Lecture 14 Copyright by Hongyun Wang, UCSC. with initial condition

Section 8.5. z(t) = be ix(t). (8.5.1) Figure A pendulum. ż = ibẋe ix (8.5.2) (8.5.3) = ( bẋ 2 cos(x) bẍ sin(x)) + i( bẋ 2 sin(x) + bẍ cos(x)).

ERASMUS UNIVERSITY ROTTERDAM Information concerning the Entrance examination Mathematics level 2 for International Business Administration (IBA)

MATH 131P: PRACTICE FINAL SOLUTIONS DECEMBER 12, 2012

1 Separation of Variables

6.003 Homework #10 Solutions

{ } is an asymptotic sequence.

Vector Spaces. EXAMPLE: Let R n be the set of all n 1 matrices. x 1 x 2. x n

Math 251 December 14, 2005 Answer Key to Final Exam. 1 18pt 2 16pt 3 12pt 4 14pt 5 12pt 6 14pt 7 14pt 8 16pt 9 20pt 10 14pt Total 150pt

Review session Midterm 1

AMS 212A Applied Mathematical Methods I Appendices of Lecture 06 Copyright by Hongyun Wang, UCSC. ( ) cos2

( ), λ. ( ) =u z. ( )+ iv z

Chapter 10: Partial Differential Equations

Strauss PDEs 2e: Section Exercise 4 Page 1 of 6

1 Systems of Differential Equations

2.4 Eigenvalue problems

Lecture 24. Scott Pauls 5/21/07

Differential Equations

Introduction to the Fourier transform. Computer Vision & Digital Image Processing. The Fourier transform (continued) The Fourier transform (continued)

Math 216 Second Midterm 28 March, 2013

1. Define the following terms (1 point each): alternative hypothesis

CLTI Differential Equations (3A) Young Won Lim 6/4/15

Math 4263 Homework Set 1

[ ] is a vector of size p.

Math 2930 Worksheet Final Exam Review

ERASMUS UNIVERSITY ROTTERDAM

MATH 251 Final Examination August 14, 2015 FORM A. Name: Student Number: Section:

The Fourier series for a 2π-periodic function

MCS 115 Exam 2 Solutions Apr 26, 2018

Ma 221 Final Exam Solutions 5/14/13

AMS 147 Computational Methods and Applications Lecture 17 Copyright by Hongyun Wang, UCSC

Partial Differential Equations Summary

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

MA3232 Summary 5. d y1 dy1. MATLAB has a number of built-in functions for solving stiff systems of ODEs. There are ode15s, ode23s, ode23t, ode23tb.

LINEAR EQUATIONS OF HIGHER ORDER. EXAMPLES. General framework

Linear DifferentiaL Equation

12.7 Heat Equation: Modeling Very Long Bars.

MTH4101 CALCULUS II REVISION NOTES. 1. COMPLEX NUMBERS (Thomas Appendix 7 + lecture notes) ax 2 + bx + c = 0. x = b ± b 2 4ac 2a. i = 1.

Partial differential equation for temperature u(x, t) in a heat conducting insulated rod along the x-axis is given by the Heat equation:

Euler-Cauchy Using Undetermined Coefficients

Physics 505 Homework No. 3 Solutions S3-1

MATH 225: Foundations of Higher Matheamatics. Dr. Morton. 3.4: Proof by Cases

Review For the Final: Problem 1 Find the general solutions of the following DEs. a) x 2 y xy y 2 = 0 solution: = 0 : homogeneous equation.

3.5 Solving Quadratic Equations by the

Math 260: Solving the heat equation

Math 308 Final Exam Practice Problems

3. Frequency-Domain Analysis of Continuous- Time Signals and Systems

The integrating factor method (Sect. 1.1)

PUTNAM PROBLEMS DIFFERENTIAL EQUATIONS. First Order Equations. p(x)dx)) = q(x) exp(

MA 201, Mathematics III, July-November 2016, Partial Differential Equations: 1D wave equation (contd.) and 1D heat conduction equation

How to Solve Linear Differential Equations

Lecture 10. (2) Functions of two variables. Partial derivatives. Dan Nichols February 27, 2018

ES.1803 Topic 7 Notes Jeremy Orloff. 7 Solving linear DEs; Method of undetermined coefficients

Polynomial Degree and Finite Differences

1D Wave PDE. Introduction to Partial Differential Equations part of EM, Scalar and Vector Fields module (PHY2064) Richard Sear.

Polytechnic Institute of NYU MA 2132 Final Practice Answers Fall 2012

MATH The Chain Rule Fall 2016 A vector function of a vector variable is a function F: R n R m. In practice, if x 1, x n is the input,

An Introduction to Partial Differential Equations

ENGI 9420 Lecture Notes 8 - PDEs Page 8.01

MATH 3150: PDE FOR ENGINEERS FINAL EXAM (VERSION D) 1. Consider the heat equation in a wire whose diffusivity varies over time: u k(t) 2 x 2

10 Motivation for Fourier series

Lecture 8 Analyzing the diffusion weighted signal. Room CSB 272 this week! Please install AFNI

Ex. 1. Find the general solution for each of the following differential equations:

Lecture 6 Quantum Mechanical Systems and Measurements

Continuous-time Fourier Methods

Partial Differential Equations Separation of Variables. 1 Partial Differential Equations and Operators

Lecture 3: Initial and boundary value problems in 1 dimension

Int Math 3 Midterm Review Handout (Modules 5-7)

MATH 2250 Final Exam Solutions

Second Order ODE's (2A) Young Won Lim 5/5/15

Periodic functions: simple harmonic oscillator

" $ CALCULUS 2 WORKSHEET #21. t, y = t + 1. are A) x = 0, y = 0 B) x = 0 only C) x = 1, y = 0 D) x = 1 only E) x= 0, y = 1

1 + lim. n n+1. f(x) = x + 1, x 1. and we check that f is increasing, instead. Using the quotient rule, we easily find that. 1 (x + 1) 1 x (x + 1) 2 =

MA22S3 Summary Sheet: Ordinary Differential Equations

8.3 Partial Fraction Decomposition

Last Update: April 7, 201 0

Differential equations

FinQuiz Notes

Math 2Z03 - Tutorial # 6. Oct. 26th, 27th, 28th, 2015

Math 54: Mock Final. December 11, y y 2y = cos(x) sin(2x). The auxiliary equation for the corresponding homogeneous problem is

Advection, Conservation, Conserved Physical Quantities, Wave Equations

Problem set 3: Solutions Math 207B, Winter Suppose that u(x) is a non-zero solution of the eigenvalue problem. (u ) 2 dx, u 2 dx.

2t t dt.. So the distance is (t2 +6) 3/2

PHYS 404 Lecture 1: Legendre Functions

Hilbert Inner Product Space (2B) Young Won Lim 2/7/12

Chapter 11. Taylor Series. Josef Leydold Mathematical Methods WS 2018/19 11 Taylor Series 1 / 27

Math221: HW# 7 solutions

Emily Jennings. Georgia Institute of Technology. Nebraska Conference for Undergraduate Women in Mathematics, 2012

Homework 3 Solutions Math 309, Fall 2015

Higher-order ordinary differential equations

so mathematically we can say that x d [n] is a discrete-time signal. The output of the DT system is also discrete, denoted by y d [n].

Ordinary Differential Equation Theory

MATH 200 WEEK 5 - WEDNESDAY DIRECTIONAL DERIVATIVE

LECTURE 14: REGULAR SINGULAR POINTS, EULER EQUATIONS

Math 581 Problem Set 9

dx n a 1(x) dy

The Final Exam is comprehensive but identifying the topics covered by it should be simple.

Introduction to Differential Equations

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

Signals and Systems Lecture (S2) Orthogonal Functions and Fourier Series March 17, 2008

Transcription:

Lecture 13 Copyright y Hongyun Wang, UCSC Recap: Fitting to exact data *) Data: ( x j, y j ), j = 1,,, N y j = f x j *) Polynomial fitting Gis phenomenon *) Cuic spline Convergence of cuic spline *) Application #1 of cuic spline: Find the period of a function represented y N data points We look at another application of cuic spline. Application # of cuic spline: Find the distance from a point to a trajectory Consider a D trajectory {x(t), y(t), 1 < t < } that is only represented y N data points. ( t i, x i, y i ), i = 1,,, N x i = xt ( i ) y i = yt ( i ) Data format: td = [ t 1, t,, t N ]: t-values of the data xd = [ x 1, x,, x N ]: x-values of the data yd = [ y 1, y,, y N ]: y-values of the data Goal: Find the distance from a given point (u, v) to the trajectory {x(t), y(t), 1 < t < }. Consider the distance etween (u, v) and a point (x(t), y(t)) on the trajectory: dd ()= t u xt ( ()) + v yt () - 1 -

he distance from (u, v) to the trajectory is defined as min dd t t () We look at how to calculate dd(t) for any given value of t. Matla code dd.m: function [dist] = dd(t, td, xd, yd, u, v) xt=spline(td, xd, t); yt=spline(td, yd, t); dist=norm([u,v]-[xt,yt]); Once we have the distance function, we use the golden search method to minimize dd(t). t = arg min t dd () t he distance from (u, v) to the trajectory is dd ( t ) Fitting to data with noise For fitting to data with noise, first we are going to look at the least squares fitting. hen we are going to discuss the Fourier transform as a separate suject ecause the Fourier transform has many roader applications, not limited to fitting to data with noise. Least squares fitting Given a set of N data points: ( x j, y j ), j = 1,,, N y j = f x j + j Measured value Exact value Noise Consider a fitting function of the form gx = 1 g 1 ( x) + g ( x) + + p g p ( x) where ase functions g 1 ( x), g ( x),, g p ( x) are given and coefficients 1,,, p are to e determined (undetermined coefficients). - -

he fitting function gx is a linear comination of the given ase functions. N: numer of data points p: numer of undetermined coefficients In the least squares fitting, usually N is much larger than p: N >> p (for example, N =, p = 3) Example: gx = 1 + x + 3 x In this example, the ase functions are ( x)= 1, g ( x)= x, g ( x)= x g 1 Example: gx = 1 + cos( x) + 3 sin( x) In this example, the ase functions are ( x)= 1, g ( x)= cos( x), g ( x)= sin x g 1 Let us put the undetermined coefficients into a vector. = 1,,, p Consider a measure of distance etween the fitting function gx and the date. N = ( gx ( j ) y j ) q j =1 which is the sum of squares of differences. he distance q is a function of the undetermined coefficients Goal: Solve the minimization prolem arg min q = ( 1,,, p ). Note that in the least squares fitting, the undetermined coefficients appear linearly. As a result, in the least squares fitting, we only need to solve a linear system instead of a non-linear system. We like to write everything in vector notation. - 3 -

Vector notation: = 1,,, p a vector of size p x = ( x 1, x,, x N ) a vector of size N y = y 1, y,, y N g k = g k ( x 1 ), g k ( x ),, g k x N Or g k = g k ( x) g = gx ( 1 ), gx ( ),, gx ( N ) a vector of size N ( ) a vector of size N a vector of size N Or g = g( x ) We write vector g as g = 1 g 1 + g + + p g p In terms of matrix-vector multiplication, it is g = G where G = ( g 1, g,, g p ) an N p matrix With the matrix-vector notation, we write q = q ( g y ) ( g y ) = G as ( y ) ( G y ) o solve the minimization prolem, we need the gradient of q he gradient of q( ) is q( )= ( G y ) G (See Appendix for the derivation). Note that the gradient q Suppose q is a row vector. attains the minimum at ==> ( q( )) = ==> (( G y ) G) =. - 4 -

==> G ( G y )= ==> G G G y = ==> ( G G) = G y his is called the normal equation of the least squares prolem. It has the form of a linear system A = c where A = G G c = G y a p p matrix a vector of size p In Matla, to solve A= c, we simply use = A \ c ; Steps in implementing the least squares 1) Get data x = ( x 1, x,, x N ) y = y 1, y,, y N ) Calculate g k = g k ( x) G = g 1, g,, 3) Calculate ( g p ) A = G G c = G y 4) Solve A = c Fourier transform Review of the complex exponential function he special imaginary numer: i = 1 Euler formula: exp i = cos + isin( ) - 5 -

Special cases: exp i = 1 exp i = i exp( i ) = 1 exp( i )= 1 =1 for n = integer exp in he complex exponential function has the same properties as the real exponential function: exp( i 1 + i ) = exp( i 1 )exp( i ) p exp i = exp ip d exp( i) = i exp( i) d Integrals of the complex exponential function: exp( i)d = 1 exp i i a a for For k = integer, we have exp i k 1 d = i k For k =, we have exp i k 1 = exp i k d = 1d = Summarizing the two cases, we have exp i k, k d =, k = for k = integer Fourier transform theorem: Suppose f ( t) is periodic with period. hen f ( t) can e expressed as - 6 -

= c k exp i kt f t k = { c k, < k < } are called Fourier coefficients. Question: How to find c k? o find c k, we multiply oth sides y exp i jt f()exp t i jt = c k exp i ( k j)t k = hen we integrate from to f()exp t i jt dt = c k exp i ( k j)t dt k = In the aove, we derived exp i ( k j)t dt, k j =, k = j ==> f()exp t i jt dt = c j he Fourier coefficients are given y c k = 1 Fourier transform is a mapping f(), t t < f()exp t i kt dt { } { c k, < k < } Applications of Fourier transform: Solving PDE Noise removal Data compression Example: Using Fourier transform to solve an initial value prolem Consider the initial value prolem of 1-D heat equation - 7 -

u t = u xx u( x,)= u x u(x, t) is the temperature at position x at time t. he 1-D heat equation descries the heat conduction along an insulated thin rod. Suppose u (x) is periodic with period = L. Function u (x) has the Fourier transform u ( x)= c k exp i kx L k = where the Fourier coefficients have the expression L c k = 1 L u ( x)exp i kx L dx heorem: he solution of the initial value prolem is given y u ( x,t )= c exp k k L k = kx t exp i L Verify the theorem: We need to verify that u(x, t) given aove satisfies i) the initial value and ii) the PDE. u ( x, )= c exp k k L k = u t = u xx = k = = c k exp i kx L = u x k = k = ==> u t = u xx c k exp k L c k exp k L kx exp i L t k L t i k L kx exp i L exp i kx L Example: Using Fourier transform to solve an initial-oundary value prolem Consider the initial-oundary value prolem of 1-D heat equation - 8 -

u t = u xx u(, t)=, u( L, t)= u( x,)= u ( x), x L We first extend u (x) to an odd function. w ( x)= u ( x), x L u ( x), L x hen we extend w (x) periodically with period = L. Function w (x) has the Fourier transform w ( x)= d k exp i kx ( L) k = where the Fourier coefficients have the expression d k = 1 L = 1 L L w L L u ( x)exp i kx L dx ( x) exp i kx kx ( L) exp i ( L) dx heorem: he solution of the initial-oundary value prolem is given y u( x,t)= d k exp k L k = kx t exp i L - 9 -

Appendix: Gradient of q( ) First, it is straightforward to verify that z ( z )= z z Let z = G y. We have q( )= z z z z ( z )= z Using the chain rule, we have q( )= z z ( z ) z ==> q( )= ( G y ) G - 1 -