The Heat Equation. Lectures INF2320 p. 1/88



Similar documents
MATH 425, PRACTICE FINAL EXAM SOLUTIONS.

Second Order Linear Partial Differential Equations. Part I

The one dimensional heat equation: Neumann and Robin boundary conditions

An Introduction to Partial Differential Equations

College of the Holy Cross, Spring 2009 Math 373, Partial Differential Equations Midterm 1 Practice Questions

Rolle s Theorem. q( x) = 1

Høgskolen i Narvik Sivilingeniørutdanningen STE6237 ELEMENTMETODER. Oppgaver

EXISTENCE AND NON-EXISTENCE RESULTS FOR A NONLINEAR HEAT EQUATION

Inner Product Spaces

Nonlinear Algebraic Equations. Lectures INF2320 p. 1/88

BANACH AND HILBERT SPACE REVIEW

No: Bilkent University. Monotonic Extension. Farhad Husseinov. Discussion Papers. Department of Economics

General Theory of Differential Equations Sections 2.8, , 4.1

Application of Fourier Transform to PDE (I) Fourier Sine Transform (application to PDEs defined on a semi-infinite domain)

PUTNAM TRAINING POLYNOMIALS. Exercises 1. Find a polynomial with integral coefficients whose zeros include

3. INNER PRODUCT SPACES

Class Meeting # 1: Introduction to PDEs

Systems with Persistent Memory: the Observation Inequality Problems and Solutions

Numerical methods for American options

Pacific Journal of Mathematics

2.3 Convex Constrained Optimization Problems

TOPIC 4: DERIVATIVES

Metric Spaces. Chapter Metrics

Taylor and Maclaurin Series

4. Complex integration: Cauchy integral theorem and Cauchy integral formulas. Definite integral of a complex-valued function of a real variable

Sequences and Series

The Method of Least Squares. Lectures INF2320 p. 1/80

1 if 1 x 0 1 if 0 x 1

OPTIMAL CONTROL OF A COMMERCIAL LOAN REPAYMENT PLAN. E.V. Grigorieva. E.N. Khailov

Fourth-Order Compact Schemes of a Heat Conduction Problem with Neumann Boundary Conditions

The two dimensional heat equation

Differentiation of vectors

Undergraduate Notes in Mathematics. Arkansas Tech University Department of Mathematics

Numerical Analysis Lecture Notes

15 Kuhn -Tucker conditions

Parabolic Equations. Chapter 5. Contents Well-Posed Initial-Boundary Value Problem Time Irreversibility of the Heat Equation

4.5 Chebyshev Polynomials

CHAPTER SIX IRREDUCIBILITY AND FACTORIZATION 1. BASIC DIVISIBILITY THEORY

1 Completeness of a Set of Eigenfunctions. Lecturer: Naoki Saito Scribe: Alexander Sheynis/Allen Xue. May 3, The Neumann Boundary Condition

Lecture 13 Linear quadratic Lyapunov theory

FIRST YEAR CALCULUS. Chapter 7 CONTINUITY. It is a parabola, and we can draw this parabola without lifting our pencil from the paper.

TMA4213/4215 Matematikk 4M/N Vår 2013

Duality in General Programs. Ryan Tibshirani Convex Optimization /36-725

CHAPTER II THE LIMIT OF A SEQUENCE OF NUMBERS DEFINITION OF THE NUMBER e.

1 The 1-D Heat Equation

LECTURE 15: AMERICAN OPTIONS

Numerical PDE methods for exotic options

The degree of a polynomial function is equal to the highest exponent found on the independent variables.

Economics 2020a / HBS 4010 / HKS API-111 FALL 2010 Solutions to Practice Problems for Lectures 1 to 4

n k=1 k=0 1/k! = e. Example 6.4. The series 1/k 2 converges in R. Indeed, if s n = n then k=1 1/k, then s 2n s n = 1 n

Section 3.7. Rolle s Theorem and the Mean Value Theorem. Difference Equations to Differential Equations

5.4 The Heat Equation and Convection-Diffusion

Lectures 5-6: Taylor Series

Level Set Framework, Signed Distance Function, and Various Tools

In this section, we will consider techniques for solving problems of this type.

FACTORING POLYNOMIALS IN THE RING OF FORMAL POWER SERIES OVER Z

THE FUNDAMENTAL THEOREM OF ALGEBRA VIA PROPER MAPS

Microeconomic Theory: Basic Math Concepts

9 More on differentiation

Homework # 3 Solutions

x a x 2 (1 + x 2 ) n.

3 Contour integrals and Cauchy s Theorem

Calculus 1: Sample Questions, Final Exam, Solutions

MATH 381 HOMEWORK 2 SOLUTIONS

SECOND-ORDER LINEAR DIFFERENTIAL EQUATIONS

On computer algebra-aided stability analysis of dierence schemes generated by means of Gr obner bases

CITY UNIVERSITY LONDON. BEng Degree in Computer Systems Engineering Part II BSc Degree in Computer Systems Engineering Part III PART 2 EXAMINATION

Notes on metric spaces

y cos 3 x dx y cos 2 x cos x dx y 1 sin 2 x cos x dx

