P410 Computing Applications in Physics
P609 Computational Physics
Department of Physics, Indiana University
Spring, 2013


go to lecture notes    go to homework assignments


Taught by: Steven Gottlieb
Meets: Monday and Wednesday, 9:45 a.m. to 11:00 a.m. in Swain West 246A

Note that this is a cluster of Apple computers in the physics building near the Physics Forum commonly known as the Astronomy/Physics cluster. Please check to see whether you can log in before coming to class.


Computer Help

For help with the issues specific to the Astronomy/Physics Cluster in which we meet, send email to support@astro.indiana.edu. This would include issues like you cannot log in, or other problems that only a system administrator can solve.

For help with general computer issues, the Indiana University Knowedge Base is very useful.

Knowledge Base
Knowledge Base search help

Syllabus

These courses (P410/P609) in computer applications may be taken by undergraduates or graduate students. Click to examine the syllabus for the course.


About the Textbook

The textbook An Introduction to Computer Simulation Methods--- Applications to Physical Systems by Harvey Gould, Jan Tobochnik and Wolfgang Christian is now in its third edition. There is a web page for the text that you might want to visit. This edition of the text stresses object oriented programming. The previous examples in the book were in True Basic. They have now switched to Java. I don't plan to make much use of Java in our class, but students are welcome to do so. My examples will concentrate on C.


Student Academic Support Center


Material Relating to Lectures Will Appear Here

Notes for Lecture 1 - Introduction (January 7).

Notes for Lecture 2 - Remote Access, UNIX Basics, Hierarchical File System, Special Characters, Redirection, (January 9).

Supplementary Notes for Lectures 2,3 - On-line Help and Unix Tutorials.

Here are some on-line tutorials for AWK:
   An AWK Primer
   awk tutorial
   Awk - A Tutorial and Introduction - by Bruce Barnett

Some information on choosing a shell:
   UNIX shell differences and how to change your shell
   Top Ten Reasons not to use the C shell

Notes for Lecture 3 - Completion of Redirection, aliases, AWK, axis, Introduction to Euler Method (January 14).

Axis Documentation (PDF).

Notes for Lecture 4 - Error Analysis for the Euler Method, Shell Scripts (January 16).

Notes for Lecture 5 - Error Analysis for the Euler Method (II), Introduction to Newton's 2nd Law (January 23).

Notes for Lecture 6 - Energy (non)conservation, Euler vs. Euler-Cromer; More shell scripts; Motivation for Euler-Richardson Algorithm (January 28).

Notes for Lecture 7 - Multiple Plots; A Body Falling in a Position Dependent Potential; Scripts to automate out plotting (January 30).

Notes for Lecture 8 - Error of the Euler-Richardson Algorithm, Extrapolation to zero height, Graphing the velocity ratio (February 4).

Notes for Lecture 9 - Root Finding, Oscillatory Motion (February 6).

Notes for Lecture 10 - Oscillatory Motion, Conservation of Energy in the Euler Algorithm, Sources of Numerical Analysis Code, Final Project (February 11).

Notes for Lecture 11 - Higher Order Algorithms, Introduction to Mathematica (February 18).

Notes for Lecture 12 - Introduction to Mathematica, Random Walks and Biased Estimators (February 20).

Notes for Lecture 13 - Statistical Analysis with Mathematica, Biased Estimators (continued), Bias Reduction and the Jackknife Method (February 22).

Notes for Lecture 14 - Application of the Jackknife Method, Hist, Blockerr (February 25).

Notes for Lecture 15 - Jackknife Error, Jackknife Method Via Mathematica, Introduction to Chaos and Logistic Map (February 27).

Notes for Lecture 16 - Chaos and Logistic Map (March 1).

Notes for Lecture 17 - AHO, Finding Bifurcation Points and Superstable Trajectories, Instability and Chaos (March 4).

    Why you might not want to use Numerical Recipies

Notes for Lecture 18 - Lyapunov Exponent, Numerical Integration in One Dimension (March 6).

Notes for Lecture 19 - Simpson's Rule Rederived, Hit or Miss Method, Sample Mean Method (March 18).

Notes for Lecture 20 - Higher Dimensional Integrals, Testing Hit or Miss Method, Aver (March 20).

Notes for Lecture 21 - Sample Mean Method, Inverse Transform Method, Box-Muller Method (March 25).

Notes for Lecture 22 - Correlations, Metropolis Method, Autocorrelations (March 27).

