PHYC 290: Computational Physics

Instructor

Prof. Alejandro Manjavacas
Email: manjavacas@unm.edu
Office: P&A 1136
Phone: 505 277-1064

Teaching assistant
Mr.
Jui-Jen Wang
Email:
wangbtc@unm.edu
Office: P&A 131


Description of the class


This class is designed as an introduction to programming and computational methods for the undergraduate physics major. The class begins with no assumption of prior programming experience. An emphasis will be on building strong programming skills using the MATLAB programming environment. Applications and examples will include data analysis (curve fitting and optimization), simulating physical systems, solving systems of linear equations and Monte Carlo techniques.

There is no required text for the class, although there are many interesting resources in internet:

MATLAB documentation
Numerical Recipes
C++ reference


Use of your own laptop computers during class is encouraged, but not required (see how to install MATLAB).


Lectures

Monday, Wednesday, and Friday, 10:00-10:50, Regener Hall Room 118.

Office hours

Instructor
Each day after class, Wednesday at 1:00-2:00 pm in Physics (Lomas and Yale) room 1136, or by appointment.

Teaching assistant
The teaching assistant is Mr. Jui-Jen Wang (wangbtc@unm.edu). He will be available on Tuesdays and Thursdays at 1:00-2:00 Physics (Lomas and Yale) room 131 for you to discuss any homework grading issues you may have (please send  an email to arrange an appoinment).

Grading

The grading in the course will be based on your performance in homework assignments, two midterm exams, and a final exam. The contribution to the final grade is as follows:

1. Homework (40%)

Weekly homework assignments will consist of problems that must be solved using MATLAB code. Each problem will be worth of (N+M) points:

- The N points will be given based on whether the code produces the correct result or not. The grader will not attempt to fix code in any way.
- The M points will be given for well-documented code.

I encourage students to study together and learn from each other. However, all homework must be created in its entirety by each student. Evidence of copied homework will result in all involved students being dropped from the class. Assignments are due before 24:00 on the due date. No late assignments will be accepted.

The grader must be able to easily run your homework and therefore there must not be any confusion between your submissions and that from others. Homework submissions must be in the format: "LastName_HW1.m". If the solution consists of multiple files because of multiple problems or functions, then name files "LastName_HW1_Problem1.m" or "LastName_HW1_FuncName.m".

Submission Procedure: Login to your learn.unm.edu account. Find the current homework assignment for Physics 290. Upload each *.m file as an separate file. Let me know if you have problems. As a LAST resort if you are having problems, you may email me your files with subject line '290 Homework X'.

2. Quizzes (40%)

We will have four quizzes throughout the semester. No make-up quizzes will be offered.

3. Final Exam (20%)

Final Exam will consist of an individual project. Details will be discussed in class.

-->  Final project instructions

Tentative Schedule

Date Subject Material Homework HW Due Solutions
01/18 (W) Working in the Command Window and Editor. Using 'help' and 'doc'. Intro to Arrays and Matrices. Basic data types.
lecture1.m
lecture1.pdf
HW1
01/25 (W)
HW1_sol
01/20 (F) Loops and Control Structures.
lecture2.m


01/23 (M) Functions.
lecture3.m
findPrimes.m
addNums.m
 
 
 
01/25 (W) Anonymous Functions. Plotting. lecture4.m



01/27 (F) Plotting Multiple Curves. Plot Animation. lecture5.m HW2 02/06 (M)  HW2_sol
HW2_myFunc.m
01/30 (M) Making a Movie. Numerical Integration: MidPoint Method. lecture6.m


02/01 (W) The MATLAB path. Numerical Integration: Newton-Cotes formulas lecture7.m
lecture7.pdf



02/03 (F) Numerical integration: Trapezoid Method and Simpson's rule lecture8.m


02/06 (M) Switch-case. Array Operations. Cell Arrays. Structures. Intro to Classes. lecture9.m
ExpContainer.m
     