The continuous and discrete Fourier transforms

Lecture 4: BK inequality 27th August and 6th September, 2007

A QUICK GUIDE TO THE FORMULAS OF MULTIVARIABLE CALCULUS

MATH 4330/5330, Fourier Analysis Section 11, The Discrete Fourier Transform

e.g. arrival of a customer to a service station or breakdown of a component in some system.

24. The Branch and Bound Method

RANDOM INTERVAL HOMEOMORPHISMS. MICHA L MISIUREWICZ Indiana University Purdue University Indianapolis

1. Let X and Y be normed spaces and let T B(X, Y ).

y cos 3 x dx y cos 2 x cos x dx y 1 sin 2 x cos x dx y 1 u 2 du u 1 3u 3 C

Algebra Unpacked Content For the new Common Core standards that will be effective in all North Carolina schools in the school year.

Metric Spaces. Chapter 1

Factoring Polynomials

The Exponential Distribution

Date: April 12, Contents

Numerical Methods for Differential Equations

Math 55: Discrete Mathematics

A REMARK ON ALMOST MOORE DIGRAPHS OF DEGREE THREE. 1. Introduction and Preliminaries

Introduction to Partial Differential Equations By Gilberto E. Urroz, September 2004

Chapter 4, Arithmetic in F [x] Polynomial arithmetic and the division algorithm.

INTERPOLATION. Interpolation is a process of finding a formula (often a polynomial) whose graph will pass through a given set of points (x, y).

N 1. (q k+1 q k ) 2 + α 3. k=0

An important theme in this book is to give constructive definitions of mathematical objects. Thus, for instance, if you needed to evaluate.

Rotation Rate of a Trajectory of an Algebraic Vector Field Around an Algebraic Curve

tegrals as General & Particular Solutions

Continued Fractions and the Euclidean Algorithm

Estimating the Average Value of a Function

INDISTINGUISHABILITY OF ABSOLUTELY CONTINUOUS AND SINGULAR DISTRIBUTIONS

1. Prove that the empty set is a subset of every set.

A characterization of trace zero symmetric nonnegative 5x5 matrices

MATH PROBLEMS, WITH SOLUTIONS

Transcription:

The Heat Equation Lectures INF232 p. 1/88

Lectures INF232 p. 2/88 The Heat Equation We study the heat equation: u t = u xx for x (,1), t >, (1) u(,t) = u(1,t) = for t >, (2) u(x,) = f(x) for x (,1), (3) where f is a given initial condition defined on the unit interval (,1). We shall in the following study physical properties of heat conduction versus the mathematical model (1)-(3) separation of variables - a technique, for computing the analytical solution of the heat equation analyze the stability properties of the explicit numerical method

Lectures INF232 p. 3/88 Energy arguments We define the energy of the solution u at a time t by E 1 (t) = u 2 (x,t)dx for t. (4) Note that this is not the physical energy This energy is a mathematical tool, used to study the behavior of the solution We shall see that E 1 (t) is a non-increasing function of time

Lectures INF232 p. 4/88 Energy arguments If we multiply the left and right hand sides of the heat equation (1) by u it follows that u t u = u xx u for x (,1), t > By the chain rule for differentiation we observe that t u2 = 2uu t Hence 1 2 t u2 = u xx u for x (,1), t >

Lectures INF232 p. 5/88 Energy arguments By integrating both sides with respect to x, and applying the rule of integration by parts, we get 1 2 t u2 (x,t)dx = u xx (x,t)u(x,t)dx (5) = u x (1,t)u(1,t) u x (,t)u(,t) = u x (x,t)u x (x,t)dx u 2 x(x,t)dx for t >, where the last equality is a consequence of the boundary condition (2)

Lectures INF232 p. 6/88 Energy arguments We assume that u is a smooth solution of the heat equation, which implies that we can interchange the order of integration and derivation in (5), that is t u 2 (x,t)dx = 2 u 2 x(x,t)dx for t > (6) Therefore E 1(t) = 2 u 2 x(x,t)dx for t > This implies that E 1(t)

Lectures INF232 p. 7/88 Energy arguments Thus E 1 is a non-increasing function of time t, i.e., In particular E 1 (t 2 ) E 1 (t 1 ) for all t 2 t 1 u 2 (x,t)dx u 2 (x,)dx = f 2 (x)dx for t > (7)

Lectures INF232 p. 8/88 Energy arguments This means that the energy, in the sense of E 1 (t), is a non-increasing function of time The integral of u 2 x with respect to x, tells us how fast the energy decreases From a physical point of view it seems reasonable that a the energy will decrease in a system without any heat source In the following we study another energy function which can be analyzed in a similar manner

Lectures INF232 p. 9/88 Energy arguments Define the new energy function E 2 (t) = u 2 x(x,t)dx Similar to above, we can multiply by u t and integrate with respect to x and get u 2 t (x,t)dx = u xx (x,t)u t (x,t)dx

