Computational Physics (Lecture 13) PHY4061. Recap of last lecture: Boundary-value and eigenvalue problems A typical boundary-value problem in physics.

Slides:



Advertisements
Similar presentations
Differential Equations
Advertisements

Quantum One: Lecture 5a. Normalization Conditions for Free Particle Eigenstates.
Quantum One: Lecture 4. Schrödinger's Wave Mechanics for a Free Quantum Particle.
Quantum One: Lecture 3. Implications of Schrödinger's Wave Mechanics for Conservative Systems.
Lecture 13 2 nd order partial differential equations Remember Phils Problems and your notes = everything Only.
Total Recall Math, Part 2 Ordinary diff. equations First order ODE, one boundary/initial condition: Second order ODE.
Wavefunction Quantum mechanics acknowledges the wave-particle duality of matter by supposing that, rather than traveling along a definite path, a particle.
PART 7 Ordinary Differential Equations ODEs
Presented by Andrey Kuzmin Mathematical aspects of mechanical systems eigentones Department of Applied Mathematics.
Part 6 Chapter 22 Boundary-Value Problems PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright © The McGraw-Hill.
Chapter 9 Differential equations
Differential Equations and Boundary Value Problems
III Solution of pde’s using variational principles
Lecture 2 Differential equations
Boyce/DiPrima 10th ed, Ch 10.5: Separation of Variables; Heat Conduction in a Rod Elementary Differential Equations and Boundary Value Problems, 10th.
Ch 9 pages ; Lecture 21 – Schrodinger’s equation.
PHYS 3313 – Section 001 Lecture #17
COMPUTATIONAL MODELING FOR ENGINEERING MECN 6040 Professor: Dr. Omar E. Meza Castillo Department.
9.6 Other Heat Conduction Problems
The Hydrogen Atom Quantum Physics 2002 Recommended Reading: Harris Chapter 6, Sections 3,4 Spherical coordinate system The Coulomb Potential Angular Momentum.
1 Chapter 8 Ordinary differential equation Mathematical methods in the physical sciences 3rd edition Mary L. Boas Lecture 5 Introduction of ODE.
Lecture 3 Differential Constraints Method Andrei D. Polyanin.
Javier Junquera Molecular dynamics in the microcanonical (NVE) ensemble: the Verlet algorithm.
Quantum Mechanics (14/2) CH. Jeong 1. Bloch theorem The wavefunction in a (one-dimensional) crystal can be written in the form subject to the condition.
A PPLIED M ECHANICS Lecture 09 Slovak University of Technology Faculty of Material Science and Technology in Trnava.
Boundary-Value Problems Boundary-value problems are those where conditions are not known at a single point but rather are given at different values of.
Boyce/DiPrima 9 th ed, Ch 10.8: Laplace’s Equation Elementary Differential Equations and Boundary Value Problems, 9 th edition, by William E. Boyce and.
Separation of Variables Method of separation of variables is one of the most widely used techniques to solve PDE. It is based on the assumption that the.
Wednesday, Oct. 17, 2012PHYS , Fall 2012 Dr. Jaehoon Yu 1 PHYS 3313 – Section 001 Lecture #13 Wednesday, Oct. 17, 2012 Dr. Jaehoon Yu Properties.
Ch 2. The Schrödinger Equation (S.E)
Lecture 15 Solving the time dependent Schrödinger equation
MODULE 1 In classical mechanics we define a STATE as “The specification of the position and velocity of all the particles present, at some time, and the.
The Quantum Theory of Atoms and Molecules The Schrödinger equation and how to use wavefunctions Dr Grant Ritchie.
Time-dependent Schrodinger Equation Numerical solution of the time-independent equation is straightforward constant energy solutions do not require us.
MS310 Quantum Physical Chemistry
Engineering Analysis – Computational Fluid Dynamics –
Jump to first page Chapter 3 Splines Definition (3.1) : Given a function f defined on [a, b] and a set of numbers, a = x 0 < x 1 < x 2 < ……. < x n = b,
Differential Equations Brannan Copyright © 2010 by John Wiley & Sons, Inc. All rights reserved. Chapter 09: Partial Differential Equations and Fourier.
Chapter 4 : Solution of Electrostatic ProblemsLecture 8-1 Static Electromagnetics, 2007 SpringProf. Chang-Wook Baek Chapter 4. Solution of Electrostatic.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 271 Boundary-Value.
Ch 10.6: Other Heat Conduction Problems
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 27.
1 Linear Wave Equation The maximum values of the transverse speed and transverse acceleration are v y, max =  A a y, max =  2 A The transverse speed.
Boundary-Value Problems in Rectangular Coordinates
Differential Equations
Chapter 13 Wave Motion.
Computational Physics (Lecture 4) PHY4370. Random Variable, density function and distribution function.
An equation for matter waves Seem to need an equation that involves the first derivative in time, but the second derivative in space As before try solution.
Computational Physics (Lecture 3) PHY4370. Interpolation Computer is a system with finite number of discrete states. – In numerical analysis, the results.
Computational Physics (Lecture 11) PHY4061. Variation quantum Monte Carlo the approximate solution of the Hamiltonian Time Independent many-body Schrodinger’s.
Computational Physics (Lecture 7) PHY4061. Eigen Value Problems.
Ordinary Differential Equations (ODEs). Objectives of Topic  Solve Ordinary Differential Equations (ODEs).  Appreciate the importance of numerical methods.
Ch. 12 Partial Differential Equations
Differential Equations
Computational Physics (Lecture 12) PHY4370. The Euler and Picard methods Numerically, we can rewrite the velocity as: Here, i is the ith time step. Let.
Computational Physics (Lecture 14) PHY4061. What happens if the string is not light, and/or carries a mass density ρ(x) that is not a constant? This is.
Computational Physics (Lecture 15) PHY4370. The essence : – discretization of the continuous variables, – the spatial coordinates and time. Rectangular.
The Quantum Theory of Atoms and Molecules
Boundary-Value Problems in Rectangular Coordinates
Boyce/DiPrima 10th ed, Ch 10.8: Laplace’s Equation Elementary Differential Equations and Boundary Value Problems, 10th edition, by William E. Boyce and.
Computational Physics (Lecture 13)
Computational Physics (Lecture 15)
Computational Physics (Lecture 12)
Computational Physics (Lecture 14)
Quantum One.
Quantum One.
Chapter 27.
Quantum Two.
Simple introduction to quantum mechanics
Boundary value problems:
Presentation transcript:

