<jupyter_start><jupyter_text>Simulations Lab<jupyter_code>%matplotlib inline
import numpy as np
import scipy.stats
from matplotlib import pyplot as plt<jupyter_output><empty_output><jupyter_text>Practice+ If you want to build a collection of things, keeping track of their order, but do not know how many things you will have, should you use a `dict`, `list`, or `array`?   + If you want to do fast math operations on many numbers at once, should you use a `tuple`, `array` or `list`? + Use an appropriate data type that allows you to look up the common name of an organism give its scientific name. | scientific | common ||------------|--------|| X. laevis  | frog   || M. musculus| mouse  || H. sapiens | human  | + Use a `for` loop to print out every 3rd value between -97 and 33. + You have an instrument that is going to spit out 1000 decimal numbers.  The following loop simulates this using the `time.time()` function, which spits out the time in seconds since January 1, 1970 at 12:00 GMT.  **Capture the output using a numpy array (no lists allowed) and determine the mean.**<jupyter_code>import time

for i in range(1000):
    instrument_spew = time.time()<jupyter_output><empty_output><jupyter_text>Exercises to review plottingReference material is [here](https://github.com/harmsm/pythonic-science/blob/master/reference/plotting_reference.ipynb).+ On the same graph, plot: $y = x$, $y = x^2$, $y = x^{3}$ ... $y = x^{10}$ for $x \in [-10,10]$. + Plot $y = e^{x}$ for $x \in [-5,5]$.  Make two different graphs (in the same cell!), one using a linear $y$ scale, one using a log $y$ scale.  (Hint: use `plt.show()`).  + Plot a histogram of 1000 random numbers sampled from a Poisson distribution with $\lambda = 3$.  Lab Coins in a rowYou place 100 coins heads up in a row and number them by position, with the coin all the way on the left No. 1 and the one on the rightmost edge No. 100. Next, for every number N, from 1 to 100, you flip over every coin whose position is a multiple of N. For example, first you’ll flip over all the coins, because every number is a multiple of 1. Then you’ll flip over all the even-numbered coins, because they’re multiples of 2. Then you’ll flip coins No. 3, 6, 9, 12 … And so on.What do the coins look like when you’re done? Specifically, which coins are heads down?Source: [fivethirtyeight](https://fivethirtyeight.com/features/can-you-survive-this-deadly-board-game/)  Mutant ScreenYou are doing a classic blue/white lacZ mutant screen, where bacterial mutants of interest have white colonies rather than blue colonies.  You screen a library containing 10,000 mutants.  You expect that 1/1,000 mutants will be white.  Assuming no bias in the library, how many colonies do you need to look at to have a < 2% chance of missing a mutant? (You can report your sampling to within a factor of ten.)  Dubious PaperYou read a paper that makes a big deal out of the following result.      The authors claim that the difference between treatment 1 and 2 is significant and important.  You are skeptical and want to test the claim.  Fortunately, these scientists published their response data for each treatment condition in the supplement.  These are copied below.<jupyter_code>treat_1 =   [57.26977195, 46.18382224, 49.53778012, 41.48839620, 60.208242,
             50.52545917, 46.35328597, 45.74836944, 48.44702572, 52.524908,
             55.10329891, 46.61524479, 52.13253421, 54.72779465, 42.324008,
             50.33964928, 52.18085508, 53.24086389, 43.14439906, 45.148827]

treat_2 =   [60.41763564, 48.83220035, 51.12384165, 42.96237314, 62.606467,
             51.96334172, 50.68015860, 48.75041835, 51.08492900, 55.163020,
             58.30618134, 51.06279668, 54.75658646, 57.74810245, 46.318017,
             51.32863816, 54.85243237, 55.94919523, 46.42182621, 48.367620]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09442282749675746, 'fraction_numerical': 0.11776913099870298, 'mean_word_length': 3.850314465408805, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '27075', 'license': 'Unlicense', 'n_tokens_mistral': 1497, 'n_tokens_neox': 1172, 'n_words': 526, 'path': 'labs/01_simulation/01_simulations.ipynb', 'repo_name': 'lperezmo/pythonic-science', 'size': '3855'}