Example exam
An example of a Python / data-analysis exam.
Task 1¶
In this task you will show that you understand the basics of Python.
Make an array “x_raw” running from 0 to 100 (including both 0 and 100) with an interval where all elements are integers (so [0,1,2,3...100]). (1pt)
Now use x_raw to make a new array “x_even” which consists of all even numbers in the array “x_raw”. (1pt)
Define a function that returns . Use it to make an array _. (1pt)
Now, replace by 2500. Note, counting to the index corresponding to by hand is not allowed! (1pt)
We now have a distorted dataset.
Use curve fitting to find the best value of and the uncertainty in . Present the two values as an experimental physicist would do. (3pt)
Make a test array from 0 to 100 with an interval of 0.1 and use this test array to graph the function fit into the data. Show the function fit as a dotted red line. (3pt)
# Your codeTask 2¶
A physical quantity has been measured in order to calculate a different physical quantity . The value of is 1.075 ± 0.003.
Calculate the physical quantity and its uncertainty using the calculus approach for:
(3pt)
and the functional approach for:
(3pt)
(Disregard the unit(s))
# Your codeTask 3¶
In your final project you received a dataset stored in ‘data.csv’. You are asked to (1) investigate the pattern in the data, (2) define a function that probably fits that pattern, (3) use curve fitting to present the values of the parameters and their uncertainties, (4) plot the fit on the data and study the residuals: investigate whether this these are random noise that can be described using a Gaussian distribution and if so, what the standard deviation is of that noise.
First load the ‘data.csv’ file (data.csv). Then carry out this data-analysis. (9pt)
# Your code