This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sympy import * | |
| import functools | |
| a, b, z = var('a b z') | |
| # discrete uniform pgf | |
| G_du = (z ** a - z ** (b + 1)) / ((b - a + 1) * (1 - z)) | |
| # pgf for 3d6 + 1d4 | |
| G = G_du.subs(a, 1).subs(b, 6) ** 3 * G_du.subs(a, 1).subs(b, 4) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import altair as alt | |
| import numpy as np | |
| import polars as pl | |
| import streamlit as st | |
| def logistic(x, y0, scale, x0, k): | |
| return y0 + scale / (1 + np.exp(-k * (x - x0))) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import streamlit as st | |
| import re | |
| st.title("A regex checker") | |
| s = st.text_input("string") | |
| r = re.compile(st.text_input("regex")) | |
| st.write(re.findall(string=s, pattern=r)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import altair as alt | |
| import numpy as np | |
| import numpy.random | |
| import polars as pl | |
| import scipy.stats | |
| from scipy.stats import distributions as dist | |
| class Sampler: | |
| def __init__(self, y: np.ndarray, n_particles: int, n_mh_iter: int): |
OlderNewer