Computational Physics (Lecture 13) PHY4061

Recap of last lecture: Boundary-value and eigenvalue problems A typical boundary-value problem in physics is usually given as a second-order differential equation – u’’ = f( u, u’, x) – where u is a function of x, u’ and u’’ are the first- order and second-order derivatives of u with respect to x, and f (u, u; x) is a function of u, u, and x. – Either u or u’ is given at each boundary point.

we can always choose a coordinate system – so that the boundaries of the system are at x = 0 and x = 1 without losing any generality – if the system is finite. – For example, if the actual boundaries are at x = x1 and x = x2 for a given problem, we can always bring them back to x’ = 0, and x = 1 with a transformation of x’=(x-x1)/(x2-x1)

For problems in one dimension, we can have a total of four possible types of boundary conditions:

more difficult to solve than the similar initial- value problem. – for the boundary-value problem, we know only u(0) or u’(0), which is not sufficient to start an algorithm for the initial-value problem without some further work. Typical Eigen value problems are more difficult: – Have to handle one more parameter in the equation. – the eigenvalue λ can have only some selected values in order to yield acceptable solutions of the equation under the given boundary conditions.

The longitudinal vibrations along an elastic rod as an example: – u’’(x) = −k^2 u(x), – where u(x) is the displacement from equilibrium at x and the allowed values of k 2 are the eigenvalues of the problem. – The wavevector k in the equation is related to the phase speed c of the wave along the rod and the allowed angular frequency ω by the dispersion relation: ω = ck.

If both ends (x = 0 and x = 1) of the rod are fixed, – the boundary conditions are u(0) = u(1) = 0. If one end (x = 0) is fixed and the other end (x = 1) is free, – the boundary conditions are then u(0) = 0 and u’(1) = 0.

if both ends of the rod are fixed, the eigenfunctions: the eigenvalues are : K^2_l= (lπ)^2, l are positive integers.

The complete solution of the longitudinal waves along the elastic rod is given by a linear combination of all the eigenfunctions with their associated initial-value solutions as: where ω_l = ck_l, and a_l and b_l are the coefficients to be determined by the initial conditions.

The shooting method A simple method for boundary and eigen value problems. First convert the second-order differential equation into two first-order differential equations – by defining y1= u and y2= u’, assume that the boundary conditions are u(0) = u0 0 and u(1) = u1 1

The key is to make the problem look like an initial-value problem – By introducing an adjustable parameter; – the solution is then obtained by varying the parameter. u(0) is given already, we can make a guess for the first order derivative at x = 0, – for example, u’(0) = α. α is the parameter to be adjusted