Notes for Lecture 23 - Shell Scripts for Metropolis Method, Pseudorandom Numbers Generators, Serial Correlation Tests (April 1).

Notes for Lecture 24 - Serial Correlation Tests, Autocorrelations of PRNG, Feedback Shift Register Random Number Generator, SPRNG (April 3).

Notes for Lecture 25 - Fitting Data, Chi-squared Distribution (April 8).

Notes for Lecture 26 - Fitting Data, Chi-squared Distribution, Confidence Levels, Polyfit (April 10).

Notes for Lecture 27 - Verification of Error Estimates, Non-linear Data Fitting (April 15).

Notes for Lecture 28 - Non-linear Data Fitting, Introduction to Parallel Computing (April 17).

go to top of page    go to homework assignments


Notes from 2012 Lectures

Notes for Lecture 1 - Introduction (January 10).

Notes for Lecture 2 - Remote Access, UNIX Basics, Hierarchical File System, Special Characters, Redirection, (January 12).

Supplementary Notes for Lectures 2,3 - On-line Help and Unix Tutorials.

Here are some on-line tutorials for AWK:
   An AWK Primer
   awk tutorial
   Awk - A Tutorial and Introduction - by Bruce Barnett

Some information on choosing a shell:
   UNIX shell differences and how to change your shell
   Top Ten Reasons not to use the C shell

Notes for Lecture 3 - Completion of Redirection, aliases, AWK, axis, Introduction to Euler Method (January 17).

Axis Documentation (PDF).

Notes for Lecture 4 - Error Analysis for the Euler Method, Shell Scripts (January 19).

Notes for Lecture 5 - Error Analysis for the Euler Method (II), Introduction to Chapter 3, Energy (non)conservation (January 24).

Notes for Lecture 6 - Euler vs Euler-Cromer; More shell scripts; Euler-Richardson Algorithm; Multiple Graphs; Body Falling in Position Dependent Potential (January 26).

Notes for Lecture 7 - Body Falling in Position Dependent Potential (continued) (January 31).

Notes for Lecture 8 - Error of the Euler-Richardson Algorithm, Extrapolation to zero height, Root finding (February 2).

Notes for Lecture 9 - Graphing the velocity ratio, Details of root finding, Finding the initial height, Oscillatory Motion (February 7).

Notes for Lecture 10 - Oscillatory Motion, Conservation of Energy in the Euler Algorithm, Sources of Numerical Analysis Code, Higher Order Algorithms (February 9).

Notes for Lecture 11 - Final Project, Higher Order Algorithms, Introduction to Mathematica (February 14).

Notes for Lecture 12 - Random Walks and Biased Estimators Using Mathematica (February 16).

Notes for Lecture 13 - Review of Biased Estimators, Application of the Jackknife Method (February 21).

Notes for Lecture 14 - Histograms, Jackknife Error, Jackknife Method Via Mathematica, Introduction to Chaos and Logistic Map (February 23).

Notes for Lecture 15 - Chaos and Logistic Map (February 28).

Notes for Lecture 16 - Finding Bifurcation Points and Superstable Trajectories (March 1).

    Why you might not want to use Numerical Recipies

Notes for Lecture 17 - Finding Superstable Trajectories with GSL, Instability and Chaos, Lyapunov Exponents (March 6).

Notes for Lecture 18 - Numerical Integration in One Dimension (March 8).

Notes for Lecture 19 - Simpson's Rule Rederived, Hit or Miss Method, Sample Mean Method (March 20).

Notes for Lecture 20 - Testing the Hit or Miss Method, Aver, Testing Trapeziod, Simpson and Romberg Methods (part 1) (March 22).

Notes for Lecture 21 - AHO, NDSolve, Testing Trapeziod, Simpson and Romberg Methods (part 2) (March 27).

Notes for Lecture 22 - Inverse Tranform Method, Box-Muller Method (March 29).

Notes for Lecture 23 - Metropolis Algorithm, Autocorrelations (April 3).

Notes for Lecture 24 - Pseudorandom Numbers Generators, Serial Correlation Tests (April 5).

Notes for Lecture 25 - Autocorrelations of PRNG, Feedback Shift Register Random Number Generator, SPRNG (April 10).

Notes for Lecture 26 - SPRNG, Fitting Data, Chi-squared Distribution (April 12).

Notes for Lecture 27 - Homework Revisited, Chi-squared Distribution (April 17).

Notes for Lecture 28 - More on Chi-squared Distribution (April 19).

go to top of page    go to homework assignments


