Physics 2033 Relativity and Quantum Lab

University of Minnesota Duluth, Spring 2017

Some helpful things you might download and use.

The main lab handout webpage

Click here for the main lab handoug webpage

Dr. Gran's sample lab report

Here is a SampleLabReport.pdf

Our version of the atomic spectroscopy lab handout

Here is the atomic_spectroscopy.pdf handout

numerical tool exampls and comments


A spreadsheet, any spreadsheet (Excel, LibreOffice, Sheets) is an essential but limited tool. Its great for organizing and saving data and simple tests on it. You can save the data as a .csv file to be read in with a more sophisticated program to plot or further process it. And its best at repetitive calculations, because you have several very similar sets of data, or because you make a mistake and need to redo it starting from just one part. Here is a spreadsheet (.xls) that has examples of Binomial, Poisson, and Gaussian to match our activity with dice on day one.

Works for most spreadsheets software BinomialPoissonGaussian.xlsx

Gaussians (and Poissons) from first lab

For Matlab gausstest.m

For python

For ROOT/C++ gausstest.C

Can right-click or something to download, if you prefer not to copy and paste.

If you want ocatve and R versions, let me know. Haven't made them yet.

FAQ on chosing the right software environment:

  • FAQ: I've not taken a programming class yet, is there some reason to pick one over the other here? Answer: No worries about programming, we'll start easy. But yes ! Well, you used Matlab in a previous course, so thats a start. Is that enough, or should I say more? Ok, the world is a big place. Different programming environments are popular for different folks. However, learning the basics of programming (algorithms, structures, conditionals, numeric precision) in one language will give you the basics in all, even if the syntax is different. Its like learning learning one spoken language and realizing that you can quickly pick up a second (spanish then french, or german then dutch), because you learned how programming works.

  • FAQ: You didn't really answer the question, you shilled for Matlab and then said different programming environments are popular with different folks? Answer: Hmm. What kinds of jobs/fields use each language, and should that affect which one I should pick? Python has grown to be an extremely popular programming language when the numpy and scipy packages are available. The environment R (and the non-free Splus and SAS) came out of people who do hard-core statistics things, and is now quite popular among the machine learning and data science crowd. Matlab (and to a lesser extent the open-source Octave) is very popular among scientists in general, including physics. ROOT is particle physics centric routines, but is fundamentally C++ which itself is a lot like Java, and both C++ and Java are widely popular. You can do some search engine work to learn more. In fact, particle-physics types rarely use Matlab, personally, so I learned enough to help others use it, and am at the limits of my knowledge with it.

  • FAQ: mostly, I'm unpopular. Can I get a version of the fitting code for (X) environment (where X is an unpopular environment) ? Answer: No. Isn't being a physicist enough unpopularity for you? You should translate the algorithm from one of these popular environments to your cold, lonely little world. Or write yours from scratch. They only take about 200 lines, not counting graphing.

  • FAQ: oh, I want to be popular, but how do I get started ! Answer: Drat. I've not given instructions for where to access these software packages on UMD computers or how to download them for your own computers. Most of you know Matlab from a previous course. And python is relatively easy to get, you may already have access to it somewhere, somehow. Probably I should add more. I've managed to install almost all of them on my laptop and on a linux workstation. Your mileage may vary.

  • FAQ: Okay, they are all viable programming languages, but do they give the same answer? Answer: Hmm. Yes ! I mean No! They sometimes have slightly different conventions, and rarely assume a physicist is using it. The fit code is one such example, see comments there.

  • FAQ: seriously, you're not simply going to tell me which one to use ? Answer: No. Its worse than that, I use three or four different ones on a weekly basis when I'm doing analysis work. You're welcome!

    Linear fits for most other lab

    For Matlab runtestfit.m

    For octave runtestfitO.m

    For python

    For R runtestfit.R

    For ROOT/C++ runtestfit.C

    Three of the four statistics environments (the ones builtin to Matlab, R, python) give the a statistics-person type error for weighted data, but we want the physics-person error for weighted data. So the code works around this issue to give the kind of physics uncertainty value we expected. We are going to learn about this issue in the course.

    The Matlab version requires the Curve Fitting Toolbox. On computers installed within the department and labs around campus, that is included. If you purchased your own verison of Matlab, you might have to pay extra for it.