-- Draw pdf and cdf for muon pair production N = 12 -- number of bins pi = float(pi) -- use numerical value of pi F = -1/8 cos(theta)^3 - 3/8 cos(theta) + 1/2 f = d(F,theta) "Probability density function" xrange = (0,pi) yrange = (0,1) draw(f,theta) "Cumulative distribution function" xrange = (0,pi) yrange = (0,1) draw(F,theta) "Bin probability" P = zero(N) for(k,1,N, P[k] = eval(F,theta,k pi/N) - eval(F,theta,(k-1) pi/N)) h(x) = test(x <= 0, 0, x > N, 0, P[ceiling(x)]) xrange = (0,N) yrange = (0,1) draw(h,x)
Run