Lectures INF232 p. 1/88 Energy arguments Integration by parts leads to u 2 t (x,t)dx = [u x (x,t)u t (x,t)] 1 = u x (,t)u t (,t) u x (1,t)u t (1,t) u x (x,t)u xt (x,t)dx u x (x,t)u tx (x,t)dx By the chain rule we get t u2 x = 2u x u xt

Lectures INF232 p. 11/88 Energy arguments Hence u 2 t (x,t)dx = u x (,t)u t (,t) u x (1,t)u t (1,t) u x (x,t)u xt (x,t)dx = u x (,t)u t (,t) u x (1,t)u t (1,t) 1 2 t u2 x(x,t)dx We can interchange the order of integration and differentiation and thereby conclude that 1 2 t u 2 x(x,t)dx = u 2 t (x,t)dx u x (,t)u t (,t) + u x (1,t)u t (1,t)

Lectures INF232 p. 12/88 Energy arguments According to the boundary condition (2), u(,t) = u(1,t) = for all t > Since u(,t) and u(1,t) are constant with respect to time, we can conclude that u t (,t) = u t (1,t) = for t > (8)

Lectures INF232 p. 13/88 Energy arguments Thus, we get that E 2(t) = t u 2 x(x,t)dx = 2 u 2 t (x,t)dx, This means that E 2 is a non-increasing function of time, i.e. E 2 (t 2 ) E 2 (t 1 ) for all t 2 t 1 (9) u 2 x(x,t)dx u 2 x(x,)dx = f 2 x (x)dx, t >

Lectures INF232 p. 14/88 Stability We will now study how modifications of the initial condition (3) influence on the solution Consider the problem with a modified initial condition v t = v xx for x (,1), t > (1) v(,t) = v(1,t) = for t > (11) v(x,) = g(x) for x (,1) (12) If g is close to f, will v be approximately equal to u?

Lectures INF232 p. 15/88 Stability Let e denote the difference between u and v, i.e. e(x,t) = u(x,t) v(x,t) for x [,1], t From equations (1) and (1) we find that e t = (u v) t = u t v t = u xx v xx = (u v) xx = e xx Furthermore from (2)-(3) and (11)-(12) we get e(,t) = u(,t) v(,t) = = for t > e(1,t) = u(1,t) v(1,t) = = for t > e(x,) = u(x,) v(x,) = f(x) g(x) for x (,1)

Lectures INF232 p. 16/88 Stability Thus, e solves the heat equation with homogeneous Dirichlet boundary conditions at x =,1 and with initial condition h = f g From the above discussion, we therefore get that e 2 (x,t)dx h 2 (x)dx, t >, (u(x,t) v(x,t)) 2 dx ( f(x) g(x)) 2 dx, t > (13)

Lectures INF232 p. 17/88 Stability Thus, if g is close to f then the integral of (u v) 2, at any time t >, must be small Hence, we conclude that minor changes in the initial condition of (1)-(3) will not alter its solution significantly The problem is stable with respect to changes in the initial condition

Lectures INF232 p. 18/88 Uniqueness We will now prove that (1)-(3) can have at most one smooth solution Assume that both u and v are smooth solutions of this problem Using the above notation, this means that g(x) = f(x), x (,1) (13) implies that (u(x,t) v(x,t)) 2 dx =, t >

Lectures INF232 p. 19/88 Uniqueness Note that the function (u v) 2 is continuous, and furthermore (u(x,t) v(x,t)) 2 for all x [,1] and t We can therefore conclude that u(x,t) = v(x,t) for all x [,1] and t

Lectures INF232 p. 2/88 Maximum principles We know that the solution of (1)-(3), will be more and more smooth, and that it will approach zero, as time increases Physically it is reasonable that the maximum temperature must appear either initially or at the boundary We now study the initial-boundary value problem u t = u xx for x (,1), t > (14) u(,t) = g 1 (t) and u(1,t) = g 2 (t) for t > (15) u(x,) = f(x) for x (,1) (16) We shall see that the maximum value of the solution u(x,t) will occur initially or on the boundary

Lectures INF232 p. 21/88 Calculus First, we recall an important theorem from calculus Let q(x), x [,1] be a smooth function of one variable, which attains its maximum value at an interior point x, i.e. x (,1) and q(x) q(x ) for all x [,1] Then q must satisfy q (x ) = q (x )

Lectures INF232 p. 22/88 Calculus Consequently, if a smooth function h(x), defined on [,1], is such that or h (x) for all x (,1) h (x) > for all x (,1), then h must attain its maximum value at one of the endpoints

Lectures INF232 p. 23/88 Calculus Hence, we conclude that h() h(x) for all x [,1] (17) or h(1) h(x) for all x [,1] (18) Furthermore, if (17) hold, then h must satisfy h (), (19) and if (18) is the case, then it follows that h (1) (2)

Lectures INF232 p. 24/88 Calculus Let v = v(x,t) be a smooth function of space x [,1] and time t [,T] That is, we assume that the partial derivatives of all orders of v with respect x and t are continuous, and that where v : Ω T IR, Ω T = {(x,t) < x < 1 and < t < T }, (21) Ω T = {(x,) x 1} {(1,t) t T } {(x,t) x 1} {(,t) t T } (22) and Ω T = Ω T Ω T (23)