Notes from 2007 Lectures

Notes for Lecture 1 - Introduction (August 28).

Notes for Lecture 2 - UNIX Basics, Hierarchical File System, Special Characters, Redirection, (August 30).

Notes for Lecture 3 - AWK, Introduction to Euler Method (September 4).

Notes for Lecture 4 - Error Analysis for the Euler Method, Shell Scripts (September 6).

Notes for Lecture 5 - Error Analysis for the Euler Method (II), Introduction to Chapter 3, Energy (non)conservation (September 11).

Notes for Lecture 6 - More shell scripts, Euler-Richardson Algorithm; Multiple Graphs; Body Falling in Position Dependent Potential (September 13).

Notes for Lecture 7 - Body Falling in Position Dependent Potential (continued), Graphing velocity ratio (September 18).

Notes for Lecture 8 - Root finding, Running adapt.c to find height, Oscillatory motion (September 20).

Notes for Lecture 9 - Oscillatory Motion, Script writing, Conservation of Energy in the Euler Algorithm (September 25).

Notes for Lecture 10 - Sources of Numerical Analysis Code, Higher Order Algorithms.
Notes for Lecture 10 - How Can We Do Better Than the Euler Algorithm? (PDF) (September 27).

Notes for Lecture 11 - Final Project, Introduction to Mathematica (October 2).

Notes for Lecture 12 - Biased Estimators Using Mathematica (October 9).

Notes for Lecture 13 - Review of Biased Estimators, Hist, Application of the Jackknife Method (October 11).

Notes for Lecture 14 - Jackknife Error, Jackknife Method Via Mathematica, Introduction to Chaos and Logistic Map (October 16).

Notes for Lecture 15 - Chaos and Logistic Map (October 18).

Notes for Lecture 16 - Chaos and Logistic Map (continued) (October 23).

Notes for Lecture 17 - Finding Bifurcation Points (October 25).

Notes for Lecture 18 - Finding Superstable Trajectories with GSL, Instability and Chaos, Lyapunov Exponents (October 30).

Notes for Lecture 19 - Numerical Integration in One Dimension (November 1).

Notes for Lecture 20 - Simpson's Rule Rederived, AHO, NDSolve, Hit or Miss Method (November 6).

Notes for Lecture 21 - Tar; Testing Trapeziod, Simpson and Romberg Methods; Hit or Miss Method (November 8).

Notes for Lecture 22 - Testing the Hit or Miss Method, Aver (November 13).

Notes for Lecture 23 - Inverse Tranform Method, Box-Muller Method (November 15).

Notes for Lecture 24 - Metropolis Algorithm, Autocorrelations (November 20).

Notes for Lecture 25 - Pseudorandom Numbers Generators, Serial Correlation Tests (November 27).

Notes for Lecture 26 - Feedback Shift Register Random Number Generator, Fitting Data (November 29).

Notes for Lecture 27 - Fitting Data, Chi-squared Distribution, Nonlinear Fitting, Polyfit (December 4).


Notes from 2006 Lectures

Notes for Lecture 1 - Introduction (August 29).

Notes for Lecture 2 - UNIX Basics, Hierarchical File System, Special Characters, Redirection, (August 31).

Supplementary Notes for Lecture 2 - On-line Help and Unix Tutorials.

Axis Documentation (PDF).

Notes for Lecture 3 - AWK, Introduction to Euler Method (September 5).

Notes for Lecture 4 - Error Analysis for the Euler Method, Shell Scripts (September 7).

Notes for Lecture 5 - Error Analysis for the Euler Method (II), Introduction to Chapter 3 (September 12).

Notes for Lecture 6 - Newton's Laws of Motion, Energy Nonconservation (September 14).

Notes for Lecture 7 - AFS, ssh, Euler-Richardson Algorithm; Multiple Graphs; Body Falling in Position Dependent Potential (September 19).

Notes for Lecture 8 - Printing From Nations to Lindley, Body Falling in Position Dependent Potential (continued), Graphing velocity ratio (September 21).

Notes for Lecture 9 - Root finding, Running adapt.c to find height, Oscillatory motion (September 26).

Notes for Lecture 11 - How Can We Do Better Than the Euler Algorithm? (PDF) (October 3).

Notes for Lecture 12 - Final Project, Introduction to Mathematica (October 5).

Notes for Lecture 13 - Biased Estimators Using Mathematica (October 10).

Notes for Lecture 14 - Hist, Application of the Jackknife Method (October 12).

