Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
mhjensen committed Mar 14, 2024
1 parent 8271d88 commit efa4f16
Show file tree
Hide file tree
Showing 518 changed files with 24,141 additions and 195,860 deletions.
263 changes: 134 additions & 129 deletions doc/pub/week9/html/._week9-bs000.html

Large diffs are not rendered by default.

263 changes: 134 additions & 129 deletions doc/pub/week9/html/._week9-bs001.html

Large diffs are not rendered by default.

263 changes: 134 additions & 129 deletions doc/pub/week9/html/._week9-bs002.html

Large diffs are not rendered by default.

263 changes: 134 additions & 129 deletions doc/pub/week9/html/._week9-bs003.html

Large diffs are not rendered by default.

263 changes: 134 additions & 129 deletions doc/pub/week9/html/._week9-bs004.html

Large diffs are not rendered by default.

263 changes: 134 additions & 129 deletions doc/pub/week9/html/._week9-bs005.html

Large diffs are not rendered by default.

263 changes: 134 additions & 129 deletions doc/pub/week9/html/._week9-bs006.html

Large diffs are not rendered by default.

263 changes: 134 additions & 129 deletions doc/pub/week9/html/._week9-bs007.html

Large diffs are not rendered by default.

263 changes: 134 additions & 129 deletions doc/pub/week9/html/._week9-bs008.html

Large diffs are not rendered by default.

263 changes: 134 additions & 129 deletions doc/pub/week9/html/._week9-bs009.html

Large diffs are not rendered by default.

263 changes: 134 additions & 129 deletions doc/pub/week9/html/._week9-bs010.html

Large diffs are not rendered by default.

263 changes: 134 additions & 129 deletions doc/pub/week9/html/._week9-bs011.html

Large diffs are not rendered by default.

270 changes: 139 additions & 131 deletions doc/pub/week9/html/._week9-bs012.html

Large diffs are not rendered by default.

342 changes: 199 additions & 143 deletions doc/pub/week9/html/._week9-bs013.html

Large diffs are not rendered by default.

283 changes: 149 additions & 134 deletions doc/pub/week9/html/._week9-bs014.html

Large diffs are not rendered by default.

286 changes: 140 additions & 146 deletions doc/pub/week9/html/._week9-bs015.html

Large diffs are not rendered by default.

294 changes: 150 additions & 144 deletions doc/pub/week9/html/._week9-bs016.html

Large diffs are not rendered by default.

293 changes: 147 additions & 146 deletions doc/pub/week9/html/._week9-bs017.html

Large diffs are not rendered by default.

292 changes: 150 additions & 142 deletions doc/pub/week9/html/._week9-bs018.html

Large diffs are not rendered by default.

283 changes: 144 additions & 139 deletions doc/pub/week9/html/._week9-bs019.html

Large diffs are not rendered by default.

289 changes: 150 additions & 139 deletions doc/pub/week9/html/._week9-bs020.html

Large diffs are not rendered by default.

510 changes: 144 additions & 366 deletions doc/pub/week9/html/._week9-bs021.html

Large diffs are not rendered by default.

522 changes: 341 additions & 181 deletions doc/pub/week9/html/._week9-bs022.html

Large diffs are not rendered by default.

359 changes: 219 additions & 140 deletions doc/pub/week9/html/._week9-bs023.html

Large diffs are not rendered by default.

339 changes: 145 additions & 194 deletions doc/pub/week9/html/._week9-bs024.html

Large diffs are not rendered by default.

307 changes: 170 additions & 137 deletions doc/pub/week9/html/._week9-bs025.html

Large diffs are not rendered by default.

305 changes: 142 additions & 163 deletions doc/pub/week9/html/._week9-bs026.html

Large diffs are not rendered by default.

301 changes: 162 additions & 139 deletions doc/pub/week9/html/._week9-bs027.html

Large diffs are not rendered by default.

314 changes: 146 additions & 168 deletions doc/pub/week9/html/._week9-bs028.html

Large diffs are not rendered by default.

332 changes: 197 additions & 135 deletions doc/pub/week9/html/._week9-bs029.html

Large diffs are not rendered by default.

275 changes: 141 additions & 134 deletions doc/pub/week9/html/._week9-bs030.html

Large diffs are not rendered by default.

274 changes: 139 additions & 135 deletions doc/pub/week9/html/._week9-bs031.html