Lectures INF232 p. 25/88 Calculus Assume that (x,t ) Ω T, an interior point, is a maximum point for v in Ω T, i.e., v(x,t) v(x,t ) for all (x,t) Ω T Then, as in the single variable case, v must satisfy v x (x,t ) =, v t (x,t ) =, (24) v xx (x,t ) and v tt (x,t ) (25)

Lectures INF232 p. 26/88 Calculus Thus, a smooth function w = w(x,t), (x,t) Ω T such that either w x (x,t), w t (x,t), w xx (x,t) > or w tt (x,t) >, for all (x,t) Ω T, (26) must attain its maximum value at the boundary Ω T of Ω T We also have that if the maximum is achieved for t = T, say at (x,t), then w must satisfy the inequality w t (x,t) (27)

Lectures INF232 p. 27/88 Maximum principles Assume that u is a smooth solution of (14)-(16), and that u achieves its maximum value at an interior point (x,t ) Ω T From (14) it follows that By (24) we conclude that u t (x,t ) = u xx (x,t ) u xx (x,t ) = If there were strict inequalities in (25), we would have had a contradiction, and we could have concluded that u must achieve its maximum at Ω T

Lectures INF232 p. 28/88 Maximum principles Define a family of auxiliary functions {v ε } ε> by v ε (x,t) = u(x,t)+εx 2 for ε >, (28) where u solves (14)-(16) Note that v ε t (x,t) = u t (x,t), (29) v ε xx(x,t) = u xx (x,t)+2ε > u xx (x,t) Now, if v ε achieves its maximum at an interior point, say (x,t ) Ω T, then the property (24) implies that v ε t (x,t ) = u t (x,t ) =

Lectures INF232 p. 29/88 Maximum principles We can apply the heat equation (14) to conclude that Therefore u xx (x,t ) = u t (x,t ) = v ε xx(x,t ) = u xx (x,t )+2ε = 2ε > This violates the property (25), which must hold at a maximum point of v ε Hence, we conclude that v ε must attain its maximum value at the boundary Ω T of Ω T, i.e., v ε (x,t) max (y,s) Ω T v ε (y,s) for all (x,t) Ω T

Lectures INF232 p. 3/88 Maximum principles Can v ε reach its maximum value at time t = T and for x (,1)? Assume that (x,t), with < x < 1, is such that v ε (x,t) v ε (x,t) for all (x,t) Ω T Then, according to property (27), v ε t (x,t), which implies that u t (x,t) see (29) Consequently, since u satisfies the heat equation u xx (x,t) = u t (x,t)

Lectures INF232 p. 31/88 Maximum principles It follows that v ε xx(x,t) = u xx (x,t)+2ε +2ε > This contradicts the property (25) that must be fulfilled at such a maximum point This means that where v ε (x,t) max (y,s) Γ T v ε (y,s) for all (x,t) Ω T, (3) Γ T = {(,t) t T } {(x,) x 1} {(1,t) t T }

Maximum principles Let M = max ( max t g 1(t), max t g 2(t), max x (,1) ) f(x) And let Γ = {(,t) t } {(x,) x 1} {(1,t) t } Since Γ T Γ, (3) and the definition (28) of v ε, we have that v ε (x,t) max v ε (y,s) M + ε (y,s) Γ for all (x,t) Ω T By (28), it follows that u(x,t) v ε for all (x,t) Ω T Lectures INF232 p. 32/88

Lectures INF232 p. 33/88 Maximum principles Therefore u(x,t) M + ε for all (x,t) Ω T and all ε > This inequality is valid for all ε >, hence it must follow that u(x,t) M for all (x,t) Ω T (31) Since T > was arbitrary chosen, this inequality must hold for any t >, i.e., u(x,t) M for all x [,1], t > (32)

Lectures INF232 p. 34/88 Minimum principle The maximum principle above can be used to prove a similar minimum principle Let u(x,t) be a solution of the (14)-(16), and define w(x,t) = u(x,t) for all x [,1], t > Note that w satisfies the heat equation, since w t = ( u) t = u t = u xx = ( u) xx = w xx Moreover w(,t) = g 1 (t) and w(1,t) = g 2 (t) for t >, w(x,) = f(x) for x (,1)

Lectures INF232 p. 35/88 Minimum principle Thus, from the analysis presented above we find that ( w(x,t) max max ( g 1(t)), max ( g 2(t)), max t t ( = min min g 1(t), min g 2(t), min f(x) t t x (,1) We can write this u(x,t) for all x [,1], t > min x (,1) ), ( ) min g 1(t), min g 2(t), min f(x), t t x (,1) for all x [,1], t > ) ( f(x))

Lectures INF232 p. 36/88 Maximum principles A smooth solution of the problem (14)-(16) must satisfy the bound where m u(x,t) M for all x [,1], t >, (33) m = min M = max ( min ) f(x) x (,1) g 1(t), min g 2(t), min t t ( max g 1(t), max g 2(t), max t t x (,1) ) f(x)., (34) (35)

