|
18 | 18 | "outputs": [],
|
19 | 19 | "prompt_number": 1
|
20 | 20 | },
|
21 |
| - { |
22 |
| - "cell_type": "code", |
23 |
| - "collapsed": false, |
24 |
| - "input": [ |
25 |
| - "from IPython.core.display import HTML\n", |
26 |
| - "def css_styling():\n", |
27 |
| - " styles = open(\"styles/custom.css\", \"r\").read()\n", |
28 |
| - " return HTML(styles)\n", |
29 |
| - "css_styling()" |
30 |
| - ], |
31 |
| - "language": "python", |
32 |
| - "metadata": {}, |
33 |
| - "outputs": [ |
34 |
| - { |
35 |
| - "html": [ |
36 |
| - "<style>\n", |
37 |
| - " @font-face {\n", |
38 |
| - " font-family: \"Computer Modern\";\n", |
39 |
| - " src: url('http://mirrors.ctan.org/fonts/cm-unicode/fonts/otf/cmunss.otf');\n", |
40 |
| - " }\n", |
41 |
| - " div.cell{\n", |
42 |
| - " width:800px;\n", |
43 |
| - " margin-left:16% !important;\n", |
44 |
| - " margin-right:auto;\n", |
45 |
| - " }\n", |
46 |
| - " h1 {\n", |
47 |
| - " font-family: Helvetica, serif;\n", |
48 |
| - " }\n", |
49 |
| - " h4{\n", |
50 |
| - " margin-top:12px;\n", |
51 |
| - " margin-bottom: 3px;\n", |
52 |
| - " }\n", |
53 |
| - " div.text_cell_render{\n", |
54 |
| - " font-family: Cambria,Computer Modern, \"Helvetica Neue\", Arial, Helvetica, Geneva, sans-serif;\n", |
55 |
| - " line-height: 145%;\n", |
56 |
| - " font-size: 130%;\n", |
57 |
| - " width:800px;\n", |
58 |
| - " margin-left:auto;\n", |
59 |
| - " margin-right:auto;\n", |
60 |
| - " }\n", |
61 |
| - " .CodeMirror{\n", |
62 |
| - " font-family:\"Aurulent Sans Mono\",\"Source Code Pro\", source-code-pro,Consolas, monospace;\n", |
63 |
| - " }\n", |
64 |
| - " .prompt{\n", |
65 |
| - " display: None;\n", |
66 |
| - " }\n", |
67 |
| - " .text_cell_render h5 {\n", |
68 |
| - " font-weight: 300;\n", |
69 |
| - " font-size: 16pt;\n", |
70 |
| - " color: #4057A1;\n", |
71 |
| - " font-style: italic;\n", |
72 |
| - " margin-bottom: .5em;\n", |
73 |
| - " margin-top: 0.5em;\n", |
74 |
| - " display: block;\n", |
75 |
| - " }\n", |
76 |
| - " \n", |
77 |
| - " .warning{\n", |
78 |
| - " color: rgb( 240, 20, 20 )\n", |
79 |
| - " } \n", |
80 |
| - "\n", |
81 |
| - " BODY {background-color:#FBF5E6}\n", |
82 |
| - "\n", |
83 |
| - "</style>\n", |
84 |
| - "<script>\n", |
85 |
| - " MathJax.Hub.Config({\n", |
86 |
| - " TeX: {\n", |
87 |
| - " extensions: [\"AMSmath.js\"]\n", |
88 |
| - " },\n", |
89 |
| - " tex2jax: {\n", |
90 |
| - " inlineMath: [ ['$','$'], [\"\\\\(\",\"\\\\)\"] ],\n", |
91 |
| - " displayMath: [ ['$$','$$'], [\"\\\\[\",\"\\\\]\"] ]\n", |
92 |
| - " },\n", |
93 |
| - " displayAlign: 'center', // Change this to 'center' to center equations.\n", |
94 |
| - " \"HTML-CSS\": {\n", |
95 |
| - " styles: {'.MathJax_Display': {\"margin\": 4}}\n", |
96 |
| - " }\n", |
97 |
| - " });\n", |
98 |
| - "</script>\n" |
99 |
| - ], |
100 |
| - "metadata": {}, |
101 |
| - "output_type": "pyout", |
102 |
| - "prompt_number": 2, |
103 |
| - "text": [ |
104 |
| - "<IPython.core.display.HTML at 0x62b0fb0>" |
105 |
| - ] |
106 |
| - } |
107 |
| - ], |
108 |
| - "prompt_number": 2 |
109 |
| - }, |
110 |
| - { |
111 |
| - "cell_type": "code", |
112 |
| - "collapsed": false, |
113 |
| - "input": [ |
114 |
| - "import json\n", |
115 |
| - "s = json.load( open(\"styles/bmh_matplotlibrc.json\") )\n", |
116 |
| - "matplotlib.rcParams.update(s)" |
117 |
| - ], |
118 |
| - "language": "python", |
119 |
| - "metadata": {}, |
120 |
| - "outputs": [], |
121 |
| - "prompt_number": 3 |
122 |
| - }, |
123 |
| - { |
124 |
| - "cell_type": "code", |
125 |
| - "collapsed": false, |
126 |
| - "input": [ |
127 |
| - "%qtconsole" |
128 |
| - ], |
129 |
| - "language": "python", |
130 |
| - "metadata": {}, |
131 |
| - "outputs": [], |
132 |
| - "prompt_number": 4 |
133 |
| - }, |
134 | 21 | {
|
135 | 22 | "cell_type": "heading",
|
136 | 23 | "level": 2,
|
|
747 | 634 | "source": [
|
748 | 635 | "In this section, we investigated how to generate random samples from a given distribution, beit discrete or continuous. For the continuouse case, the key issue was whether or not the cumulative density function had a continuous inverse. If not, we had to turn to the rejection method, and find an appropriate related density that we could easily sample from to use as part of a rejection threshold. Finding such a function is an art, but many families of probability densities have been studied over the years that already have fast sample-generators.\n",
|
749 | 636 | "\n",
|
750 |
| - "It is possible to go much deeper with the rejection method, but these involve careful partitioning of the domains and lots of special methoods for separate domains and corner cases. Nonetheless, all of these advanced techniques are still variations on the same fundamental theme we illustrated here." |
| 637 | + "It is possible to go much deeper with the rejection method, but these involve careful partitioning of the domains and lots of special methods for separate domains and corner cases. Nonetheless, all of these advanced techniques are still variations on the same fundamental theme we illustrated here." |
751 | 638 | ]
|
752 | 639 | },
|
753 | 640 | {
|
|
764 | 651 | "source": [
|
765 | 652 | "[Exploring Monte Carlo Methods by Dunn, 2011](http://books.google.com/books?id=ACTrrQk1UgoC&dq=Exploring+Monte+Carlo+Methods&source=gbs_navlinks_s)\n",
|
766 | 653 | "\n",
|
767 |
| - "[Continuous univariate distributions by Balakrishnan, 1995](http://books.google.com/books?id=0QzvAAAAMAAJ&dq=continuous+balakrishnan&hl=en&sa=X&ei=vzcuUtqvOYOKjAKr14BI&ved=0CC8Q6AEwAA)" |
| 654 | + "[Continuous univariate distributions by Balakrishnan, 1995](http://books.google.com/books?id=0QzvAAAAMAAJ&dq=continuous+balakrishnan&hl=en&sa=X&ei=vzcuUtqvOYOKjAKr14BI&ved=0CC8Q6AEwAA)\n", |
| 655 | + "\n", |
| 656 | + "[IPython Source Notebook](https://github.com/unpingco/Pig-in-the-Python/blob/master/Sampling_Monte_Carlo.ipynb)" |
768 | 657 | ]
|
769 | 658 | }
|
770 | 659 | ],
|
|
0 commit comments