# MacKinnon - Computational Physics

Посмотреть архив целикомПросмотреть файл в отдельном окне: ae8aa3a35eb6aa58da931c68d3a5ea8f.pdf

Computational Physics — 3rd/4th Year Option

Angus MacKinnon

September 26, 2002

Computational Physics

Course Description

The use of computers in physics, as well as most other branches of science and engineering, has increased

many times along with the rapid development of faster and cheaper hardware. This course aims to give the

student a thorough grounding in the main computational techniques used in modern physics. It is particularly important in this course that the students should learn by doing. The course is therefore designed such

that a significant fraction of the students’ time is spent actually programming specific physical problems

rather than learning abstract techniques.

The course will cover problems in 4(5) broad sections:

Ordinary differential equations, such as those of classical mechanics.

Partial differential equations, such as Maxwell’s equations and the Diffusion and Schr?odinger equations.

Matrix methods, such as systems of equations and eigenvalue problems applied to Poisson’s equation

and electronic structure calculations.

Monte Carlo and other simulation methods, such as the Metropolis algorithm and molecular dynamics.

(If time permits:) Computer Algebra; an introduction using Maple to the uses and abuses of algebraic

computing in physics.

This is not a short course in computing science, nor in programming. It focuses specifically on methods

for solving physics problems. Students will be expected to be familiar with basic programming: successful

completion of the 1st year computing Lab. is sufficient. There is no requirement that the practical work be

done using Microsoft C++ on the departmental computers, but anyone wishing to use some other programming language or computer should consult the lecturer beforehand. This is to make sure there is both help

available from demonstrators and that it will be possible to assess the work satisfactorily.

A detailed timetable for the course is given below.

Each of the 4(5) sections of the course will be accompanied by a short problem sheet including practical

exercises and longer projects.

Students will be expected to do the first project and 2 others. There will be a choice of projects available

in the later sections.

This year you will be required to submit your program electronically in addition to including it as an

appendix in your project reports. You should also include an example input file and the corresponding

output file. This will enable the assessors to check and run your program if necessary. Your program

should be sent as a plain text e-mail attachment(s)1 to Computational-Physics, A. MacKinnon

or ph.compphys@ic.ac.uk by the stated deadline. Do not send it to my personal e-mail address. The

first project is to be handed in to Martin Morris in the Computing Lab by 5.00pm on the 28th October.

These will be assessed and returned by the demonstrators who should provide the students with feedback

which will be of use in the longer projects later on. This project will count for

of the final result.

1 Using

Outlook click Insert then File

1

During the Lab. sessions staff and demonstrators will be available, but the students are expected to

do the practical work and the problems outside these times as well. I am aware that there is an General

Relativity lecture scheduled for 3.00pm on Tuesdays. Nevertheless the Lab. will be reserved for this course

for the whole afternoon and demonstrators will be available during this period.

The report on the 2nd project, which should be chosen from the 2 offered on Partial Differential Equations, should be submitted by 5.00pm on November 18th.

The 3rd project may be chosen from those offered on Matrix and Monte Carlo methods (or possibly on

Computer Algebra) and the report should be submitted by 5.00pm on Friday December 13th, the last day

of term. This timetable has been designed to make sure that students are working at a steady rate during

the term.

From 10.00am – 12.00 noon on Monday 6th January 2003, there will be a short written test under exam

conditions. This will count for

of the final result. The 2nd and 3rd projects will also count for

.

Thus the distribution of marks for the various parts of the course will be approximately

Project 1

Project 2

Project 3

Test

Week

Sep. 30

Oct. 7

Oct. 14

Oct. 21

Oct. 28

Nov. 4

Nov. 11

Nov. 18

Nov. 25

Dec. 2

Dec. 9

Jan. 6

Lectures

Thu. 9.00am

Fri. 2.00pm

Fri. 4.00pm

Fri. 4.00pm

Fri. 4.00pm

Fri. 4.00pm

Fri. 4.00pm

10

30

30

30

Practicals

Tue. 2.00–5.00pm

Tue. 2.00–5.00pm

Tue. 2.00–5.00pm

Tue. 2.00–5.00pm

Tue. 2.00–5.00pm

Thu. 9.00am Tue. 2.00–5.00pm

Thu. 9.00am Tue. 2.00–5.00pm

Thu. 9.00am Tue. 2.00–5.00pm

Thu. 9.00am Tue. 2.00–5.00pm

Thu. 9.00am Tue. 2.00–5.00pm

Test: Mon. 10.00am–12.00noon

Deadlines

Mon. 5.00pm 1st Project

Mon. 5.00pm 2nd Project

Fri. 5.00pm 3rd Project

