NATIONAL UNIVERSITY OF SINGAPORE PC5215 NUMERICAL RECIPES WITH APPLICATIONS. (Semester I: AY ) Time Allowed: 2 Hours

Similar documents
NATIONAL UNIVERSITY OF SINGAPORE PC5215 NUMERICAL RECIPES WITH APPLICATIONS. (Semester I: AY ) Time Allowed: 2 Hours

Introduction CSE 541

Jim Lambers MAT 460/560 Fall Semester Practice Final Exam

Chapter 1 Error Analysis

Floating Point Number Systems. Simon Fraser University Surrey Campus MACM 316 Spring 2005 Instructor: Ha Le

Numerical Methods - Preliminaries

Bindel, Spring 2012 Intro to Scientific Computing (CS 3220) Week 12: Monday, Apr 16. f(x) dx,

Monte Carlo. Lecture 15 4/9/18. Harvard SEAS AP 275 Atomistic Modeling of Materials Boris Kozinsky

Do not turn over until you are told to do so by the Invigilator.

2015 School Year. Graduate School Entrance Examination Problem Booklet. Mathematics

Differential Equations 2280 Sample Midterm Exam 3 with Solutions Exam Date: 24 April 2015 at 12:50pm

Introductory Numerical Analysis

Numerical Analysis: Interpolation Part 1

you expect to encounter difficulties when trying to solve A x = b? 4. A composite quadrature rule has error associated with it in the following form

Fourth Order RK-Method

Midterm Review. Igor Yanovsky (Math 151A TA)

Math 471. Numerical methods Introduction

Numerical integration and importance sampling

NATIONAL UNIVERSITY OF SINGAPORE DEPARTMENT OF MATHEMATICS SEMESTER 2 EXAMINATION, AY 2010/2011. Linear Algebra II. May 2011 Time allowed :

These slides follow closely the (English) course textbook Pattern Recognition and Machine Learning by Christopher Bishop

BOUNDARY VALUE PROBLEMS

MATH3383. Quantum Mechanics. Appendix D: Hermite Equation; Orthogonal Polynomials

Examples of solutions to the examination in Computational Physics (FYTN03), October 24, 2016

Metropolis/Variational Monte Carlo. Microscopic Theories of Nuclear Structure, Dynamics and Electroweak Currents June 12-30, 2017, ECT*, Trento, Italy

ECE257 Numerical Methods and Scientific Computing. Ordinary Differential Equations

Notes for Chapter 1 of. Scientific Computing with Case Studies

Monte Carlo Methods in High Energy Physics I

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

Linear Multistep Methods I: Adams and BDF Methods

19 : Slice Sampling and HMC

Functions - Exponential Functions

Linear & nonlinear classifiers

UNIVERSITY of LIMERICK OLLSCOIL LUIMNIGH

Integration, differentiation, and root finding. Phys 420/580 Lecture 7

Arithmetic and Error. How does error arise? How does error arise? Notes for Part 1 of CMSC 460

ECE580 Exam 2 November 01, Name: Score: / (20 points) You are given a two data sets

BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination December, 2015 BCS-054 : COMPUTER ORIENTED NUMERICAL TECHNIQUES

Lecture Notes, FYTN03 Computational Physics

Numerical Algorithms as Dynamical Systems

Math 216 Final Exam 14 December, 2012

Expectation. DS GA 1002 Statistical and Mathematical Models. Carlos Fernandez-Granda

Neural Network Training

Entrance Exam, Differential Equations April, (Solve exactly 6 out of the 8 problems) y + 2y + y cos(x 2 y) = 0, y(0) = 2, y (0) = 4.

Chapter 1: Preliminaries and Error Analysis

Langevin Methods. Burkhard Dünweg Max Planck Institute for Polymer Research Ackermannweg 10 D Mainz Germany

Review Higher Order methods Multistep methods Summary HIGHER ORDER METHODS. P.V. Johnson. School of Mathematics. Semester

Math 411 Preliminaries

Ordinary Differential Equations

Machine Learning Lecture 7

Bayesian Linear Regression [DRAFT - In Progress]

Simple Harmonic Oscillator

CS 257: Numerical Methods

Consistency and Convergence