For a specific α, we can integrate the equation to x = 1 with any of the algorithms discussed earlier for initial-value problems. Because the initial choice of α can hardly be the actual derivative at x = 0, the value of the function u α (1), resulting from the integration with u’(0) = α to x = 1, would not be the same as u1.

The idea of the shooting method is to use one of the root search algorithms to find the appropriate α that ensures f (α) = u α (1) − u1 = 0 within a given tolerance δ.

An actual numerical example to illustrate the scheme. Assume that we want to solve the differential equation u’’ = − π 2 (u+1)/4 boundary conditions u(0) = 0 and u(1) = 1. Define the new variables: y1= u and y2= u’ dy1/dx = y2, dy2/dx= − π 2 (y1+ 1) / 4.

Now assume that this equation set has the initial values y1(0) = 0 and y2(0) = α. Here α is a parameter to be adjusted in order to have f (α) = u_α(1) − 1 = 0. We can combine the secant method for the root search and the fourth-order Runge–Kutta method for initial-value problems to solve the above equation set.

// An example of solving a boundary-value problem via // the shooting method. The Runge-Kutta and secant // methods are used for integration and root search. import java.lang.*; public class Shooting { static final int n = 100, ni=10, m = 5; static final double h = 1.0/n; public static void main(String argv[]) { double del = 1e-6, alpha0 = 1, dalpha = 0.01; double y1[] = new double [n+1]; double y2[] = new double [n+1]; double y[] = new double [2]; // Search for the proper solution of the equation y1[0] = y[0] = 0; y2[0] = y[1] = secant(ni, del, alpha0, dalpha); for (int i=0; i<n; ++i) { double x = h*i; y = rungeKutta(y, x, h); y1[i+1] = y[0]; y2[i+1] = y[1]; } // Output the result in every m points for (int i=0; i<=n; i+=m) System.out.println(y1[i]); } public static double secant(int n, double del, double x, double dx) {...} // Method to provide the function for the root search. public static double f(double x) {

double y[] = new double[2]; y[0] = 0; y[1] = x; for (int i=0; i<n-1; ++i) { double xi = h*i; y = rungeKutta(y, xi, h); } return y[0]-1; } public static double[] rungeKutta(double y[], double t, double dt) {...} // Method to provide the generalized velocity vector. public static double[] g(double y[], double t) { int k = y.length; double v[] = new double[k]; v[0] = y[1]; v[1] = -Math.PI*Math.PI*(y[0]+1)/4; return v; }

The boundary value problem solved in the above program can also be solved exactly with an analytical solution u(x) = cos(πx/2)+ 2 sin(πx/2)− 1. Note that the shooting method provides a very accurate solution of the boundary-value problem. It is also a very general method for both the boundary-value and eigenvalue problems.

Boundary-value problems with other types of boundary conditions can be solved in a similar manner. – For example, if u’(0) = v0 and u(1) = u1 are given, – we can make a guess of u(0) = α and then integrate the equation set of y1 and y2 to x = 1. – The root to be sought is from f (α) = u_α(1) − u1 = 0. – Here u_α (1) is the numerical result of the equation with u(0) = α. – If u(1) = v1 is given, the equation f (α) = u_α’(1) − v1 = 0 is solved.

To apply the shooting method to an eigenvalue problem, – the parameter to be adjusted is no longer a parameter introduced but the eigenvalue of the problem. For example, if u(0) = u0 and u(1) = u1, – we can integrate the equation with u’(0) = α, a small quantity. – Then we search for the root of f (λ) = u_λ(1) − u1 = 0 by varying λ. – When f (λ) = 0 is satisfied, we obtain an approximate eigenvalue λ and the corresponding eigenstate from the normalized solution of u_λ(x). The introduced parameter α is not relevant here, – because it will be automatically modified to be the first-order derivative when the solution is normalized. – In other words, we can choose the first-order derivative at the boundary arbitrarily and it will be adjusted to an appropriate value when the solutions are made orthonormal.

Linear equations Many eigenvalue or boundary-value problems are in the form of linear equations – u’’ + d(x)u’ + q(x)u = s(x), – where d(x), q(x), and s(x) are functions of x. Assume that the boundary conditions are u(0) = u0 and u(1) = u1. – If all d(x), q(x), and s(x) are smooth, we can solve the equation with the shooting method.

an extensive search for the parameter α from f (α) = u_α(1) − u1 = 0 is unnecessary in this case – because of the principle of superposition of linear equations – any linear combination of the solutions is also a solution of the equation We need only two trial solutions u α0 (x) and u α1 (x), – where α 0 and α 1 are two different parameters. The correct solution of the equation is given by u(x) = au α0 (x) + bu α1 (x), where a and b are determined from u(0) = u0 and u(1) = u1. Note that u α0 (0) =u α1 (0) = u(0) = u0. a + b = 1, uα0 (1)a + uα1 (1)b = u1,