For those with surnames beginning with A–K the test will be in lecture theatre 2 and for those with

surnames beginning with L–Z in lecture theatre 3.

There will be no examination in the summer.

A copy of the timetable as well as contact details for the demonstrators is posted on the Exchange server.

This can be accessed from Outlook under //Public Folders/All Public Folders/Physics/Computational Physics.

Further information is available on the World Wide Web under

http://www.cmth.ph.imperial.ac.uk/angus/Lectures/compphys/.

Chapter 1

Ordinary Differential Equations

1.1 Types of Differential Equation

In this chapter we will consider the methods of solution of the sorts of ordinary differential equations

(ODEs) which occur very commonly in physics. By ODEs we mean equations involving derivatives with

respect to a single variable, usually time. Although we will formulate the discussion in terms of linear

ODEs for which we know the analytical solution, this is simply to enable us to make comparisons between

the numerical and analytical solutions and does not imply any restriction on the sorts of problems to which

the methods can be applied. In the practical work you will encounter examples which do not fit neatly into

these categories.

The work in this section is also considered in chapter 16 of Press et al. (1992) or chapter II of Potter

(1973)

We consider 3 basic differential equations:

$

,

()+*

!#"%$ %&

!#" ' %&

!#".- )+* %&

The Decay equation

(1.1)

The Growth equation

(1.2)

The Oscillation equation

(1.3)

which are representative of most more complex cases.

Higher order differential equations can be reduced to 1st order by appropriate choice of additional variables. The simplest such choice is to define new variables to represent all but the highest order derivative.

For example, the damped harmonic oscillator equation, usually written as

/

1

0 0 32

54

(1.4)

17

in the form of a pair of 1st order ODEs

can be rewritten in terms of and velocity 6

6 2 4 1

(1.5)

/ $6 /

1

6

(1.6)

Similarly any 8 th order differential equation can be reduced to 8 1st order equations.

Such systems of ODEs can be written

in a very concise notation by defining a vector, y say, whose

elements are the unknowns, such as and 6 in (1.1). Any ODE in 8 unknowns can then be written in the

general form

y " %&;

9 f y :

(1.7)

3

Ordinary Differential Equations

4

8

where y and f are –component vectors.

Remember that there is no significance in the use of the letter in the above equations. The variable is

not necessarily time but could just as easily be space, as in (1.9), or some other physical quantity.

Formally we can write the solution of (1.7) as

"

Angus MacKinnon

September 26, 2002

Computational Physics

Course Description

The use of computers in physics, as well as most other branches of science and engineering, has increased

many times along with the rapid development of faster and cheaper hardware. This course aims to give the

student a thorough grounding in the main computational techniques used in modern physics. It is particularly important in this course that the students should learn by doing. The course is therefore designed such

that a significant fraction of the students’ time is spent actually programming specific physical problems

rather than learning abstract techniques.

The course will cover problems in 4(5) broad sections:

Ordinary differential equations, such as those of classical mechanics.

Partial differential equations, such as Maxwell’s equations and the Diffusion and Schr?odinger equations.

Matrix methods, such as systems of equations and eigenvalue problems applied to Poisson’s equation

and electronic structure calculations.

Monte Carlo and other simulation methods, such as the Metropolis algorithm and molecular dynamics.

(If time permits:) Computer Algebra; an introduction using Maple to the uses and abuses of algebraic

computing in physics.

This is not a short course in computing science, nor in programming. It focuses specifically on methods

for solving physics problems. Students will be expected to be familiar with basic programming: successful

completion of the 1st year computing Lab. is sufficient. There is no requirement that the practical work be

done using Microsoft C++ on the departmental computers, but anyone wishing to use some other programming language or computer should consult the lecturer beforehand. This is to make sure there is both help

available from demonstrators and that it will be possible to assess the work satisfactorily.

A detailed timetable for the course is given below.

Each of the 4(5) sections of the course will be accompanied by a short problem sheet including practical

exercises and longer projects.

Students will be expected to do the first project and 2 others. There will be a choice of projects available

in the later sections.

This year you will be required to submit your program electronically in addition to including it as an

appendix in your project reports. You should also include an example input file and the corresponding

output file. This will enable the assessors to check and run your program if necessary. Your program

should be sent as a plain text e-mail attachment(s)1 to Computational-Physics, A. MacKinnon

or ph.compphys@ic.ac.uk by the stated deadline. Do not send it to my personal e-mail address. The

first project is to be handed in to Martin Morris in the Computing Lab by 5.00pm on the 28th October.

These will be assessed and returned by the demonstrators who should provide the students with feedback

which will be of use in the longer projects later on. This project will count for

of the final result.

1 Using

Outlook click Insert then File

1