Lectures INF232 p. 37/88 Separation of variables Separation of variables is a technique for computing the analytical solution of the heat equation First, we study functions satisfying u t = u xx for x (,1), t >, (36) u(,t) = u(1,t) = for t > (37) We guess that we have solutions on the form u(x,t) = X(x)T(t), (38) where X(x) and T(t) only depend on x and t The boundary conditions imply that u(,t) = = X()T(t) and u(1,t) = = X(1)T(t)

Lectures INF232 p. 38/88 Separation of variables Consequently, X(x) must satisfy X() = and X(1) =, (39) provided that T(t) for t > By using (38) for u(x,t) in the heat equation (36) we find that X and T must satisfy the relation X(x)T (t) = X (x)t(t) for all x (,1),t > Thus, if X(x) for x (,1) and T(t) for t >, we get T (t) T(t) = X (x) for all x (,1), t > (4) X(x)

Lectures INF232 p. 39/88 Separation of variables Since the left hand side of (4) only depends on t and the right hand side only depends on x, we conclude that there must exist a constant λ such that T (t) T(t) = λ (41) X (x) X(x) = λ (42) We have studied problems on the form (41) earlier and have seen that a solution is given by where c is an arbitrary constant T(t) = ce λt, (43)

Lectures INF232 p. 4/88 Separation of variables We write (42) on the form X (x) = λx(x), (44) with the boundary conditions X() = and X(1) = (45) We have that: Therefore sin (kπx) = k 2 π 2 sin(kπx) X(x) = X k (x) = sin(kπx), (46) λ = λ k = k 2 π 2 (47) satisfy (44) and (45), for k =..., 2, 1,,1,2,...

Lectures INF232 p. 41/88 Separation of variables We can now summarize that u k (x,t) = c k e k2 π 2t sin(kπx) for k =..., 2, 1,,1,2,... (48) satisfy both the heat equation (36) and the boundary condition (37) Note that, {c k } are arbitrary constants

Lectures INF232 p. 42/88 Example 22 Consider the problem u t = u xx for x (,1), t >, (49) u(,t) = u(1,t) = for t >, (5) u(x,) = sin(πx) for x (,1). (51) We have that u(x,t) = e π2t sin(πx) satisfies (49) and (5). Furthermore, u(x,) = e π2 sin(πx) = sin(πx) and thus this is the unique smooth solution of this problem.

Lectures INF232 p. 43/88 Example 23 Our second example is u t = u xx for x (,1), t >, u(,t) = u(1,t) = for t >, u(x,) = 7sin(5πx) for x (,1). Putting k = 5 and c 5 = 7 in equation (48) we find that u(x,t) = 7e 25π2t sin(5πx) satisfies the heat equation and the boundary condition of this problem. Furthermore, u(x,) = 7e 25π2 sin(5πx) = 7sin(5πx) and hence the initial condition is also satisfied.

Lectures INF232 p. 44/88 Super-positioning Assume that both v 1 and v 2 satisfy equations (36) and (37), and let w = v 1 + v 2 Observe that w t = (v 1 +v 2 ) t = (v 1 ) t +(v 2 ) t =(v 1 ) xx +(v 2 ) xx = (v 1 +v 2 ) xx = w xx Furthermore and w(,t) = v 1 (,t)+v 2 (,t) = + = for t >, w(1,t) = v 1 (1,t)+v 2 (1,t) = + = for t >, hence w also satisfies (36) and (37)

Lectures INF232 p. 45/88 Super-positioning For an arbitrary constant a 1 consider the function p(x,t) = a 1 v 1 (x,t) Since a 1 is a constant and v 1 satisfy the heat equation it follows that p t = (a 1 v 1 ) t = a 1 (v 1 ) t = a 1 (v 1 ) xx = (a 1 v 1 ) xx = p xx Furthermore p(,t) = a 1 v 1 (,t) = for t >, p(1,t) = a 1 v 1 (1,t) = for t >. Thus we conclude that p satisfy both (36) and (37)

Lectures INF232 p. 46/88 Super-positioning We can now conclude that, if v 1 and v 2 satisfy (36)-(37) then any function on the form a 1 v 1 + a 2 v 2, also solves this problem for all constants a 1 and a 2 More generally, for any sequence of numbers c,c 1,c 2,... such that the series of functions c k e k2 π 2t sin(kπx) k=1 converges, this sum forms a solution of (36)-(37) This is called super-positioning

Lectures INF232 p. 47/88 Fourier series and the initial condition We now have that, for any sequence of numbers the function u(x,t) = c 1,c 2,... c k e k2 π 2t sin(kπx) (52) k=1 defines a formal solution of (36)-(37), provided that the series in (52) converges Therefore, if we drop the initial condition, we can find infinitely many functions satisfying the heat equation We shall now see how our model problem (1)-(3) (including the initial condition) can be solved

Lectures INF232 p. 48/88 Example 24 Consider the problem u t = u xx for x (,1), t >, (53) u(,t) = u(1,t) = for t >, (54) u(x,) = 2.3sin(3πx)+1sin(6πx) for x (,1). (55) This fit into (52) with c k = for k 3 and k 6, c 3 = 2.3 and c 6 = 1. Thus, the unique smooth solution is given by u(x,t) = 2.3e 9π2t sin(3πx)+1e 36π2t sin(6πx).