We have:

// An example of solving the boundary-value problem of // a linear equation via the Runge-Kutta method. import java.lang.*; public class LinearDEq { static final int n = 100, m = 5; public static void main(String argv[]) { double y1[] = new double [n+1]; double y2[] = new double [n+1]; double y[] = new double [2]; double h = 1.0/n; // Find the 1st solution via the Runge-Kutta method y[1] = 1; for (int i=0; i<n; ++i) { double x = h*i; y = rungeKutta(y, x, h); y1[i+1] = y[0]; } // Find the 2nd solution via the Runge-Kutta method y[0] = 0; y[1] = 2; for (int i=0; i<n; ++i) { double x = h*i; y = rungeKutta(y, x, h); y2[i+1] = y[0]; } // Superpose the two solutions found double a = (y2[n]-1)/(y2[n]-y1[n]); double b = (1-y1[n])/(y2[n]-y1[n]); for (int i=0; i<=n; ++i) y1[i] = a*y1[i]+b*y2[i]; // Output the result in every m points for (int i=0; i<=n; i+=m) System.out.println(y1[i]); } public static double[] rungeKutta(double y[], double t, double dt) {...} public static double[] g(double y[], double t) {...} }

Partial differential equations Partial differential equations in physics In this chapter, we discuss numerical schemes for solving partial differential equations. Several types of partial differential equations in physics. – The Poisson equation: ∇ ^2 Φ(r) = −ρ(r)/ – for the electrostatic potential Φ (r) at the position r under the given charge distribution ρ(r) is a typical elliptic equation.

The diffusion equation ∂n(r, t)/∂t− ∇ · D(r) ∇ n (r, t) = S(r, t) for the concentration n(r, t) at the position r and time t under the given source S(r, t) is a typical parabolic equation. Here D(r) is the diffusion coefficient at the position r.

The Wave equation: for the generalized displacement u(r, t) at the position r and time t under the given source R(r, t) is a typical hyperbolic equation.

The time-dependent Schrodinger equation: for the wavefunction Ψ(r, t) of a quantum system defined by the Hamiltonian H, can be viewed as a diffusion equation under imaginary time.

All the equations are linear if the sources and other quantities in the equations are not related to the solutions. There are also nonlinear equations in physics that rely heavily on numerical solutions. For example, the equations for fluid dynamics.

Separation of variables In many cases, using a combination of the separation of variables and a numerical scheme increases the speed of computing and the accuracy of the solution. The combination of analytic and numerical methods becomes critical in cases where the memory and speed of the available computing resources are limited.

Each variable (time or one of the spatial coordinates) is isolated from the rest, and the solutions of the resulting ordinary differential equations for all the variables are obtained before they are combined into the general solution of the original partial differential equation. Boundary and initial conditions are then used to determine the unknown parameters left in the solution, which usually appear as the coefficients or eigenvalues.

Consider first the standing waves on a light, uniform string that has both ends (x = 0 and x = L) fixed. The wave equation is where u(x, t) is the displacement of the string at the location x and time t, and c =√(T/ρ) is the phase speed of the wave, with T being the tension on the string and ρ the linear mass density of the string.

The boundary condition for fixed ends is u(0, t) = u(L, t) = 0 in this case. If we assume that the solution is given by u(x, t) = X(x)Θ(t),

Note that the introduced parameter (eigenvalue) ω must be independent of the position from the first ratio and independent of the time from the second ratio. we must have where k = ω/c is determined from the boundary condition X(0) = 0 and X(L) = 0.

We can view either ω or k as being the eigenvalue sought for the eigenvalue problem under the given boundary condition. The two independent, analytical solutions are sin kx and cos kx. Then we have X(x) = A sin kx + B cos kx. From the boundary condition X(0) = 0, we must have B = 0; from X(L) = 0, we must have k_n = nπ/L with n = 1, 2,...,∞. Using this kn in the equation for Θ(t), we obtain Θ(t) = C sin ω_n x + D cos ω_n x, With ω_n = ck_n = nπc/L Combining the solutions for X(x) and (t), we obtain the general solution where a_n and b_n are two sets of parameters that are determined by the initial displacement u(x, 0) = u_0(x) and the initial velocity ∂u(x, t)/∂t|t=0 = v0(x).

Using t = 0 for u(x, t) and its partial derivative of time, we have: