Meets MWF 10:0010:50 Regener Hall 118
Instructor: Prof. Keith Lidke
Room 1140, Physics and Astronomyemail: klidke@unm.edu
phone: (505)2770302
Teaching Assistant: Mohamad Fazel
email: fazel@unm.eduOffice Hours
Prof. Lidke: Each day after class, Monday at 13:0014:00 in Physics (Lomas and Yale) room 1140, or by appointment.Overview
This class is designed as an introduction to programming 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.
Use of your own laptop computers during class is encouraged, but not required.
Grading
Letter grades correspond with numerical scores as given by this scale: Grade Scale. Grades will be assigned based on the following:
Homework (70%)
Weekly homework assignments will consist of problems that must be solved using MATLAB code. Each problem will be scored as 1 or 0 based on whether the code produces the correct result or not. The grader will not attempt to fix code in any way. An additional .1 points of extra credit will be given for each problem for welldocumented 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'.
Quizes (20%)
We will have five quizzes throughout the semester. Lowest scoring quiz of the semester will be dropped. No makeup quizzes will be offered.Final Exam (10%)
Final Exam will consist of individual projects. Details will be discussed in class.
Home Work Assignments
Homework  Due Date  Assignment  Solution 

1  Jan 25  HW1 
HW1_Solutions.m 
2  Feb 1  HW2 
HW2_Solutions.m HW2_myDiv.m 
3  Feb 8  HW3 
HW3_Solutions.m HW3_myIntFunc.m 
4  Feb 22  HW4 
HW4_Solutions.m 
5  Feb 29  HW5 
HW5_Solutions.m RK4.m 
EC1  Mar 4  EC1 

6  Mar 21  HW6 
HW6_Solutions.m HW6_ArbDiv.m HW6_ArbAdd.m HW6_ArbPrint.m HW6_matProd.m 
7  Mar 28  HW7 
HW7_Solutions.m HW7_NDigits.m HW7_dft.m 
8  Apr 11 
HW8 HW8_NoisyData.mat 
HW8_Solutions.m HW8_wave_decay.m 
9  Apr 18 
HW9 HW9_NoisyData.mat 
HW9_Solutions.m HW9_2DIsing.m 
10  May 9 
HW10 

EC2  May 11  EC2 

Final Project  May 12  Final Project 
Lecture Notes
Date  Skills and Concepts Discussed  MATLAB Lecture Notes 

Jan 20 
Working in the Command Window and Editor; Using 'help' and 'doc'; Intro to Arrays and Matrices. Basic data types. 
Jan_20.m 
Jan 22 
Loops and Control Structures 
Jan_22.m 
Jan 25 
Functions 
Jan_25.m findPrimes.m addNums.m 
Jan 27 
Anonymous Functions, Plotting 
Jan_27.m 
Jan 29 
Plotting Multiple Curves, Plot Animation 
Jan_29.m 
Feb 1 
Making a Movie. Numerical Integration: MidPoint Method 
Feb_1.m 
Feb 3 
The MATLAB path. Numerical Integration: Trapezoid Method 
Feb_3.m 
Feb 5 
switchcase, Array Operations, Cell Arrays, Structures, Intro to Classes 
Feb_5.m ExpContainer.m 
Feb 8 
Histograms, The Uniform and Normal Distributions 
Feb_8.m 
Feb 10 
QUIZ 1. Some example questions. OldQuiz3 OldQuiz2 OldQuiz1 Quiz1A Quiz1A_Solutions Quiz1B Quiz1B_Solutions 

Feb 12 
Scaling of errors; The Central Limit Theorem, Random Walks 
Feb_12.m myIntFunc.m 
Feb 15 
Classes, objects and methods; The Exponential Distribution 
Feb_15.m ExmData.m 
Feb 17 
The Inversion Method; the Poisson Distribution; 'Publish' functionality 
Feb_17.m PubExample.m 
Feb 19 
RNGs from the Statistics Toolbox; Symbolic Calculations 
Feb_19.m 
Feb 22 
Numerical Integration of ODEs using Euler's Method 
Feb_22.m MassOnSpring.m 
Feb 24 
Numerical Integration of ODEs using RungeKutta 
Feb_24.m 
Feb 26 
Saving and Loading; Linear Algebra; Error handling 
Feb_26.m DotProd.m 
Mar 2 
QUIZ 2. Quiz2A Quiz2A_Solutions Quiz2B Quiz2B_Solutions 

Mar 4 
Newton's Method 
Mar_4.m 
Mar 7 
The Secant Method; Intro to Golden Section Search 
Mar_7.m 
Mar 9 
Flowchart and code design; Golden Section Search Update Algorithm 
Mar_9.m 
Mar 11 
Using the Golden Search; Calculating Pi. 
Mar_11.m GoldenSearch.m 
Mar 21 
Complex Numbers; Waves and Interference 
Mar_21.m 
Mar 23 
Huygens Principle; Simulating Diffraction 
Mar_23.m 
Mar 25 
Overloading operators; Intro to Discrete Fourier Transforms 
Mar_25.m Words.m NDigits.m 
Mar 28 
Fourier Transforms 
Mar_28.m 
Mar 30 
Fraunhofer Diffraction and the 2D Fourier Transform 
Mar_30.m Mar_30.html 
Apr 1 
QUIZ 3 

Apr 4 
Solving the Heat/Diffusion Equation with Fourier Series 
Apr_4.m Apr_4.html 
Apr 6 
Particle Wave Packets 
Apr_6.m Apr_6.html 
Apr 8 
Convolutions 
Apr_8.m Apr_8.html 
Apr 11 
Ising Model 
Apr_11.m Apr_11.html 
Apr 13 
Least Squares Fitting 
Apr_13.m 
Apr 15 
Creating and using a Graphical User Interface (GUI) 
Apr_15.m FirstOrderPoly.m 
Apr 18 
Intro to Maximum Likelihood Estimation 
OrdinaryLeastSquares.pdf 
Apr 20 
QUIZ 4 

Apr 22 
Intro to Bayesian Inference; MarkovChain MonteCarlo 
Apr_22.m 
Apr 25 
Parameter Estimation Example: Finding the mean of a Poisson Distributed Data 
Apr_25.m PoissLambdaLogL.m 
Apr 27 
Parameter Estimation Example: Single Molecule Localization 
Apr_27.m 
Apr 29 
Latex 
Some resources: Latex290Example.zip Wikibooks: Latex miktex.org/ winedt.com/ overleaf.com/ 
May 2 
Python 
Some resources: Anaconda: Python with Scientific Modules (and more) The Python Tutorial matplotlib numpy scipy Some codes: PythonFunctions.py PythonArraysPlots.py PythonForLoop.py 
May 4 
Final Project Presentations 

May 6 
QUIZ 5 
Quiz5Solutions.pdf 
Reference Material
A reference text recommended by a student in our class: MATLAB for EngineersInstalling MATLAB
Create an account at mathworks.com using your UNM email address.Download and install MATLAB 2014b or later. We will not need or use most toolboxes. If you want to save download time and disk space, just install MATLAB and these toolboxes:
Statistics
Symbolic Math Toolbox
Others I find useful, but we will probably not use in class are:
Image Processing Toolbox
Optimization Toolbox
Parallel Computing Toolbox
Signal Processing Toolbox
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.
MATLAB Examples
Other
MATLAB documentationMIT OCW MATLAB course
Interview with Cleve Moler, creator of MATLAB
Numerical Recipes
http://www.cplusplus.com
http://www.cprogramming.com "