3. Riley 12.9: The equation sin x dy +2ycos x 1 dx can be reduced to a quadrature by the standard integrating factor,» Z x f(x) exp 2 dt cos t exp (2

Ordinary Differential Equations I

MATH20602 Numerical Analysis 1

Expectation. DS GA 1002 Probability and Statistics for Data Science. Carlos Fernandez-Granda

CS 450 Numerical Analysis. Chapter 8: Numerical Integration and Differentiation

Numerical Analysis Preliminary Exam 10 am to 1 pm, August 20, 2018

Understand the existence and uniqueness theorems and what they tell you about solutions to initial value problems.

Monte Carlo study of the Baxter-Wu model

MA 262, Fall 2017, Final Version 01(Green)

COURSE Numerical integration of functions (continuation) 3.3. The Romberg s iterative generation method

1. For the case of the harmonic oscillator, the potential energy is quadratic and hence the total Hamiltonian looks like: d 2 H = h2

Abstract. + n) variables with a rank of ( n2 (n+1) )+n 2 ] equations in ( n2 (n+1)

Applied Numerical Analysis Quiz #2

Jim Lambers MAT 169 Fall Semester Practice Final Exam

1.1 GRAPHS AND LINEAR FUNCTIONS

221A Lecture Notes Steepest Descent Method

Math 5BI: Problem Set 6 Gradient dynamical systems

Preliminary Examination, Numerical Analysis, August 2016

Ch 4. Linear Models for Classification

Physics 584 Computational Methods

Logistic Regression. Seungjin Choi

Parallel Tempering Algorithm in Monte Carlo Simulation

Linear & nonlinear classifiers

The Sommerfeld Polynomial Method: Harmonic Oscillator Example

Hierarchical Parallel Solution of Stochastic Systems

2013/2014 SEMESTER 1 MID-TERM TEST. 1 October :30pm to 9:30pm PLEASE READ THE FOLLOWING INSTRUCTIONS CAREFULLY:

UNIVERSITY OF SURREY FACULTY OF ENGINEERING AND PHYSICAL SCIENCES DEPARTMENT OF PHYSICS. BSc and MPhys Undergraduate Programmes in Physics LEVEL HE2

One-dimensional harmonic oscillator. -motivation. -equation, energy levels. -eigenfunctions, Hermite polynomials. -classical analogy

MB4018 Differential equations

Department of Applied Mathematics and Theoretical Physics. AMA 204 Numerical analysis. Exam Winter 2004

221B Lecture Notes Steepest Descent Method

The Brownian Oscillator

Georgia Tech PHYS 6124 Mathematical Methods of Physics I

Quantum Monte Carlo. Matthias Troyer, ETH Zürich

2 Elementary algorithms for one-dimensional integrals

Chapter 1 Mathematical Preliminaries and Error Analysis

Numerical Analysis Exam with Solutions

Linear Regression. CSL603 - Fall 2017 Narayanan C Krishnan

Elements of Floating-point Arithmetic

Numerical Differentiation & Integration. Numerical Differentiation II

Linear Regression. CSL465/603 - Fall 2016 Narayanan C Krishnan

Linear Regression (continued)

MATH20602 Numerical Analysis 1

Math 0312 EXAM 2 Review Questions

CHAPTER 11. A Revision. 1. The Computers and Numbers therein

GAUSS-LAGUERRE AND GAUSS-HERMITE QUADRATURE ON 64, 96 AND 128 NODES

Before you begin read these instructions carefully.

Transcription:

NATIONAL UNIVERSITY OF SINGAPORE PC55 NUMERICAL RECIPES WITH APPLICATIONS (Semester I: AY 0-) Time Allowed: Hours INSTRUCTIONS TO CANDIDATES. This examination paper contains FIVE questions and comprises THREE printed pages.. Answer ALL the questions; questions carry equal marks.. Answers to the questions are to be written in the answer books. 4. This is a CLOSED BOOK examination. 5. Non-programmable calculators are allowed.

. The IEEE 754 standard for floating point representation of the double precision number has a sign bit, followed by bits for the biased exponent (with a bias of 0) and the rest 5 bits for the fractional part. a. Give the bit patterns for the 64-bit double precision representation of and /. b. Discuss what impact reducing the biased exponent field to 8 bits has, in terms of the precision and magnitude of the floating point numbers. a. - is (in hexadecimal notation) BFF FFFFFFFFFFFFF, / is FD 5555555555555. b. If the exponent field is reduced and fractional part increased, then the precision increases (machine epsilon is smaller) but the magnitude decreases.. Consider numerical integration formula by Gaussian quadrature method. a. State the main idea of Gaussian quadrature. b. Consider a three-point Gaussian quadrature formula in the interval [0,], f ( x ) dx w f ( x ) + w f ( x ) + w f ( x ). For polynomials,, x, x,, x n, 0 the formula is exact. What is the largest integer n that this is true? c. Determine the three-point formula, i.e., determine the abscissas x, x, x, and the weights w, w, w. a. by changing both the weights and abscissas, a maximum of accuracy is obtained, i.e., the formula is exact for polynomials of order N- for N point Gaussian quadrature. b. n=5. c. P 0 =, P = x-/, P =x -x+/6, P =x -/x +/5x -/0. This is obtained by the orthogonal condition <P i P j > = 0 (i < j). The root of P (x)=0 gives x =/, x = ( / 5) /, x = (+ / 5) /. The weights are determined by the condition that the polynomials, x, x can be integrated exactly. Given, w+ w + w =, xw + xw + xw =, x w+ x w + x w =. The solution is w =4/9, w =w =5/8.

. Consider a Monte Carlo simulation to generate Boltzmann distribution using the Metropolis algorithm for the following statistical-mechanical model: H({ σ, σ, σ }) = Jσσ Jσσ J( σ + σ ), where the spins σ i =±, i =,,, and J>0 is some constant. a. Assuming that the spins are chosen at random with equal probability, determine the transition matrix W. b. What is the equilibrium/invariant distribution P associated with W? c. Outline pseudo-code that computes σ, i.e., the equilibrium average value of the first spin, in a Metropolis Monte Carlo simulation. a. The energy of the 8 states are + + + 4J + + 0 + + 0 4 + + 0 5 + +4J 6 + 0 7 + 0 8 0 The transition matrix is (in the same order as the state/energy list above) r r r r 0 0 0 0 / / r 0 0 r / 0 0 / 0 / r 0 r 0 / 0 / 0 0 0 0 / / 0 4 J /( kt ), r = e. 0 / / 0 0 0 0 / 0 / 0 / 0 0 0 / 0 0 / / 0 0 0 / 0 0 0 0 r / / / r b. By design, P is the equilibrium (canonical) distribution, P =exp(-h(σ)/kt)/z, ie., P = [exp(4j/kt),,,, exp(-4j/kt),,, ]/Z, Z = 6 + exp(-4j/kt) + exp(4j/kt), satisfies P=PW (But we don t need to solve the eigenvalue problem to get P, as the purpose of the Metropolis algorithm is to design W such that P is the equilibrium one). c. set σ =σ =σ =. M=0. for(i= to 0 6 ) { j = floor(ξ) +, Compute H(σ),

} σ j = σ j, compute again H(σ ) (where the spin j is flipped), ΔE = H(σ )-H(σ), if (ξ > exp(-δe/(kt)) { σ j = σ j, (flip back) }, M = M + σ, M = M/0 6. 4. The algorithm of the conjugate-gradient method for locating minimum is as follows: i. Initialize n 0 = g 0 = - f(x 0 ), i = 0, ii. Find λ that minimizes f(x i +λn i ), let x i+ =x i +λn i iii. Compute new negative gradient g i+ = - f(x i+ ) gi+ gi+ iv. Compute γ i = gi gi v. Update new search direction as n i+ = g i+ + γ i n i ; ++i, go to ii a. If f is a function of two scalar variables x and y, f = x + xy+ y x+ y, how many times do we need to iterate the steps? b. Starting from the point (x,y)=(0,0), determine n 0 and n according to the algorithm above and show that n T 0 A n =0, where A is the coefficient matrix of the quadratic term in f. c. Work out the steps to find the minimum (x min, y min ) of f. a. in two steps since it is two dimensional. b. n 0 = g 0 = (-x-y+,-(x+y+)) = (, -), f = (/)λ - λ, min is at λ=, (x, y ) = (,-), g =(,), γ =, n = (,) + γ(,-) = (, 0). A =, n T 0 A n = 0. c. (x,y ) = (,-) is the minimum location. 5. Consider the problem of damped nonlinear oscillator governed by the second order differential equation, 4

d x dx γ x Ft () = +, dt dt where γ is a damping constant and F(t) some external driving force which depends on time explicitly. a. Rewrite the equation as a set of first order differential equations equivalent to the original one. b. Give the numerical algorithm of the midpoint method, and determine the local truncation error, i.e., the order n in error O(h n ) where h is step size. c. Give a version of symplectic algorithm, if possible. If not possible, explain why not? dx = y, dt a. dy γ y x Ft ( ). dt = + b. the midpoint algorithm is, in general: K = hf(, t Yn ) h K K = hf( tn +, Yn + ) Yn+ = Yn + K + Oh ( ) where errors are of rd order, and vectors are x y Y=, (, txy, ) y F = γ y x + Ft () In component form for this problem, we have h xn+ = xn + h yn + ( γ yn + xn + Ft ( n) h h h yn+ = yn + h γ yn + ( γ yn + xn + Ft ( n) + ( xn + yn) + Ft ( n + ) c. No, since the system cannot be derived from a Hamiltonian due to the damping or time-dependent forces. [It has nothing to do with linear or nonlinear]. - the end - [JSW] 5