Large diffs are not rendered by default.

273 changes: 140 additions & 133 deletions doc/pub/week9/html/._week9-bs032.html

Large diffs are not rendered by default.

270 changes: 137 additions & 133 deletions doc/pub/week9/html/._week9-bs033.html

Large diffs are not rendered by default.

309 changes: 143 additions & 166 deletions doc/pub/week9/html/._week9-bs034.html

Large diffs are not rendered by default.

318 changes: 171 additions & 147 deletions doc/pub/week9/html/._week9-bs035.html

Large diffs are not rendered by default.

312 changes: 153 additions & 159 deletions doc/pub/week9/html/._week9-bs036.html

Large diffs are not rendered by default.

280 changes: 142 additions & 138 deletions doc/pub/week9/html/._week9-bs037.html

Large diffs are not rendered by default.

283 changes: 144 additions & 139 deletions doc/pub/week9/html/._week9-bs038.html

Large diffs are not rendered by default.

305 changes: 168 additions & 137 deletions doc/pub/week9/html/._week9-bs039.html

Large diffs are not rendered by default.

345 changes: 143 additions & 202 deletions doc/pub/week9/html/._week9-bs040.html

Large diffs are not rendered by default.

398 changes: 183 additions & 215 deletions doc/pub/week9/html/._week9-bs041.html

Large diffs are not rendered by default.

290 changes: 153 additions & 137 deletions doc/pub/week9/html/._week9-bs042.html

Large diffs are not rendered by default.

345 changes: 208 additions & 137 deletions doc/pub/week9/html/._week9-bs043.html

Large diffs are not rendered by default.

275 changes: 139 additions & 136 deletions doc/pub/week9/html/._week9-bs044.html

Large diffs are not rendered by default.

282 changes: 141 additions & 141 deletions doc/pub/week9/html/._week9-bs045.html

Large diffs are not rendered by default.

284 changes: 148 additions & 136 deletions doc/pub/week9/html/._week9-bs046.html

Large diffs are not rendered by default.

276 changes: 140 additions & 136 deletions doc/pub/week9/html/._week9-bs047.html

Large diffs are not rendered by default.

304 changes: 141 additions & 163 deletions doc/pub/week9/html/._week9-bs048.html

Large diffs are not rendered by default.

302 changes: 166 additions & 136 deletions doc/pub/week9/html/._week9-bs049.html

Large diffs are not rendered by default.

281 changes: 144 additions & 137 deletions doc/pub/week9/html/._week9-bs050.html

Large diffs are not rendered by default.

312 changes: 166 additions & 146 deletions doc/pub/week9/html/._week9-bs051.html

Large diffs are not rendered by default.

283 changes: 147 additions & 136 deletions doc/pub/week9/html/._week9-bs052.html

Large diffs are not rendered by default.

304 changes: 144 additions & 160 deletions doc/pub/week9/html/._week9-bs053.html

Large diffs are not rendered by default.

304 changes: 167 additions & 137 deletions doc/pub/week9/html/._week9-bs054.html

Large diffs are not rendered by default.

278 changes: 140 additions & 138 deletions doc/pub/week9/html/._week9-bs055.html

Large diffs are not rendered by default.

276 changes: 142 additions & 134 deletions doc/pub/week9/html/._week9-bs056.html

Large diffs are not rendered by default.

280 changes: 140 additions & 140 deletions doc/pub/week9/html/._week9-bs057.html

Large diffs are not rendered by default.

279 changes: 145 additions & 134 deletions doc/pub/week9/html/._week9-bs058.html

Large diffs are not rendered by default.

300 changes: 141 additions & 159 deletions doc/pub/week9/html/._week9-bs059.html

Large diffs are not rendered by default.

294 changes: 142 additions & 152 deletions doc/pub/week9/html/._week9-bs060.html

Large diffs are not rendered by default.

300 changes: 164 additions & 136 deletions doc/pub/week9/html/._week9-bs061.html

Large diffs are not rendered by default.

325 changes: 147 additions & 178 deletions doc/pub/week9/html/._week9-bs062.html

Large diffs are not rendered by default.

347 changes: 169 additions & 178 deletions doc/pub/week9/html/._week9-bs063.html

Large diffs are not rendered by default.

308 changes: 147 additions & 161 deletions doc/pub/week9/html/._week9-bs064.html