During the Lab. sessions staff and demonstrators will be available, but the students are expected to

do the practical work and the problems outside these times as well. I am aware that there is an General

Relativity lecture scheduled for 3.00pm on Tuesdays. Nevertheless the Lab. will be reserved for this course

for the whole afternoon and demonstrators will be available during this period.

The report on the 2nd project, which should be chosen from the 2 offered on Partial Differential Equations, should be submitted by 5.00pm on November 18th.

The 3rd project may be chosen from those offered on Matrix and Monte Carlo methods (or possibly on

Computer Algebra) and the report should be submitted by 5.00pm on Friday December 13th, the last day

of term. This timetable has been designed to make sure that students are working at a steady rate during

the term.

From 10.00am – 12.00 noon on Monday 6th January 2003, there will be a short written test under exam

conditions. This will count for

of the final result. The 2nd and 3rd projects will also count for

.

Thus the distribution of marks for the various parts of the course will be approximately

Project 1

Project 2

Project 3

Test

Week

Sep. 30

Oct. 7

Oct. 14

Oct. 21

Oct. 28

Nov. 4

Nov. 11

Nov. 18

Nov. 25

Dec. 2

Dec. 9

Jan. 6

Lectures

Thu. 9.00am

Fri. 2.00pm

Fri. 4.00pm

Fri. 4.00pm

Fri. 4.00pm

Fri. 4.00pm

Fri. 4.00pm

10

30

30

30

Practicals

Tue. 2.00–5.00pm

Tue. 2.00–5.00pm

Tue. 2.00–5.00pm

Tue. 2.00–5.00pm

Tue. 2.00–5.00pm

Thu. 9.00am Tue. 2.00–5.00pm

Thu. 9.00am Tue. 2.00–5.00pm

Thu. 9.00am Tue. 2.00–5.00pm

Thu. 9.00am Tue. 2.00–5.00pm

Thu. 9.00am Tue. 2.00–5.00pm

Test: Mon. 10.00am–12.00noon

Deadlines

Mon. 5.00pm 1st Project

Mon. 5.00pm 2nd Project

Fri. 5.00pm 3rd Project

For those with surnames beginning with A–K the test will be in lecture theatre 2 and for those with

surnames beginning with L–Z in lecture theatre 3.

There will be no examination in the summer.

A copy of the timetable as well as contact details for the demonstrators is posted on the Exchange server.

This can be accessed from Outlook under //Public Folders/All Public Folders/Physics/Computational Physics.

Further information is available on the World Wide Web under

http://www.cmth.ph.imperial.ac.uk/angus/Lectures/compphys/.

Chapter 1

Ordinary Differential Equations

1.1 Types of Differential Equation

In this chapter we will consider the methods of solution of the sorts of ordinary differential equations

(ODEs) which occur very commonly in physics. By ODEs we mean equations involving derivatives with

respect to a single variable, usually time. Although we will formulate the discussion in terms of linear

ODEs for which we know the analytical solution, this is simply to enable us to make comparisons between

the numerical and analytical solutions and does not imply any restriction on the sorts of problems to which

the methods can be applied. In the practical work you will encounter examples which do not fit neatly into

these categories.

The work in this section is also considered in chapter 16 of Press et al. (1992) or chapter II of Potter

(1973)

We consider 3 basic differential equations:

$

,

()+*

!#"%$ %&

!#" ' %&

!#".- )+* %&

The Decay equation

(1.1)

The Growth equation

(1.2)

The Oscillation equation

(1.3)

which are representative of most more complex cases.

Higher order differential equations can be reduced to 1st order by appropriate choice of additional variables. The simplest such choice is to define new variables to represent all but the highest order derivative.

For example, the damped harmonic oscillator equation, usually written as

/

1

0 0 32

54

(1.4)

17

in the form of a pair of 1st order ODEs

can be rewritten in terms of and velocity 6

6 2 4 1

(1.5)

/ $6 /

1

6

(1.6)

Similarly any 8 th order differential equation can be reduced to 8 1st order equations.

Such systems of ODEs can be written

in a very concise notation by defining a vector, y say, whose

elements are the unknowns, such as and 6 in (1.1). Any ODE in 8 unknowns can then be written in the

general form

y " %&;

9 f y :

(1.7)

3

Ordinary Differential Equations

4

8

where y and f are –component vectors.

Remember that there is no significance in the use of the letter in the above equations. The variable is

not necessarily time but could just as easily be space, as in (1.9), or some other physical quantity.

Formally we can write the solution of (1.7) as

"

Чтобы не видеть никакую рекламу на сайте, нужно стать

**VIP**-пользователем.

Это можно сделать совершенно бесплатно. Читайте подробности тут.