Notes for Lecture 15 - Jackknife Mean, Jackknife Method Via Mathematica, Introduction to Chaos and Logistic Map (October 17).

Notes for Lecture 16 - AHO, NDSolve, Chaos and Logistic Map (continued) (October 19).

Notes for Lecture 20 - Hit or Miss Method, Inverse Transform Method (November 7).

Notes for Lecture 21 - Inverse Transform Method Applied, Box-Muller Method (November 9).

Notes for Lecture 22 - Metropolis Algorithm, Autocorrelations (November 16).

Notes for Lecture 23 - Monte Carlo Error Analysis (November 21).

Notes for Lecture 24 - Shell Scripts for HW, Monte Carlo Error Analysis (continued), Multiprecision Library (November 28).

Notes for Lecture 25 - Pseudorandom Numbers Generators, Serial Correlation Tests (November 30).

Notes for Lecture 26 - Feedback Shift Register Random Number Generator, Fitting Data (December 1).


Notes from 2005 Lectures

Notes for Lecture 1 - Introduction, UNIX Basics, Hierarchical File System, Special Characters (August 30).

Supplementary Notes for Lecture 1 - On-line Help and Unix Tutorials.

Notes for Lecture 2 - Special Characters, Redirection, axis (September 1).

Notes for Lecture 3 - AWK, Introduction to Euler Method (September 6).

Notes for Lecture 4 - Error analysis of Euler Algorithm, Shell Scripts, Intro. to Chap 3 (September 8).

Notes for Lecture 5 - Newton's Laws of Motion, Energy Nonconservation (September 13).

Notes for Lecture 6 - Euler-Richardson Algorithm; Multiple Graphs; Body Falling in Position Dependent Potential (September 15).

Notes for Lecture 7 - Body Falling in Position Dependent Potential (continued), Graphing velocity ratio (September 22).

Notes for Lecture 8 - Root finding, Running adapt.c to find height (September 27).

Notes for Lecture 9 - Oscillatory Motion, Script writing, Conservation of Energy in the Euler Algorithm (September 29).

  Some remarks about C programming (These are not lecture notes, but you might find them useful.)

Notes for Lecture 10 - Error Analysis, Higher Order Algorithms (October 6).

Notes for Lectures 11-14 - Final Project, Introduction to Mathematica, Random Walks (October 11-21).

Notes for Lecture 12 - More Random Walks, Hist, Biased Estimators (October 18).

Notes for Lecture 17 - Project, AHO, Optimal Step Size, Advanced Root Finding (November 1).

Notes for Lecture 18 - Finding Bifurcation Points, Instability and Chaos, Lyapunov Exponent (November 3).

Notes for Lecture 19 - Numerical Integration in One Dimension (November 4).

Notes for Lecture 20 - Simpson's Rule Rederived, Hit or Miss Method, (November 8).

Notes for Lecture 21 - Second Semester Outline, Inverse Transform Method, Box-Muller Method (November 11).


Notes from 2004 Lectures

Notes for Lecture 1 - Introduction, UNIX Basics (August 31).

Supplementary Notes for Lecture 1 - On-line Help and Unix Tutorials.

Notes for Lecture 2 - Hierarchical File System, Special Characters (September 2).

Notes for Lecture 3 - Redirection, axis, AWK, Introduction to Euler Method (September 7).

Notes for Lecture 4 - Error analysis of Euler Algorithm, Shell Scripts (September 9).

Notes for Lecture 5 - Newton's Laws of Motion, Energy Nonconservation (September 14).

Notes for Lecture 6 - Euler-Richardson Algorithm; Multiple Graphs; Body Falling in Position Dependent Potential (September 16).

Lectures 7-8 - Koppix Linux, hardware and software installation (September 21, 23).

Notes for Lecture 9 - Body Falling in Position Dependent Potential (continued), Root finding (September 28).

Notes for Lecture 10 - Graphing Velocity Ratio, Root finding (continued) (September 30).

Notes for Lecture 11 - Running adapt, Oscillatory Motion, Conservation of Energy in the Euler Algorithms (October 5).

  Some remarks about C programming (These are not lecture notes, but you might find them useful.)

Notes for Lecture 12 - Higher Order Algorithms (October 7).

Notes for Lectures 13-16 - Final Project, Introduction to Mathematica (October 12-21).

Notes for Lecture 14 - Random Walks, Biased Estimators (October 14).

Notes for Lecture 15 - Biased Estimators and Jackknife Method I (October 19).

