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: Hanieh Farsibaf
email: hmfarsibaf@unm.eduOffice Hours
Prof. Lidke: Each day after class or by appointment.Hanieh: Thursday 11:3012:30 in lobby of Physics (Lomas & Yale) 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.
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 at 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%)
Each Friday class will start with a short ~10 point quiz. Lowest scoring quiz of the semester will be dropped. No makeup quizzes will be offered.Final Exam (10%)
Home Work Assignments
Lecture Notes
Date  Skills and Concepts Discussed  MATLAB Lecture Notes 

12Jan 
Working in the Command Window and Editor; 'for' and 'while' loops; Using 'help' and 'doc'; Basic data types. 
Jan_12.m 
14Jan 
Arrays and Matrices; Plotting; Functions. Additional Material: Printing text to Command Window (fprintf); Conditional Statements; 
Jan_14.m AddVars.m 
16Jan 
Structures; Intro to Object Oriented Programming 
Jan_16.m CheckPrime.m LaserData 
21Jan 
Creating a class definition; Creating and using objects. 
Jan_21.m LaserData2.m 
23Jan 
Practice creating a class definition and using objects; Short intro to numerical integration. 
Jan_23.m CalcPrimes.m 
26Jan 
Matrix versus Elementwise operations; Numerical integration; Anonymous functions. 
Jan_26.m NIntegrate.m 
28Jan 
SwitchCase conditional; Class constructor and destructor; Creating video files; Mass on a spring visualization. 
Jan_28.m ConTest.m Mass on spring math 
30Jan 
Solving first order ODEs using the Euler method 
Jan_30.m 
2Feb 
Solving second order ODEs using the Euler method 
Feb_2.m 
4Feb 
Saving and loading files; Solving second order ODEs using THE RungeKutta method 
Feb_4.m 
6Feb 
General Q&A. Practice with classes. 
Feb_6.m SimpleClass.m 
9Feb 
Rutherford Scattering 
Feb_9.m CentralPotential.m ODESolver.m 
11Feb 
Kepler Orbits 
Feb_11.m Planet.m 
13Feb 
Error handling; Some simple linear algebra. 
Feb_13.m mycross.m 
16Feb 
Root finding and minimization: Newton's method. 

18Feb 
Root finding and minimization: Newton's method continued. 
Feb_18.m NewtonSolver.m 
20Feb 
MATLAB's 'Publish' functionality; Root finding and minimization: Secant method. 

23Feb 
Intro to random numbers; Finding a function minimum on an interval. 
Feb_23.m MinFinder290.m 
25Feb 
Finding a function minimum using the Golden Section Search method. 
Feb_25.m updateGRInterval.m 
27Feb 
Snow Day! 

2March 
More about Golden Section Search; Rutherford scattering revisited. 

4March 
Central Limit Theorem; Random Walks 
March_4.m 
6March 
Multidimensional Function minimization using 'fminsearch' 
March_6m 
16March 
Logic with vectors; Finding pi with random numbers 
March_16m 
18March 
Statistics of constant rate processes; Waiting time distribution 
See March_20 
20March 
Statistics of constant rate processes; Poisson Distribution; Intro to parameter estimation 
March_20.m 
23March 
Parameter estimation from noisy data 
March_23.m firstOPoly_Poiss.m firstOPoly_Norm.m 
25March 
Uncertainty of Parameter Estimates I 
March_25.m firstOPoly_Norm.m 
27March 
The Monte Hall Problem; Intro to Bayes' Rule. 
A student simulation from class 
30March 
Uncertainty of Parameter Estimates II 
March_30.m PoissLambdaLogL.m 
3April 
Markov Chain MonteCarlo (MCMC); Intro to programmatic GUI 
April_3.m simplegui.m 
6April 
Using a GUI from a class 
April_6.m FirstOrderPoly.m 
8April 
The Symbolic math toolbox 
April_8.m 
10April 
Complex numbers and waves 
April_10.m 
13April 
Interference and Diffraction (Continued from April 10) 
April_13.m 
15April 
Intro to Fourier Transforms 
April_15.m 
17April 
More Fourier Transforms 
April_17.m 
20April 
1D Ising Model 
April_20.m 
22April 
2D Ising Model 
April_22.m 
24April 
2D Ising Model continued; correlation length; Polymer models 
April_24.m WLCvsF.m GenTestVector.m 
27April 
The inversion method; Selecting a vector with random orientation in 3D; Class Inheritance 
April_27.m TestClassA.m TestClassAB.m TestClassC.m TestClassACB.m 
29April 
Correlation length and radial averaging 
April_29.m 
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 "