1  1 
new file mode 100644 
...  ... 
@@ 0,0 +1,17 @@ 
1 
+Michael Klauser Exercise 7.1 

2 
+ 

3 
+We suppose 7 blue and pink balls, each of them uniquely so that we can distinguish them. 

4 
+We only need to calculate how often we get k successes in n trials 

5 
+We can now draw n! samples of balls. 

6 
+This sample can contain the same balls but different ordered. 

7 
+Because, we have n choices for the first n1 for the second and so on. 

8 
+General n! 

9 
+ 

10 
+but now we only want to distinguish between blue and pink balls 

11 
+for k blue balls, we again have k! possibilities to bring them in order 

12 
+similarly, for the remaining nk balls. So we have (nk)! possibilities. 

13 
+Now we only count the number of blue and pink balls. (we don't care about the order) 

14 
+ 

15 
+ Now we can divide the overallnumber of possibilities n! by the number of possibilities for the blue balls k! and by the number of possibilities for pink balls (nk)!. We remember that all events are statistically independent, this yields: 

16 
+ 

17 
+ binomial coefficient = n! / (k! (nk)!) 
...  ... 
@@ 195,7 +195,7 @@ err_lin_m = err_lin_m[1] 
195  195 

196  196 

197  197 

198 
# The integration via fit is computationally expensive compared to the simple numerical integration 

198 
+# The integration via fit (spinefun) is computationally expensive compared to the simple numerical integration by summing up. 

199  199 

200  200 

201  201 
strqua = paste("quadratic: ax^2 + mx +b with a=",round(best_a_qua,2),"+",round(err_qua_a,2),",\n m=", round(best_m_qua,2),"+",round(err_qua_m,2),", b=",round(best_b_qua,2),"+",round(err_qua_b,2)) 
...  ... 
@@ 206,7 +206,7 @@ text(0,2.8,strqua) 
206  206 
text(0,2.1,strlin) 
207  207 
text(0,1.6,strcon) 
208  208 

209 
#Plot errorbars quad 

209 
+#Plot errorbars quad. Here i'm not sure how to plot the error bars so I plot them like done below. An explanation about how to plot error bar in the tutorial would be nice. 

210  210 
for( x in (x_vec_2)){ 
211  211 

212  212 
tmperrup = quarel(x,best_a_qua,best_m_qua,best_b_qua) + (err_qua_a*x**2+x*err_qua_m+err_qua_b) 