Lectures INF232 p. 49/88 Example 25 Let us determine a formula for the solution of the problem u t = u xx for x (,1), t >, u(,t) = u(1,t) = for t >, u(x,) = 2sin(πx)+8sin(3πx)+sin(67πx)+12sin(1 4 πx). By putting c k = for k 1, 3, 67, 1 4, c 1 = 2, c 3 = 8, c 67 = 1, c 1 4 = 12, in formula (52), we get the solution u(x,t) = 2e π2t sin(πx)+8e 9π2t sin(3πx) +e (67π)2t sin(67πx)+12e (14 π) 2t sin(1 4 πx).

Lectures INF232 p. 5/88 Sums of sine functions We can generalize as follows: Let S be any finite set of positive integers and let {c k } k S be arbitrary given constants Consider an initial condition on the form f(x) = c k sin(kπx) k S Then the solution of (1)-(3) is given by u(x,t) = c k e k2 π 2t sin(kπx) k S

Lectures INF232 p. 51/88 Sums of sine functions This is valid because u t (x,t) = k 2 π 2 c k e k2 π 2t sin(kπx) k S u xx (x,t) = k 2 π 2 c k e k2 π 2t sin(kπx) k S u(,t) = c k e k2 π 2t sin() = k S u(x,) = k S u(1,t) = k S c k e k2 π 2t sin(kπ) = c k e sin(kπx) = k S c k sin(kπx) = f(x)

Lectures INF232 p. 52/88 Sums of sine functions What about infinite series? For any initial condition on the form f(x) = c k sin(kπx) for x (,1), k=1 where the sum on the right hand side is an convergent infinite series. The solution of (1)-(1) is given by u(x,t) = c k e k2 π 2t sin(kπx). (56) k=1

Lectures INF232 p. 53/88 Computing Fourier sine series For a given function f(x), does there exist constants c 1, c 2, c 3,... such that f(x) = c k sin(kπx) for x (,1)? (57) k=1 If so, how can the constants c 1, c 2, c 3,... be determined? Let us first assume that the answer to the first question is yes