Large diffs are not rendered by default.

361 changes: 221 additions & 140 deletions doc/pub/week9/html/._week9-bs065.html

Large diffs are not rendered by default.

278 changes: 140 additions & 138 deletions doc/pub/week9/html/._week9-bs066.html

Large diffs are not rendered by default.

277 changes: 142 additions & 135 deletions doc/pub/week9/html/._week9-bs067.html

Large diffs are not rendered by default.

278 changes: 141 additions & 137 deletions doc/pub/week9/html/._week9-bs068.html

Large diffs are not rendered by default.

279 changes: 141 additions & 138 deletions doc/pub/week9/html/._week9-bs069.html

Large diffs are not rendered by default.

296 changes: 144 additions & 152 deletions doc/pub/week9/html/._week9-bs070.html

Large diffs are not rendered by default.

293 changes: 157 additions & 136 deletions doc/pub/week9/html/._week9-bs071.html

Large diffs are not rendered by default.

278 changes: 142 additions & 136 deletions doc/pub/week9/html/._week9-bs072.html

Large diffs are not rendered by default.

276 changes: 139 additions & 137 deletions doc/pub/week9/html/._week9-bs073.html

Large diffs are not rendered by default.

274 changes: 142 additions & 132 deletions doc/pub/week9/html/._week9-bs074.html

Large diffs are not rendered by default.

270 changes: 138 additions & 132 deletions doc/pub/week9/html/._week9-bs075.html

Large diffs are not rendered by default.

296 changes: 137 additions & 159 deletions doc/pub/week9/html/._week9-bs076.html

Large diffs are not rendered by default.

302 changes: 142 additions & 160 deletions doc/pub/week9/html/._week9-bs077.html

Large diffs are not rendered by default.

307 changes: 145 additions & 162 deletions doc/pub/week9/html/._week9-bs078.html

Large diffs are not rendered by default.

342 changes: 210 additions & 132 deletions doc/pub/week9/html/._week9-bs079.html

Large diffs are not rendered by default.

279 changes: 138 additions & 141 deletions doc/pub/week9/html/._week9-bs080.html

Large diffs are not rendered by default.

324 changes: 143 additions & 181 deletions doc/pub/week9/html/._week9-bs081.html

Large diffs are not rendered by default.

325 changes: 185 additions & 140 deletions doc/pub/week9/html/._week9-bs082.html

Large diffs are not rendered by default.

325 changes: 146 additions & 179 deletions doc/pub/week9/html/._week9-bs083.html

Large diffs are not rendered by default.

305 changes: 165 additions & 140 deletions doc/pub/week9/html/._week9-bs084.html

Large diffs are not rendered by default.

301 changes: 164 additions & 137 deletions doc/pub/week9/html/._week9-bs085.html

Large diffs are not rendered by default.

310 changes: 144 additions & 166 deletions doc/pub/week9/html/._week9-bs086.html

Large diffs are not rendered by default.

294 changes: 152 additions & 142 deletions doc/pub/week9/html/._week9-bs087.html

Large diffs are not rendered by default.

301 changes: 166 additions & 135 deletions doc/pub/week9/html/._week9-bs088.html

Large diffs are not rendered by default.

303 changes: 140 additions & 163 deletions doc/pub/week9/html/._week9-bs089.html

Large diffs are not rendered by default.

308 changes: 169 additions & 139 deletions doc/pub/week9/html/._week9-bs090.html

Large diffs are not rendered by default.

311 changes: 144 additions & 167 deletions doc/pub/week9/html/._week9-bs091.html

Large diffs are not rendered by default.

298 changes: 151 additions & 147 deletions doc/pub/week9/html/._week9-bs092.html

Large diffs are not rendered by default.

291 changes: 146 additions & 145 deletions doc/pub/week9/html/._week9-bs093.html

Large diffs are not rendered by default.

313 changes: 175 additions & 138 deletions doc/pub/week9/html/._week9-bs094.html

Large diffs are not rendered by default.

309 changes: 143 additions & 166 deletions doc/pub/week9/html/._week9-bs095.html

Large diffs are not rendered by default.

295 changes: 151 additions & 144 deletions doc/pub/week9/html/._week9-bs096.html

Large diffs are not rendered by default.

295 changes: 149 additions & 146 deletions doc/pub/week9/html/._week9-bs097.html

