<jupyter_start><jupyter_text>Symbolic calculations<jupyter_code>a,p,r,b,vmax,zmin,zmax,beta = symbols('a \\phi r z v_{\max} z_{\min} z_{\max} \\beta', positive=True,finite=True,real=True)
w,T,D,L,n,Supply = symbols('w T \\Delta \\ell n \\tau', positive=True,finite=True,real=True)
D,Supply,p
def exactCostPerDay(T):
    return (a*p + w*b*( (1+r)**T - 1 )) / T

def approxCostPerDay(T):
    return a*p/T + w*b*r

def symmetricLifetime(w):
    return w**2/4/L

def asymmetricLifetime(w):
    return w / D


uniformPDF = Piecewise( (1 / zmax , b<zmax), (0, True) )
powerlawPDF =  Piecewise( (0 , b<zmin), (zmin / b**2, True) )

display(sympy.integrate(uniformPDF, (b, 0, sympy.oo)))  # should be 1
display(sympy.integrate(powerlawPDF, (b, 0, sympy.oo))) # should be 1
display(sympy.integrate(b*uniformPDF, (b, 0, sympy.oo)))  # should be zmax/2
display(sympy.integrate(b*powerlawPDF, (b, 0, sympy.oo))) # should be infinity!
params = {
    L: 10,           # total transfers per day 
    D: 6,            # delta transfers per day 
    beta: 0.01,      # value / transfer-size
    r: 4/100/365,    # interest rate per day
    a: 1.1,          # records per reset tx
    Supply: 288000,  # records per day
    zmin: 0.001,     # min transfer size (for power law distribution)
    zmax: 1,         # max transfer size (for uniform distribution)
}
x,y,t=symbols("x y t")
intt = 1 + simplified(sympy.integrate(t(y)/(x-y)**2, (y,0,x-1)) + sympy.integrate(t(y)/(x-y)**2, (y,x+1,w)))
intt.diff(x)
intu = sympy.integrate(t(y), (y, sympy.Max(0,x-1),sympy.Min(w,x+1)))
intu, intu.diff(x)
intr = sympy.integrate(t(y), (y, x-1, x+1))
intr, intr.diff(x)
from sympy import *
x = symbols("x")
f = Function("f")
f_ = Derivative(f(x),x)
dsolve(f_ - f(x+1), f(x))
### See solution in https://stackoverflow.com/a/46755444/827927<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18790849673202614, 'fraction_numerical': 0.03649237472766884, 'mean_word_length': 3.746770025839793, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 1, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '660247', 'license': 'MIT', 'n_tokens_mistral': 806, 'n_tokens_neox': 760, 'n_words': 174, 'path': 'old/variable-transfer-size.ipynb', 'repo_name': 'erelsgl/bitcoin-simulations', 'size': '1836'}