Lectures INF232 p. 54/88 Computing Fourier sine series Recall the trigonometric identity that, for any real numbers a and b sin(a)sin(b) = 1 2 (cos(a b) cos(a+b)) (58) Therefore it follows that sin(kπx) sin(lπx) dx = { k l, 1/2 k = l (59)

Lectures INF232 p. 55/88 Computing Fourier sine series Now f(x)sin(lπx)dx = = ( k=1 c k sin(kπx) ) sin(lπx) dx c k sin(kπx) sin(lπx) dx k=1 = 1 2 c l Therefore c k = 2 f(x)sin(kπx)dx for k = 1,2,... (6) We conclude that, if the function f can be written on the form (57), then the coefficients must satisfy (6)

Lectures INF232 p. 56/88 Computing Fourier sine series Usually, a function can be written on the form (57), and we refer to such functions as well-behaved. We can now summarize The Fourier coefficients for a "well-behaved" function f(x), x (,1), is defined by c k = 2 f(x)sin(kπx)dx for k = 1,2,..., (61) and the associated Fourier sine series by f(x) = c k sin(kπx) for x (,1). (62) k=1

Lectures INF232 p. 57/88 Computing Fourier sine series Furthermore, if f satisfies (62) then u(x,t) = c k e k2 π 2t sin(kπx) (63) k=1 defines a formal solution of the problem u t = u xx for x (,1), t >, (64) u(,t) = u(1,t) = for t >, (65) u(x,) = f(x) for x (,1). (66)

Lectures INF232 p. 58/88 Computing Fourier sine series For a given integer N, we can approximate u by the Nth partial sum u N of the Fourier series, i.e., u(x,t) u N (x,t) = N c k e k2 π 2t sin(kπx) (67) k=1

Lectures INF232 p. 59/88 Example 26 Determine the Fourier sine series of the constant function f(x) = 1 for x (,1). From formula (61) we find that c k = 2 = 2 f(x)sin(kπx)dx = 2 [ 1 kπ cos(kπx) ] 1 1 sin(kπx) dx = 2 (cos(kπ) 1) = kπ { if k is eve if k is odd 4 kπ Thus we find that the Fourier sine series of this function is f(x) = 1 = k=1 4 (2k 1)π sin((2k 1)πx) for x (,1) (68)

Lectures INF232 p. 6/88 14 12 1 8 6 4 2.1.2.3.4.5.6.7.8.9 1 Figure 1: The first 2 (dashed line), 7 (dashed-dotted line) and 1 (solid line) terms of the Fourier sine series of the function f(x) = 1.

Lectures INF232 p. 61/88 Example 26 Solve u t = u xx for x (,1), t >, u(,t) = u(1,t) = for t >, u(x,) = 1 for x (,1). The formal solution is given by u(x,t) = k=1 4 (2k 1)π e (2k 1)2 π 2t sin((2k 1)πx) (69) In figures 2 and 3 we have graphed the function given by the 1th partial sum of the series (69) at time t =.5 and t = 1, respectively.

.1.9.8.7.6.5.4.3.2.1.1.2.3.4.5.6.7.8.9 1 Figure 2: A plot of the function given by the sum of the 1 first terms of the series defining the formal solution of the problem studied in Example 26. The figure shows a snapshot of this function at time t =.5. Lectures INF232 p. 62/88

8 x 1 4 6 4 2.1.2.3.4.5.6.7.8.9 1 Figure 3: A plot of the function given by the sum of the 1 first terms of the series defining the formal solution of the problem studied in Example 26. The figure shows a snapshot of this function at time t = 1. Lectures INF232 p. 63/88

Lectures INF232 p. 64/88 Note that A Fourier sine series, finite or infinite, g(x) = will have the property that c k sin(kπx), k=1 g() = g(1) = So, if a function f(x) is not zero at the endpoints, it can not be written as a sum of sine series on the closed interval [, 1] But the Fourier sine series of f, will in most cases still converge to f(x) in the open interval (,1)

Example 27 Compute the Fourier coefficients {c k } of the function According to formula (61) c k = 2 (x x 2 )sin(kπx)dx=2 We have x sin(kπx) dx = f(x) = x(1 x) = x x 2. [ x 1 ] 1 kπ cos(kπx) = 1 kπ cos(kπ)+ 1 kπ = 1 kπ x sin(kπx) dx 2 cos(kπ) = ( 1)k+1 kπ x 2 sin(kπx)dx. 1 kπ cos(kπx)dx [ 1 kπ sin(kπx). ] 1 Lectures INF232 p. 65/88

Example 27 x 2 sin(kπx)dx = [ x 2 1 ] 1 kπ cos(kπx) = 1 kπ cos(kπ)+ 2 kπ 2 kπ 1 kπ sin(kπx)dx = 1 kπ cos(kπ)+ 2 (kπ) 2 2x 1 kπ cos(kπx)dx [ x 1 kπ sin(kπx) ] 1 [ 1 kπ cos(kπx) ] 1 = 1 kπ cos(kπ)+ 2 (kπ) 3 cos(kπ) 2 (kπ) 3 = ( 1)k+1 kπ + 2( 1)k (kπ) 3 2 (kπ) 3. Lectures INF232 p. 66/88

Lectures INF232 p. 67/88 Example 27 Thus c k = 2 ( ) 2 (kπ) 3 2( 1)k (kπ) 3 = { if k is even, 8 (kπ) 3 if k is odd, and we find that f(x) = x x 2 ( ) 8 = k=1 ((2k 1)π) 3 sin((2k 1)πx).

.35.3.25.2.15.1.5.1.2.3.4.5.6.7.8.9 1 Figure 4: The first (dashed line), 7 first (dashed-dotted line) and 1 first (solid line) terms of the Fourier sine series of the function f(x) = x x 2. It is impossible to distinguish between the figures representing the 7 first and 1 first terms. They are both accurate approximations of x x 2. Lectures INF232 p. 68/88

Lectures INF232 p. 69/88 Example 28 Solve the problem k=1 u t = u xx for x (,1), t >, u(,t) = u(1,t) = for t >, u(x,) = x(1 x) = x x 2 for x (,1). According to (63) the function ( ) 8 u(x,t) = ((2k 1)π) 3 e (2k 1)2 π 2t sin((2k 1)πx) (7) defines a formal solution of this problem.

Lectures INF232 p. 7/88 2 x 1 3 1.8 1.6 1.4 1.2 1.8.6.4.2.1.2.3.4.5.6.7.8.9 1 Figure 5: A snapshot, at time t =.5, of the function given by the sum of the 1 first terms of the series defining the formal solution of the problem studied in Example 28.

Lectures INF232 p. 71/88 1.4 x 1 5 1.2 1.8.6.4.2.1.2.3.4.5.6.7.8.9 1 Figure 6: A snapshot, at time t = 1, of the function given by the sum of the 1 first terms of the series defining the formal solution of the problem studied in Example 28.

Lectures INF232 p. 72/88 Stability analysis of the num. sol. We shall now study the stability properties of the explicit finite difference scheme for heat equation presented earlier As above, the discretization parameters are defined by t = T m and x = 1 n 1, and functions are only defined in the gridpoints u l i = u(x i,t l ) = u((i 1) x,l t) for i = 1,...,n and l =,...,m

Lectures INF232 p. 73/88 Stability analysis of the num. sol. The numerical scheme is written u l+1 i = u l i + t x 2(ul i 1 2u l i + u l i+1) = αu l i 1 +(1 2α)u l i + αu l i+1 (71) for i = 2,...,n 1 and l =,...,m 1, where Boundary conditions are u l = ul 1 α = t x 2 (72) = for l = 1,...,m We shall see that this numerical scheme is only conditionable stable, and the stability depends on the parameter α

Lectures INF232 p. 74/88 Example 29 Consider the following problem with the analytical solution u t = u xx for x (,1), t >, u(,t) = u(1,t) = for t >, u(x,) = sin(3πx) for x (,1), u(x,t) = e π2t sin(3πx). In Figures 7-9 we have graphed this function and the numerical results generated by the scheme (71) for various values of the discretization parameters in space and time. Notice how the solution depends on α.

Lectures INF232 p. 75/88 1.5 x 1 4 1.5.5 1 1.5.1.2.3.4.5.6.7.8.9 1 Figure 7: The solid line represents the solution of the problem studied in Example 29. The dotted, dash-dotted and dashed lines are the numerical results generated in the cases of n = 1 and m = 17 (α =.4765), n = 2 and m = 82 (α =.442), n = 6 and m = 76 (α =.4931), respectively.

1.5 x 1 4 1.5.5 1 1.5.1.2.3.4.5.6.7.8.9 1 Figure 8: The dashed line represents the results generated by the explicit scheme (71) in the case of n = 6 and m = 681, corresponding to α =.5112, in Example 29. The solid line is the graph of the exact solution of the problem studied in this example. Lectures INF232 p. 76/88

Lectures INF232 p. 77/88 5 4 3 2 1 1 2 3 4 5.1.2.3.4.5.6.7.8.9 1 Figure 9: A plot of the numbers generated by the explicit scheme (71), with n = 6 and m = 675, in Example 29. Observe that α =.5157 >.5 and that, for these discretization parameters, the method fails to solve the problem under consideration!

Lectures INF232 p. 78/88 Example 3 We reconsider the problem analyzed Example 28, and study the performance of the explicit scheme (71) applied to u t = u xx for x (,1), t >, u(,t) = u(1,t) = for t >, u(x,) = x(1 x) = x x 2 for x (,1). We compare the numerical approximations generated by (71) with the formal solution (7) for various discretization parameters t and x

.1.9.8.7.6.5.4.3.2.1.1.2.3.4.5.6.7.8.9 1 Figure 1: Numerical results from Example 3. The solid line represents the sum of the 1 first terms of the sine series of the formal solution of the problem studied in this example. The dotted, dash-dotted and dashed curves are the numerical results generated in the cases of n = 4 and m = 3 (α =.3), n = 7 and m = 8 (α =.45), n = 14 and m = 34 (α =.4971), respectively. Lectures INF232 p. 79/88

Lectures INF232 p. 8/88.1.9.8.7.6.5.4.3.2.1.1.2.3.4.5.6.7.8.9 1 Figure 11: The dashed line represents the results generated by the explicit scheme (71) in the case of n = 14 and m = 29, corresponding to α =.5828, in Example 3. The solid line is the graph of the Fourier based approximation of the solution.

Lectures INF232 p. 81/88 8 6 4 2 2 4 6 8.1.2.3.4.5.6.7.8.9 1 Figure 12: A plot of the numerical results produced by the explicit scheme (71), using n = 25 grid points in the spatial dimension and m = 25 time steps, in Example 3. In this case α =.676 >.5 and the method fails to solve the problem.

Lectures INF232 p. 82/88 Analysis We have observed that the explicit scheme (71) works fine, provided that α 1/2 For small discretization parameters t and x, it seems to produce accurate approximations of the solution of the heat equation However, for α > 1/2 the scheme tends to break down, i.e., the numbers produced are not useful. Our goal now is to investigate this property from a theoretical point of view We will derive, provided that α 1/2, a discrete analogue to the maximum principle Note that, for (1)-(3), the maximums principle implies u(x,t) max f(x) for all x (,1) and t x

Lectures INF232 p. 83/88 Analysis Assume that t and x satisfy α = t x 2 1 2 Then We introduce 1 2α (73) ū l = max i u l i for l =,...,m Note that ū = max i f(x i )

Lectures INF232 p. 84/88 Analysis Recall that u l+1 i = αu l i 1 +(1 2α)ul i + αul i+1 It now follows from the triangle inequality that u l+1 i = αu l i 1 +(1 2α)u l i + αu l i+1 αu l i 1 + (1 2α)u l i + αu l i+1 = α u l i 1 +(1 2α) u l i +α u l i+1 αū l +(1 2α)ū l + αū l for i = 2,...,n 1 = ū l (74) Note that u l+1 1 = u l+1 n =

Lectures INF232 p. 85/88 Analysis Since (74) is valid for i = 2,...,n 1, we get or max u l+1 i i ū l+1 ū l ū l Finally, by a straightforward induction argument we conclude that ū l+1 ū = max i f(x i )

Lectures INF232 p. 86/88 Analysis Assume that the discretization parameters t and x satisfy α = t x 2 1 2. (75) Then the approximations generated by the explicit scheme (71) satisfy the bound max i u l i max i f(x i ) for l =,...,m, (76) where f is the initial condition in the model problem (1)-(3).

Lectures INF232 p. 87/88 Consequences For a given n, m must satisfy m 2T(n 1) 2 Hence, the number of time steps, m, needed increases rapidly with the number of grid points, n, used in the space dimension If T = 1 and n = 11, then m must satisfy m 2, and in the case of n = 11 at least 2 1 6 time steps must be taken! This is no big problem in 1D, but in 2D and 3D this problem may become dramatic

Lectures INF232 p. 88/88