Large diffs are not rendered by default.

295 changes: 151 additions & 144 deletions doc/pub/week9/html/._week9-bs098.html

Large diffs are not rendered by default.

288 changes: 149 additions & 139 deletions doc/pub/week9/html/._week9-bs099.html

Large diffs are not rendered by default.

283 changes: 144 additions & 139 deletions doc/pub/week9/html/._week9-bs100.html

Large diffs are not rendered by default.

289 changes: 143 additions & 146 deletions doc/pub/week9/html/._week9-bs101.html

Large diffs are not rendered by default.

735 changes: 151 additions & 584 deletions doc/pub/week9/html/._week9-bs102.html

Large diffs are not rendered by default.

759 changes: 612 additions & 147 deletions doc/pub/week9/html/._week9-bs103.html

Large diffs are not rendered by default.

334 changes: 148 additions & 186 deletions doc/pub/week9/html/._week9-bs104.html

Large diffs are not rendered by default.

289 changes: 152 additions & 137 deletions doc/pub/week9/html/._week9-bs105.html

Large diffs are not rendered by default.

325 changes: 189 additions & 136 deletions doc/pub/week9/html/._week9-bs106.html

Large diffs are not rendered by default.

319 changes: 143 additions & 176 deletions doc/pub/week9/html/._week9-bs107.html

Large diffs are not rendered by default.

299 changes: 154 additions & 145 deletions doc/pub/week9/html/._week9-bs108.html

Large diffs are not rendered by default.

297 changes: 150 additions & 147 deletions doc/pub/week9/html/._week9-bs109.html

Large diffs are not rendered by default.

320 changes: 149 additions & 171 deletions doc/pub/week9/html/._week9-bs110.html

Large diffs are not rendered by default.

331 changes: 197 additions & 134 deletions doc/pub/week9/html/._week9-bs111.html

Large diffs are not rendered by default.

299 changes: 139 additions & 160 deletions doc/pub/week9/html/._week9-bs112.html

Large diffs are not rendered by default.

282 changes: 145 additions & 137 deletions doc/pub/week9/html/._week9-bs113.html

Large diffs are not rendered by default.

291 changes: 144 additions & 147 deletions doc/pub/week9/html/._week9-bs114.html

Large diffs are not rendered by default.

288 changes: 151 additions & 137 deletions doc/pub/week9/html/._week9-bs115.html

Large diffs are not rendered by default.

301 changes: 163 additions & 138 deletions doc/pub/week9/html/._week9-bs116.html

Large diffs are not rendered by default.

310 changes: 144 additions & 166 deletions doc/pub/week9/html/._week9-bs117.html

Large diffs are not rendered by default.

267 changes: 136 additions & 131 deletions doc/pub/week9/html/._week9-bs118.html

Large diffs are not rendered by default.

315 changes: 150 additions & 165 deletions doc/pub/week9/html/._week9-bs119.html

Large diffs are not rendered by default.

286 changes: 148 additions & 138 deletions doc/pub/week9/html/._week9-bs120.html

Large diffs are not rendered by default.

304 changes: 164 additions & 140 deletions doc/pub/week9/html/._week9-bs121.html

Large diffs are not rendered by default.

286 changes: 144 additions & 142 deletions doc/pub/week9/html/._week9-bs122.html

Large diffs are not rendered by default.

306 changes: 148 additions & 158 deletions doc/pub/week9/html/._week9-bs123.html

Large diffs are not rendered by default.

345 changes: 140 additions & 205 deletions doc/pub/week9/html/._week9-bs124.html

Large diffs are not rendered by default.

400 changes: 255 additions & 145 deletions doc/pub/week9/html/._week9-bs125.html

Large diffs are not rendered by default.

283 changes: 148 additions & 135 deletions doc/pub/week9/html/._week9-bs126.html

Large diffs are not rendered by default.

334 changes: 139 additions & 195 deletions doc/pub/week9/html/._week9-bs127.html

Large diffs are not rendered by default.

320 changes: 180 additions & 140 deletions doc/pub/week9/html/._week9-bs128.html

Large diffs are not rendered by default.

283 changes: 145 additions & 138 deletions doc/pub/week9/html/._week9-bs129.html

Large diffs are not rendered by default.

309 changes: 143 additions & 166 deletions doc/pub/week9/html/._week9-bs130.html