02/08 (W) Problem Session 1 PC1
PC1_sol
HW3
02/15 (W)
HW3_sol
HW3_myIntFunc.m
02/10 (F) QUIZ 1 Quiz1


Quiz1_sol
02/13 (M) Histograms. Random Number Generators (RNGs)
The Uniform and Normal Distributions.
lecture10.m
lecture10.pdf



02/15 (W) The Central Limit Theorem. Random Walks. The Exponential Distribution.   lecture11.m
lecture11.pdf
HW4 02/24 (F)
HW4_sol
02/17 (F) Error Scaling in Numerical Integration. Classes, objects and methods.  lecture12.m
ExmData.m
myIntFunc.m
   
02/20 (M) The Inversion Method. Rejection-sampling. The Poisson Distribution.
lecture13.m
lecture13.pdf
     
02/22 (W) RNGs from the Statistics Toolbox. Numerical integration: Montecarlo Method.  lecture14.m
lecture14.pdf



02/24 (F) Symbolic Calculations. lecture15.m



02/27 (M) Numerical Integration of ODEs: Euler's Method. lecture16.m
MassOnSpring.m
lecture16.pdf
HW5
03/08 (W)
HW5_sol
HW5_RK4.m
03/01 (W) Numerical Integration of ODEs: Runge-Kutta. lecture17.m



03/03 (F) Saving and Loading. Error handling. 'Publish' functionality. lecture18.m
ExpContainer.m
DotProd.m
PubExample.m



03/06 (M)
Linear Algebra and Eigenvalue problems.
lecture19.m
lecture19.pdf



03/08 (W) Problem Session 2
PC2
PC2_sol



03/10 (F) QUIZ 2 Quiz2


Quiz2_sol
03/13 (M)
Spring Break




03/15 (W) Spring Break

   
03/17 (F) Spring Break




03/20 (M) Newton´s method for finding zeros. lecture20.m
lecture20.pdf
HW6 03/29 (W)
03/22 (W) The Secant Method. lecture21.m



03/24 (F) Golden Section Search Method. Calculating Pi. lecture22.m
lecture22.pdf
GoldenSearch.m



03/27 (M) Complex Numbers; Waves and Interference.



03/29 (W) Huygens Principle; Simulating Diffraction.



03/31 (F) Overloading operators. Intro to Discrete Fourier Transforms.



04/03 (M) Creating and using a Graphical User Interface (GUI)



04/05 (W) Problem Session 3

   
04/07 (F) QUIZ 3



04/10 (M) Fourier Transforms.



04/12 (W) Fraunhofer Diffraction and the 2D Fourier Transform.
   
04/14 (F)
Solving the Heat/Diffusion Equation with Fourier Series.



04/17 (M)
Particle Wave Packets   



04/19 (W)
Convolutions



04/21 (F)
Ising Model   



04/24 (M)
Least Squares Fitting   



04/26 (W)
Problem Session 4



04/28 (F)
QUIZ 4



05/01 (M)
Latex



05/03 (W)
Final Project Presentations




05/05 (F)
Final Project Presentations







Installing MATLAB

1) Create an account at mathworks.com using your UNM email address.
2) Download and install MATLAB 2014b or later. We will not need or use most toolboxes.
3) At the point where it asks you to validate, you need to sign in with your mathworks account and provide an activation key. The key is given in the pdf linked to this page under the MATLAB section.




In an effort to meet obligations under Title IX, UNM faculty, Teaching Assistants, and Graduate Assistants are considered “responsible employees” by the Department of Education (see pg 15 - http://www2.ed.gov/about/offices/list/ocr/docs/qa-201404-title-ix.pdf). This designation requires that any report of gender discrimination which includes sexual harassment, sexual misconduct and sexual violence made to a faculty member, TA, or GA must be reported to the Title IX Coordinator at the Office of Equal Opportunity (oeo.unm.edu). For more information on the campus policy regarding sexual misconduct, see: https://policy.unm.edu/university-policies/2000/2740.html