Notes for Lecture 16 - Hist, Application of the Jackknife Method (October 21).

Notes for Lecture 17 - Jackknife Method Via mathematica (October 26).

    A few comments about efficiency

Notes for Lecture 18 - Energy Conservation; Logistic Map and Chaos (October 28).

Notes for Lecture 19 - Logistic Map and Chaos (continued) (November 2).

Notes for Lecture 20 - Continuation of Logistic Map and Chaos (November 4).

Notes for Lecture 22 - Project, Numerical Integration in One Dimension (November 11).

Notes for Lecture 23 - Hit or Miss Method, Inverse Transform Method (November 16).

Notes for Lecture 24 - Exponential Distribution, Box-Muller Method (November 18).

Notes for Lecture 25 - Metropolis Method, Autocorrelations (November 23).

Notes for Lecture 26 - Pseudorandom Number Generators, Serial Correlation Tests (November 30).

Notes for Lecture 27 - Fitting Data, Chi-squared distribution (December 2).

Notes for Lecture 28 - More on Chi-squared distribution (December 7).

Notes for Lecture 29 - Non-Linear Fitting (December 9).


Homework Assignments Will Appear Below

The first exercise is due on Wednesday, January 23. It involves awk and axis, if you wish to produce your graph that way. You are welcome to use a different program as long as you can make the plots as requested.
PDF

Homework Assignment 1 (Due Wednesday, February 6, 2013) .

Homework Assignment 2 (Due Wednesday, February 20, 2013) .

Homework Assignment 3 (Due Wednesday, February 27, 2013) .

Homework Assignment 4 (Due Wednesday, April 3, 2013) .

Homework Assignment 5 (Due Wednesday, April 17, 2013) .

go to top of page    go to lecture notes


Homework Assignments From 2012
The first exercise is due on Thursday, January 19. It involves awk and axis which we will discuss on Tuesday.
PDF

Homework Assignment 1 (Due Tuesday, February 7, 2012) .

Homework Assignment 2 (Due Tuesday, February 21, 2012) .

Homework Assignment 3 (Due Tuesday, March 20, 2012) .

Homework Assignment 4 (Due Thursday, April 5, 2012) .

Homework Assignment 5 (Due Thursday, April 19, 2012) .

go to top of page    go to lecture notes


Homework Assignments From 2007
The first exercise is due on Thursday, September 6. It was explained in class.
PDF

Homework Assignment 1 (Due Thursday, September 20, 2007) .

Homework Assignment 2 (Due Tuesday, October 2, 2007) .

Homework Assignment 3 (Due Tuesday, October 23, 2007) .

Homework Assignment 4 (Due Thursday, November 8, 2007) .

Homework Assignment 5 (Due Thursday, November 29, 2007) .


Homework Assignments From 2006
The first exercise is due on Thursday, September 7. It was explained in class and can be found at either link. You need to be able to view either PostScript or PDF.
PostScript
PDF

Homework Assignment 1 (Due Thursday, September 21, 2006) .

Homework Assignment 2 (Due Thursday, October 5, 2006) .

Homework Assignment 3 (Due Thursday, October 19, 2006) .

Homework Assignment 4 (Due Tuesday, November 7, 2006) .

Homework Assignment 5 (Due Thursday, November 30, 2006) .


Homework Assignments From 2005
The first exercise is due on Thursday, September 8. It was explained in class and can be found at either link. You need to be able to view either PostScript or PDF.
PostScript
PDF

Homework Assignment 1 (Due Thursday, September 22, 2005) .

Homework Assignment 2 (Due Tuesday, October 11, 2005) .

Homework Assignment 3 (Due Tuesday, October 25, 2005) .

Homework Assignment 4 (Due Tuesday, November 8, 2005) .

Homework Assignment 5 (Due Thursday, November 17, 2005) .

Homework Assignment 6 (Due Thursday, December 8, 2005) .


Homework Assignments From 2004
The first exercise is due on Tuesday, September 14. It was explained in class and can be found at either link. You need to be able to view either PostScript or PDF.
PostScript
PDF

Homework Assignment 1 (Due Tuesday, September 28, 2004) .

Homework Assignment 2 (Due Thursday, October 7, 2004) .

Homework Assignment 3 (Due Thursday, October 21, 2004) .

Homework Assignment 4 (Due Thursday, November 4, 2004) .

Homework Assignment 5 (Due Thursday, November 18, 2004) .

Homework Assignment 6 (Due Thursday, December 2, 2004) .



What are archived documents?
-->