Large diffs are not rendered by default.

312 changes: 173 additions & 139 deletions doc/pub/week9/html/._week9-bs131.html

Large diffs are not rendered by default.

309 changes: 145 additions & 164 deletions doc/pub/week9/html/._week9-bs132.html

Large diffs are not rendered by default.

312 changes: 172 additions & 140 deletions doc/pub/week9/html/._week9-bs133.html

Large diffs are not rendered by default.

282 changes: 141 additions & 141 deletions doc/pub/week9/html/._week9-bs134.html

Large diffs are not rendered by default.

308 changes: 178 additions & 130 deletions doc/pub/week9/html/._week9-bs135.html

Large diffs are not rendered by default.

276 changes: 135 additions & 141 deletions doc/pub/week9/html/._week9-bs136.html

Large diffs are not rendered by default.

304 changes: 141 additions & 163 deletions doc/pub/week9/html/._week9-bs137.html

Large diffs are not rendered by default.

294 changes: 150 additions & 144 deletions doc/pub/week9/html/._week9-bs138.html

Large diffs are not rendered by default.

343 changes: 155 additions & 188 deletions doc/pub/week9/html/._week9-bs139.html

Large diffs are not rendered by default.

337 changes: 162 additions & 175 deletions doc/pub/week9/html/._week9-bs140.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

263 changes: 134 additions & 129 deletions doc/pub/week9/html/week9-bs.html

Large diffs are not rendered by default.

77 changes: 75 additions & 2 deletions doc/pub/week9/html/week9-reveal.html
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,82 @@ <h2 id="introducing-the-correlation-function">Introducing the correlation functi
$$
<p>&nbsp;<br>

<p>The code here shows the evolution of \( \kappa_d \) as a function of \( d \) for a series of random numbers. We see that the function \( \kappa_d \) approaches \( 0 \) as \( d\rightarrow \infty \).</p>
<p>The code here shows the evolution of \( \kappa_d \) as a function of \( d \)
for a series of random numbers. We see that the function \( \kappa_d \)
approaches \( 0 \) as \( d\rightarrow \infty \).
</p>

<p>In this case, our data are given by random numbers generated for the uniform distribution with \( x\in [0,1] \). Even with two random numbers being far away, we note that the correlation function is not zero.</p>
</section>

<p><b>Note</b>: code will be inserted here later.</p>
<section>
<h2 id="computing-the-correlation-function">Computing the correlation function </h2>

<p>This code is best seen with the jupyter-notebook</p>

<!-- code=python (!bc pycod) typeset with pygments style "perldoc" -->
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="inner_cell">
<div class="input_area">
<div class="highlight" style="background: #eeeedd">
<pre style="font-size: 80%; line-height: 125%;"><span style="color: #228B22">#!/usr/bin/env python</span>
<span style="color: #8B008B; font-weight: bold">import</span> <span style="color: #008b45; text-decoration: underline">numpy</span> <span style="color: #8B008B; font-weight: bold">as</span> <span style="color: #008b45; text-decoration: underline">np</span>
<span style="color: #8B008B; font-weight: bold">import</span> <span style="color: #008b45; text-decoration: underline">matplotlib.mlab</span> <span style="color: #8B008B; font-weight: bold">as</span> <span style="color: #008b45; text-decoration: underline">mlab</span>
<span style="color: #8B008B; font-weight: bold">import</span> <span style="color: #008b45; text-decoration: underline">matplotlib.pyplot</span> <span style="color: #8B008B; font-weight: bold">as</span> <span style="color: #008b45; text-decoration: underline">plt</span>
<span style="color: #8B008B; font-weight: bold">import</span> <span style="color: #008b45; text-decoration: underline">random</span>

<span style="color: #228B22"># initialize the rng with a seed, simple uniform distribution</span>
random.seed()
m = <span style="color: #B452CD">10000</span>
samplefactor = <span style="color: #B452CD">1.0</span>/m
x = np.zeros(m)
MeanValue = <span style="color: #B452CD">0.</span>
VarValue = <span style="color: #B452CD">0.</span>
<span style="color: #8B008B; font-weight: bold">for</span> i <span style="color: #8B008B">in</span> <span style="color: #658b00">range</span> (m):
value = random.random()
x[i] = value
MeanValue += value
VarValue += value*value

