<jupyter_start><jupyter_text>Distributions Normal distributionTo generate `1000` samples from a normal distribution$$s \sim \mathcal{N}\left(2.5, 10.0\right)$$we run:<jupyter_code>#>flags -d:py3_version:3.6 -d:py3_dynamic --hints:off --verbosity:0
#>inlineplot 600 250

import science/Distributions

let s = rnorm(1000, 2.5, 10.0)

show:
    hist(s, bins=50, log=false)<jupyter_output>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! Compiling for Python 3.6 (DYNAMIC) !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<jupyter_text>We can calculate the variance and standard deviation, using respectively `variance` and `sd`:<jupyter_code>import science/Distributions
import science/Misc

let s = rnorm(1000, 2.5, 10.0)
echo(variance(s))
echo(sd(s))<jupyter_output>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! Compiling for Python 3.6 (DYNAMIC) !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<jupyter_text>Poisson distributionCan be simulated by calling `rpois`.<jupyter_code>#>flags -d:py3_version:3.6 -d:py3_dynamic --hints:off --verbosity:0
#>inlineplot 600 250
import science/Distributions

let samples = rpois(1000, 2)

show:
    hist(samples)
    title(r"$x \sim Po(2)$")<jupyter_output>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! Compiling for Python 3.6 (DYNAMIC) !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
{'fraction_non_alphanumeric': 0.29946112394149343, 'fraction_numerical': 0.04849884526558892, 'mean_word_length': 7.333333333333333, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 14, 'https://': 0, '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': '338757', 'license': 'Apache-2.0', 'n_tokens_mistral': 510, 'n_tokens_neox': 433, 'n_words': 95, 'path': 'examples/Distributions.ipynb', 'repo_name': 'ruivieira/nim-science', 'size': '1299'}