problemset4

# 1111 00994 00886 00783 00685 00590 00495 00398 00291

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 0.1521 0.1307 0.1103 0.0902 0.0698 0.0479 0.0244 r=7 0.1250 0.1103 0.0968 0.0841 0.0719 0.0600 0.0479 0.0348 0.0187 9 r=8 0.0588 0.0523 0.0462 0.0406 0.0351 0.0298 0.0244 0.0187 0.0120 Table 5: Computed probabilities for the three-person ballot problem for p = 9. q q q q q q q q q q =0 =1 =2 =3 =4 =5 =6 =7 =8 =9 r=0 1.0000 0.8182 0.6667 0.5387 0.4294 0.3334 0.2500 0.1764 0.1111 0.0526 r=1 0.8182 0.6818 0.5643 0.4625 0.3715 0.2916 0.2206 0.1569 0.0994 0.0474 r=2 0.6667 0.5643 0.4746 0.3926 0.3196 0.2535 0.1935 0.1388 0.0886 0.0425 r=3 0.5387 0.4625 0.3926 0.3297 0.2718 0.2182 0.1683 0.1217 0.0783 0.0378 r=4 0.4294 0.3715 0.3196 0.2718 0.2271 0.1848 0.1442 0.1055 0.0685 0.0334 r=5 0.3334 0.2916 0.2535 0.2182 0.1848 0.1525 0.1208 0.0897 0.0590 0.0291 r=6 0.2500 0.2206 0.1935 0.1683 0.1442 0.1208 0.0976 0.0739 0.0495 0.0248 r=7 0.1764 0.1569 0.1388 0.1217 0.1055 0.0897 0.0739 0.0576 0.0398 0.0205 r=8 0.1111 0.0994 0.0886 0.0783 0.0685 0.0590 0.0495 0.0398 0.0291 0.0158 r=9 0.0526 0.0474 0.0425 0.0378 0.0334 0.0291 0.0248 0.0205 0.0158 0.0101 Table 6: Computed probabilities for the three-person ballot problem for p = 10. d=atof(argv[2]); int i,j,c,a[n+1]; for(i=0;i<=n;i++) a[i]=0; for(j=0;j<w;j++) a[cauchy()]++; for(i=0;i<=n;i++) { cout << i << " " << a[i] << " " << double(a[i])/w << endl; } } B C++/GSL code for simulating the Cauchy ﬁrst passage prob­ lem This code performs the same task as that in appendix A but makes use of random number gen­ erating routines in the GNU Scientiﬁc Library[1] (GSL), which provide much better sources of randomness. The code accepts a single command line argument for the drift. The environment variable GSL_RNG_TYPE chooses the random number routine to use (in this case, set to mrg), and the environment variable GSL_RNG_SEED chooses a random seed. #include <string> #include <iostream> #include <cstdio> #include <cmath> #include <gsl/gsl rng.h> using namespace std; M. Z. Bazant – 18.366 Random Walk...
View Full Document

## This note was uploaded on 01/23/2014 for the course MATH 18.366 taught by Professor Martinbazant during the Fall '06 term at MIT.

Ask a homework question - tutors are online