MeanValue *= samplefactor
VarValue *= samplefactor
Variance = VarValue-MeanValue*MeanValue
STDev = np.sqrt(Variance)
<span style="color: #658b00">print</span>(<span style="color: #CD5555">&quot;MeanValue =&quot;</span>, MeanValue)
<span style="color: #658b00">print</span>(<span style="color: #CD5555">&quot;Variance =&quot;</span>, Variance)
<span style="color: #658b00">print</span>(<span style="color: #CD5555">&quot;Standard deviation =&quot;</span>, STDev)

<span style="color: #228B22"># Computing the autocorrelation function</span>
autocorrelation = np.zeros(m)
darray = np.zeros(m)
<span style="color: #8B008B; font-weight: bold">for</span> j <span style="color: #8B008B">in</span> <span style="color: #658b00">range</span> (m):
<span style="color: #658b00">sum</span> = <span style="color: #B452CD">0.0</span>
darray[j] = j
<span style="color: #8B008B; font-weight: bold">for</span> k <span style="color: #8B008B">in</span> <span style="color: #658b00">range</span> (m-j):
<span style="color: #658b00">sum</span> += (x[k]-MeanValue)*(x[k+j]-MeanValue )
autocorrelation[j] = (<span style="color: #658b00">sum</span>/Variance)*samplefactor
<span style="color: #228B22"># Visualize results</span>
plt.plot(darray, autocorrelation,<span style="color: #CD5555">&#39;ro&#39;</span>)
plt.axis([<span style="color: #B452CD">0</span>,m,-<span style="color: #B452CD">0.2</span>, <span style="color: #B452CD">1.1</span>])
plt.xlabel(<span style="color: #CD5555">r&#39;$d$&#39;</span>)
plt.ylabel(<span style="color: #CD5555">r&#39;$\kappa_d$&#39;</span>)
plt.title(<span style="color: #CD5555">r&#39;autocorrelation function for RNG with uniform distribution&#39;</span>)
plt.show()
</pre>
</div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_subarea output_stream output_stdout output_text">
</div>
</div>
</div>
</div>
</div>
</section>

<section>
Expand Down
81 changes: 79 additions & 2 deletions doc/pub/week9/html/week9-solarized.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@
2,
None,
'introducing-the-correlation-function'),
('Computing the correlation function',
2,
None,
'computing-the-correlation-function'),
('Resampling methods: Blocking',
2,
None,
Expand Down Expand Up @@ -725,9 +729,82 @@ <h2 id="introducing-the-correlation-function">Introducing the correlation functi
\end{align*}
$$

<p>The code here shows the evolution of \( \kappa_d \) as a function of \( d \) for a series of random numbers. We see that the function \( \kappa_d \) approaches \( 0 \) as \( d\rightarrow \infty \).</p>
<p>The code here shows the evolution of \( \kappa_d \) as a function of \( d \)
for a series of random numbers. We see that the function \( \kappa_d \)
approaches \( 0 \) as \( d\rightarrow \infty \).
</p>

<p>In this case, our data are given by random numbers generated for the uniform distribution with \( x\in [0,1] \). Even with two random numbers being far away, we note that the correlation function is not zero.</p>

<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="computing-the-correlation-function">Computing the correlation function </h2>

<p>This code is best seen with the jupyter-notebook</p>

<!-- code=python (!bc pycod) typeset with pygments style "perldoc" -->
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="inner_cell">
<div class="input_area">
<div class="highlight" style="background: #eeeedd">
<pre style="line-height: 125%;"><span style="color: #228B22">#!/usr/bin/env python</span>
<span style="color: #8B008B; font-weight: bold">import</span> <span style="color: #008b45; text-decoration: underline">numpy</span> <span style="color: #8B008B; font-weight: bold">as</span> <span style="color: #008b45; text-decoration: underline">np</span>
<span style="color: #8B008B; font-weight: bold">import</span> <span style="color: #008b45; text-decoration: underline">matplotlib.mlab</span> <span style="color: #8B008B; font-weight: bold">as</span> <span style="color: #008b45; text-decoration: underline">mlab</span>
<span style="color: #8B008B; font-weight: bold">import</span> <span style="color: #008b45; text-decoration: underline">matplotlib.pyplot</span> <span style="color: #8B008B; font-weight: bold">as</span> <span style="color: #008b45; text-decoration: underline">plt</span>
<span style="color: #8B008B; font-weight: bold">import</span> <span style="color: #008b45; text-decoration: underline">random</span>

<span style="color: #228B22"># initialize the rng with a seed, simple uniform distribution</span>
random.seed()
m = <span style="color: #B452CD">10000</span>
samplefactor = <span style="color: #B452CD">1.0</span>/m
x = np.zeros(m)
MeanValue = <span style="color: #B452CD">0.</span>
VarValue = <span style="color: #B452CD">0.</span>
<span style="color: #8B008B; font-weight: bold">for</span> i <span style="color: #8B008B">in</span> <span style="color: #658b00">range</span> (m):
value = random.random()
x[i] = value
MeanValue += value
VarValue += value*value

MeanValue *= samplefactor
VarValue *= samplefactor
Variance = VarValue-MeanValue*MeanValue
STDev = np.sqrt(Variance)
<span style="color: #658b00">print</span>(<span style="color: #CD5555">&quot;MeanValue =&quot;</span>, MeanValue)
<span style="color: #658b00">print</span>(<span style="color: #CD5555">&quot;Variance =&quot;</span>, Variance)
<span style="color: #658b00">print</span>(<span style="color: #CD5555">&quot;Standard deviation =&quot;</span>, STDev)

<span style="color: #228B22"># Computing the autocorrelation function</span>
autocorrelation = np.zeros(m)
darray = np.zeros(m)
<span style="color: #8B008B; font-weight: bold">for</span> j <span style="color: #8B008B">in</span> <span style="color: #658b00">range</span> (m):
<span style="color: #658b00">sum</span> = <span style="color: #B452CD">0.0</span>
darray[j] = j
<span style="color: #8B008B; font-weight: bold">for</span> k <span style="color: #8B008B">in</span> <span style="color: #658b00">range</span> (m-j):
<span style="color: #658b00">sum</span> += (x[k]-MeanValue)*(x[k+j]-MeanValue )
autocorrelation[j] = (<span style="color: #658b00">sum</span>/Variance)*samplefactor
<span style="color: #228B22"># Visualize results</span>
plt.plot(darray, autocorrelation,<span style="color: #CD5555">&#39;ro&#39;</span>)
plt.axis([<span style="color: #B452CD">0</span>,m,-<span style="color: #B452CD">0.2</span>, <span style="color: #B452CD">1.1</span>])
plt.xlabel(<span style="color: #CD5555">r&#39;$d$&#39;</span>)
plt.ylabel(<span style="color: #CD5555">r&#39;$\kappa_d$&#39;</span>)
plt.title(<span style="color: #CD5555">r&#39;autocorrelation function for RNG with uniform distribution&#39;</span>)
plt.show()
</pre>
</div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_subarea output_stream output_stdout output_text">
</div>
</div>
</div>
</div>
</div>

<p><b>Note</b>: code will be inserted here later.</p>

<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="resampling-methods-blocking">Resampling methods: Blocking </h2>
Expand Down
81 changes: 79 additions & 2 deletions doc/pub/week9/html/week9.html
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@
2,
None,
'introducing-the-correlation-function'),
('Computing the correlation function',
2,
None,
'computing-the-correlation-function'),
('Resampling methods: Blocking',
2,
None,
Expand Down Expand Up @@ -802,9 +806,82 @@ <h2 id="introducing-the-correlation-function">Introducing the correlation functi
\end{align*}
$$

<p>The code here shows the evolution of \( \kappa_d \) as a function of \( d \) for a series of random numbers. We see that the function \( \kappa_d \) approaches \( 0 \) as \( d\rightarrow \infty \).</p>
<p>The code here shows the evolution of \( \kappa_d \) as a function of \( d \)
for a series of random numbers. We see that the function \( \kappa_d \)
approaches \( 0 \) as \( d\rightarrow \infty \).
</p>

<p>In this case, our data are given by random numbers generated for the uniform distribution with \( x\in [0,1] \). Even with two random numbers being far away, we note that the correlation function is not zero.</p>

<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="computing-the-correlation-function">Computing the correlation function </h2>

<p>This code is best seen with the jupyter-notebook</p>

<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="inner_cell">
<div class="input_area">
<div class="highlight" style="background: #f8f8f8">
<pre style="line-height: 125%;"><span style="color: #408080; font-style: italic">#!/usr/bin/env python</span>
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">numpy</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">np</span>
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">matplotlib.mlab</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">mlab</span>
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">matplotlib.pyplot</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">plt</span>
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">random</span>

<span style="color: #408080; font-style: italic"># initialize the rng with a seed, simple uniform distribution</span>
random<span style="color: #666666">.</span>seed()
m <span style="color: #666666">=</span> <span style="color: #666666">10000</span>
samplefactor <span style="color: #666666">=</span> <span style="color: #666666">1.0/</span>m
x <span style="color: #666666">=</span> np<span style="color: #666666">.</span>zeros(m)
MeanValue <span style="color: #666666">=</span> <span style="color: #666666">0.</span>
VarValue <span style="color: #666666">=</span> <span style="color: #666666">0.</span>
<span style="color: #008000; font-weight: bold">for</span> i <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #008000">range</span> (m):
value <span style="color: #666666">=</span> random<span style="color: #666666">.</span>random()
x[i] <span style="color: #666666">=</span> value
MeanValue <span style="color: #666666">+=</span> value
VarValue <span style="color: #666666">+=</span> value<span style="color: #666666">*</span>value

MeanValue <span style="color: #666666">*=</span> samplefactor
VarValue <span style="color: #666666">*=</span> samplefactor
Variance <span style="color: #666666">=</span> VarValue<span style="color: #666666">-</span>MeanValue<span style="color: #666666">*</span>MeanValue
STDev <span style="color: #666666">=</span> np<span style="color: #666666">.</span>sqrt(Variance)
<span style="color: #008000">print</span>(<span style="color: #BA2121">&quot;MeanValue =&quot;</span>, MeanValue)
<span style="color: #008000">print</span>(<span style="color: #BA2121">&quot;Variance =&quot;</span>, Variance)
<span style="color: #008000">print</span>(<span style="color: #BA2121">&quot;Standard deviation =&quot;</span>, STDev)

<span style="color: #408080; font-style: italic"># Computing the autocorrelation function</span>
autocorrelation <span style="color: #666666">=</span> np<span style="color: #666666">.</span>zeros(m)
darray <span style="color: #666666">=</span> np<span style="color: #666666">.</span>zeros(m)
<span style="color: #008000; font-weight: bold">for</span> j <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #008000">range</span> (m):
<span style="color: #008000">sum</span> <span style="color: #666666">=</span> <span style="color: #666666">0.0</span>
darray[j] <span style="color: #666666">=</span> j
<span style="color: #008000; font-weight: bold">for</span> k <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #008000">range</span> (m<span style="color: #666666">-</span>j):
<span style="color: #008000">sum</span> <span style="color: #666666">+=</span> (x[k]<span style="color: #666666">-</span>MeanValue)<span style="color: #666666">*</span>(x[k<span style="color: #666666">+</span>j]<span style="color: #666666">-</span>MeanValue )
autocorrelation[j] <span style="color: #666666">=</span> (<span style="color: #008000">sum</span><span style="color: #666666">/</span>Variance)<span style="color: #666666">*</span>samplefactor
<span style="color: #408080; font-style: italic"># Visualize results</span>
plt<span style="color: #666666">.</span>plot(darray, autocorrelation,<span style="color: #BA2121">&#39;ro&#39;</span>)
plt<span style="color: #666666">.</span>axis([<span style="color: #666666">0</span>,m,<span style="color: #666666">-0.2</span>, <span style="color: #666666">1.1</span>])
plt<span style="color: #666666">.</span>xlabel(<span style="color: #BA2121">r&#39;$d$&#39;</span>)
plt<span style="color: #666666">.</span>ylabel(<span style="color: #BA2121">r&#39;$\kappa_d$&#39;</span>)
plt<span style="color: #666666">.</span>title(<span style="color: #BA2121">r&#39;autocorrelation function for RNG with uniform distribution&#39;</span>)
plt<span style="color: #666666">.</span>show()
</pre>
</div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_subarea output_stream output_stdout output_text">
</div>
</div>
</div>
</div>
</div>

<p><b>Note</b>: code will be inserted here later.</p>

<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="resampling-methods-blocking">Resampling methods: Blocking </h2>
Expand Down
Binary file modified doc/pub/week9/ipynb/ipynb-week9-src.tar.gz
Binary file not shown.
Loading

0 comments on commit efa4f16

Please sign in to comment.