<jupyter_start><jupyter_text>Testing Alpha Update upon Positive Attestations An agent executes a positive attestation when they desire to increase the system alpha closer in magnitude to their private belief of alpha.To make a positive attestation, the agent bonds $\Delta s$ quantity of supply tokens to the $S_1$ bucket. In exchange, they get $\Delta q_1$ quantity of positive claims.  $$\alpha_{t+1} = (\epsilon) \alpha + (1-\epsilon)\cdot(1-\delta) \alpha + (1-\epsilon).(\delta) \bar\alpha$$ where $\epsilon$ is the designer-defined fixed weight between [0,1] and $\delta=\frac{\Delta s}{S_1+S_0+\Delta s}$ is the dynamic weight. The realized alpha, $\bar\alpha$ is given by $$\bar\alpha = \frac{\Delta s}{S} \frac{R}{B}$$  where $B = (C+R)\left[\frac{q_1+\Delta q_1}{Q_1+\Delta q1}\frac{S_1+\Delta s}{S}-\frac{q_1}{Q_1}\frac{S_1}{S}\right]-(C)\left[\frac{\Delta s}{S}\right]$ In the following tests, we want to verify if the update in alpha is directionally correct - i.e we see an increase with each positive attestaion - and if the resultant system alpha is within its domain [0,1].  Test criteriaThe tests below must produce results that satisfy the below criteria.  Alpha UpdateFor an attestation $\Delta s \rightarrow S_1$, where $\Delta s \geq 0$, - $ \alpha_{t+1} \in [0,1] $- The realized alpha $\bar\alpha \geq \alpha_{t}$- The computed $\alpha_{t+1} \geq \alpha_{t}$ State Variable UpdatesSeveral state variables are computed in these tests. The following domains may be asserted on the state variables.- $ S \in [0, \infty) $- $ Q_1 \in [0, \infty) $- $ S_1 \in [0, S] \space | \space S_1 = S - S_0 - S_{free} $- $ S_0 \in [0, S] \space | \space S_0 = S - S_1 - S_{free} $ - $ s \in [0, S] $- $ q_1 \in [0, Q_1] $- $ s_1 \in [0, S_1] $  Intitialize state variables<jupyter_code>E = 0.46
C = 7000
R = 3000
S = 300

Q1 = [100]
q1 = [0]
S1 = [100] 
S0 = [100]
s1 = [0]
s = [20]

alpha = [0.5]<jupyter_output><empty_output><jupyter_text>Input an agent action signal The agent action signal contains a series of $\Delta s$ that they would use to make positive attestations.<jupyter_code>deltas = [1, 4, 5, 6, 3, 0, 1]<jupyter_output><empty_output><jupyter_text>Compute $\alpha_{t+1}$ for each agent action event and update state variables State variables are updated in each iteration            - $S \rightarrow S - \Delta s$- $Q_1 \rightarrow Q_1 + \Delta q$- $Q_0 \rightarrow Q_0$- $S_1 \rightarrow S_1 + \Delta s$- $S_0 \rightarrow S0 $  - $s \rightarrow s - \Delta s$- $q_1 \rightarrow q_1 + \Delta q$- $q_0 \rightarrow q_0$- $s_1 \rightarrow s_1 + \Delta s$- $s_0 \rightarrow s_0$  - $\alpha_t \rightarrow \alpha_{t+1}$<jupyter_code>import math

for i in range(len(deltas)): 
    
    A = 1+(deltas[i]/S)
    deltaq1 = Q1[i]*(math.sqrt(A-1))
        
    if deltas[i] == 0:
        new_alpha = alpha[i]
        print("alpha[i] =", alpha[i], "| new_alpha = ", new_alpha)
        print("____________________________")
    else:   
        attest_prop_after = (q1[i]+deltaq1)/(Q1[i]+deltaq1)
        supply_prop_after = (S1[i]+deltas[i])/S
        attest_supply_prop_before = (q1[i]/Q1[i])*(S1[i]/S)
    
        B = (attest_prop_after*supply_prop_after) - attest_supply_prop_before
              
        pre1 = (C+R)*B
        
        pre2 = (C)*(deltas[i]/S)
        
        alpha_bar = (deltas[i]/S)*(R/(pre1 - pre2))
        
       # pre3 = (deltas[i]/S)*R
       # pre4 = (C+R)*B
       # pre5 = (C)*(deltas[i]/S)
        
       # alpha_bar = pre3 / (pre4 - pre5)
    
        D = deltas[i]/(S0[i]+S1[i]+deltas[i])
    
        T1 = E*alpha[i]
    
        T2 = (1-E)*(1-D)*alpha[i]
    
        T3 = (1-E)*(D)*alpha_bar
    
        new_alpha = T1+T2+T3
    
        print("D = ", D)
        print("alpha_bar = ", alpha_bar)
        print("alpha[i] =", alpha[i], "| new_alpha = ", new_alpha)
        # print("alpha = ", alpha)
        print("deltas =", deltas[i], " | deltaq1 = ", deltaq1)
        print("s[i] =" , s[i])
        print("____________________________")
    
    # Update operations
    Q1.append(Q1[i] + deltaq1)
    S1.append(S1[i] + deltas[i])
    S0.append(S0[i])
    s1.append(s1[i] + deltas[i])
    s.append(s[i] - deltas[i])
    q1.append(deltaq1)
    alpha.append(new_alpha)<jupyter_output>D =  0.004975124378109453
alpha_bar =  0.06233186571425884
alpha[i] = 0.5 | new_alpha =  0.49882417516162036
deltas = 1  | deltaq1 =  5.773502691896324
s[i] = 20
____________________________
D =  0.01951219512195122
alpha_bar =  0.15595901638002552
alpha[i] = 0.49882417516162036 | new_alpha =  0.4952115471471411
deltas = 4  | deltaq1 =  12.213672050459229
s[i] = 19
____________________________
D =  0.023809523809523808
alpha_bar =  0.18087860549529386
alpha[i] = 0.4952115471471411 | new_alpha =  0.4911701236116173
deltas = 5  | deltaq1 =  15.232078761440219
s[i] = 15
____________________________
D =  0.027777777777777776
alpha_bar =  0.19533272980326338
alpha[i] = 0.4911701236116173 | new_alpha =  0.48673256270449206
deltas = 6  | deltaq1 =  18.84004750742875
s[i] = 10
____________________________
D =  0.0136986301369863
alpha_bar =  0.1161363117318615
alpha[i] = 0.48673256270449206 | new_alpha =  0.4839911657794891
deltas = 3  | deltaq1 =  15.205930101122458
s[i] = 4
_________________[...]<jupyter_text>Component Tests  - June 17<jupyter_code># Set state variables
C = 7000
R = 3000

Q1 = 300
S = 1000
S1 = 500
S0 = 200

q1 = 10
s1 = 13

delta_s = 5
# Calculate delta q
import math

delta_q = Q1*(math.sqrt(1+(delta_s/S))-1)
print("delta_q = ", delta_q)
# Calculate B1 (using S1+delta_s)
attest_prop_after = (q1+delta_q)/(Q1+delta_q)
supply_prop_after = (S1+delta_s)/S
attest_supply_before = (q1/Q1)*(S1/S)

B1 = (C+R)*((attest_prop_after * supply_prop_after) - attest_supply_before) + (C)*(delta_s/S)
print("B1 = ", B1)
# Calculate B2 (using s1+delta_s)
attest_prop_after = (q1+delta_q)/(Q1+delta_q)
supply_prop_after = (s1+delta_s)/S
attest_supply_before = (q1/Q1)*(s1/S)

B2 = (C+R)*((attest_prop_after * supply_prop_after) - attest_supply_before) + (C)*(delta_s/S)
print("B2 = ", B2)
# Calculate alpha_bar_1

alpha_bar_1 = (delta_s/S)*(R/B1)
print("alpha_bar_1 = ", alpha_bar_1)
# Calculate alpha_bar_2

alpha_bar_2 = (delta_s/S)*(R/B2)
print("alpha_bar_2 = ", alpha_bar_2)<jupyter_output>alpha_bar_2 =  0.40431220874713303<jupyter_text>Trial 2: With using s1+delta_s & attest_prop_after = (q1+delta_q)/(Q)<jupyter_code>#Calculate B3 w/ s1+delta_s & attest_prop_after = (q1+delta_q)/(Q)
Q = 300+100

attest_prop_after = (q1+delta_q)/(Q)
supply_prop_after = (s1+delta_s)/S
attest_supply_before = (q1/Q1)*(s1/S)

B3 = (C+R)*((attest_prop_after * supply_prop_after) - attest_supply_before) + (C)*(delta_s/S)
print("B3 = ", B3)
# Calculate alpha_bar_3

alpha_bar_3 = (delta_s/S)*(R/B3)
print("alpha_bar_3 = ", alpha_bar_3)<jupyter_output>alpha_bar_3 =  0.422490631447779<jupyter_text>**B should be 30 for alpha_bar to be 0.5**<jupyter_code>B4 = 30

# Calculate alpha_bar_4

alpha_bar_4 = (delta_s/S)*(R/B4)
print("alpha_bar_4 = ", alpha_bar_4)<jupyter_output>alpha_bar_4 =  0.5<jupyter_text>Trial 3: With attest_prop_after = (Q1+delta_q)/(Q) & supply_prop_after = (S1+delta_s)/S & attest_supply_before = (Q1/Q)*(S1/S)<jupyter_code>#Calculate B4 w/ attest_prop_after = (Q1+delta_q)/(Q) and supply_prop_after = (S1+delta_s)/S and attest_supply_before = (Q1/Q)*(S1/S)
Q = 300+100

attest_prop_after = (Q1+delta_q)/(Q)
supply_prop_after = (S1+delta_s)/S
attest_supply_before = (Q1/Q)*(S1/S)

B4 = (C+R)*((attest_prop_after * supply_prop_after) - attest_supply_before) + (C)*(delta_s/S)
print("B4 = ", B4)<jupyter_output>B4 =  81.95694356019797<jupyter_text>Trial 4: With attest_prop_after = (q1+delta_q)/(Q) & supply_prop_after = (S1+delta_s)/S & attest_supply_before = (q1/Q1)(S1/S)<jupyter_code># Calculate B5 w/ attest_prop_after = (q1+delta_q)/(Q) & supply_prop_after = (S1+delta_s)/S & attest_supply_before = (q1/Q)(S1/S)

Q = 300+100

attest_prop_after = (q1+delta_q)/(Q)
supply_prop_after = (S1+delta_s)/S
attest_supply_before = (q1/Q)*(S1/S)

B5 = (C+R)*((attest_prop_after * supply_prop_after) - attest_supply_before) + (C)*(delta_s/S)
print("B5 = ", B5)

# Calculate B6 w/ attest_prop_after = (q1+delta_q)/(Q) & supply_prop_after = (s1+delta_s)/S & attest_supply_before = (q1/Q)(s1/S)

Q = 300+100

attest_prop_after = (q1+delta_q)/(Q)
supply_prop_after = (s1+delta_s)/S
attest_supply_before = (q1/Q1)*(s1/S)

B6 = (C+R)*((attest_prop_after * supply_prop_after) - attest_supply_before) + (C)*(delta_s/S)
print("B6 = ", B6)
# Compute alpha bar

alpha_bar = (delta_s/S)*(R/B6)
print("alpha_bar = ", alpha_bar)<jupyter_output>alpha_bar =  0.422490631447779<jupyter_text>Component Tests - June 18  Compute $\bar\alpha$, single iteration<jupyter_code># Set state variables
C = 7000
R = 3000

Q1 = 300
S = 1000
S1 = 500
S0 = 200

q1 = 10
s1 = 13

delta_s = 5
# Calculate delta q
import math

delta_q = Q1*(math.sqrt(1+(delta_s/S))-1)
print("delta_q = ", delta_q)
# Calculate B1 

attest_prop_after = (q1+delta_q)/(Q1+delta_q)
supply_prop_after = (S1+delta_s)/S
attest_supply_before = (q1/Q1)*(S1/S)

B1 = (C+R)*((attest_prop_after * supply_prop_after) - attest_supply_before) + (C)*(delta_s/S)

print("B1 = ", B1)
# Compute alpha_bar

alpha_bar = (delta_s/S)*(R/B1)
print("alpha_bar = ", alpha_bar)
# Compute alpha_t+1

E = 0.45
alpha = 0.5

D = delta_s/(S0+S1+delta_s)
    
T1 = E*alpha
    
T2 = (1-E)*(1-D)*alpha
    
T3 = (1-E)*(D)*alpha_bar
    
new_alpha = T1+T2+T3

print("new_alpha = ", new_alpha)<jupyter_output>new_alpha =  0.49924801363659776<jupyter_text>Compute $\bar\alpha$, multiple iterations & updates<jupyter_code># Set state variables
C = 7000
R = 3000

Q1 = [300]
S = [1000]
S1 = [500]
S0 = [200]

q1 = [10]
s1 = [13]

s = [50]

alpha = [0.5]

delta_s = [5, 6, 5, 1, 3, 2]
import math

for i in range(len(delta_s)): 
    
    print(i)
    # Calculate delta q
    A = math.sqrt(1+(delta_s[i]/S[i]))
    delta_q = Q1[i]*(A-1)
    print("delta_q = ", delta_q)
import math

for i in range(len(delta_s)): 
    
    print("--------------------", i, "---------------------")
    
    # Calculate delta q
    A = math.sqrt(1+(delta_s[i]/S[i]))
    delta_q = Q1[i]*(A-1)
    print("delta_q = ", delta_q)
    
    # Calculate B1 
    attest_prop_after = (q1[i]+delta_q)/(Q1[i]+delta_q)
    supply_prop_after = (S1[i]+delta_s[i])/S[i]
    attest_supply_before = (q1[i]/Q1[i])*(S1[i]/S[i])

    B1 = (C+R)*((attest_prop_after * supply_prop_after) - attest_supply_before) + (C)*(delta_s[i]/S[i])

    print("B1 = ", B1)
    
    # Compute alpha_bar

    alpha_bar = (delta_s[i]/S[i])*(R/B1)
    print("alpha_bar = ", alpha_bar)
    
    # Compute alpha_t+1

    E = 0.45

    D = delta_s[i]/(S0[i]+S1[i]+delta_s[i])
    
    T1 = E*alpha[i]
    T2 = (1-E)*(1-D)*alpha[i]  
    T3 = (1-E)*(D)*alpha_bar
    
    new_alpha = T1+T2+T3

    print("new_alpha = ", new_alpha)
    
    # Update state variables
    Q1.append(Q1[i]+delta_q)
    S.append(S[i]-delta_s[i])
    S1.append(S1[i]+delta_s[i])
    S0.append(S0[i])
    q1.append(q1[i]+delta_q)
    s1.append(s1[i]+delta_s[i])
    s.append(s[i]-delta_s[i])
    alpha.append(new_alpha)<jupyter_output>-------------------- 0 ---------------------
delta_q =  0.7490648364513186
B1 =  48.82525756790532
alpha_bar =  0.30721804138233705
new_alpha =  0.49924801363659776
-------------------- 1 ---------------------
delta_q =  0.9054181994856562
B1 =  59.23012810069612
alpha_bar =  0.3054265260164771
new_alpha =  0.4983484202341415
-------------------- 2 ---------------------
delta_q =  0.7615626435088391
B1 =  49.973664537975864
alpha_bar =  0.30349655818280225
new_alpha =  0.49760003668576
-------------------- 3 ---------------------
delta_q =  0.15362766836940397
B1 =  10.08924783928661
alpha_bar =  0.30218114733322393
new_alpha =  0.4974501337720308
-------------------- 4 ---------------------
delta_q =  0.46135173938293506
B1 =  30.350134160776534
alpha_bar =  0.3016673973560601
new_alpha =  0.49700146500107756
-------------------- 5 ---------------------
delta_q =  0.3090577295748399
B1 =  20.356871673421104
alpha_bar =  0.3007558861603277
new_alpha =  0.4967024758920405<jupyter_text>Component Tests - June 22<jupyter_code># Set state variables
C = 7000
R = 3000

Q1 = [300]
S = [1000]
S1 = [500]
S0 = [200]

q1 = [10]
s1 = [13]

s = [300]

alpha = [0.9]

delta_s = [1, 3, 2, 5, 6, 7, 9, 10, 11, 13, 8, 3, 1, 5, 4, 60, 3, 2, 1, 6, 7, 4, 2, 7, 4, 5, 6, 8, 3, 4, 5, 2]
import math

for i in range(len(delta_s)): 
    
    print("--------------------", i, "---------------------")
    
    # Calculate delta q
    A = math.sqrt(1+(delta_s[i]/S[i]))
    delta_q = Q1[i]*(A-1)
    #print("delta_q = ", delta_q)
    
    # Calculate B1 
    attest_prop_after = (q1[i]+delta_q)/(Q1[i]+delta_q)
    supply_prop_after = (S1[i]+delta_s[i])/S[i]
    attest_supply_before = (q1[i]/Q1[i])*(S1[i]/S[i])

    B1 = -(C+R)*((attest_prop_after * supply_prop_after) - attest_supply_before) + (C)*(delta_s[i]/S[i])
    
    print("B1 part 1 = ", (C+R)*((attest_prop_after * supply_prop_after) - attest_supply_before))
    print("B1 part 2 = ", (C)*(delta_s[i]/S[i]))

    print("delta s = ", delta_s[i], " | B1 = ", B1)
    
    # Compute alpha_bar

    alpha_bar = (delta_s[i]/S[i])*(R/B1)
    print("alpha_bar = ", alpha_bar)
    
    # Compute alpha_t+1

    E = 0.45

    D = delta_s[i]/(S0[i]+S1[i]+delta_s[i])
    
    T1 = E*alpha[i]
    T2 = (1-E)*(1-D)*alpha[i]  
    T3 = (1-E)*(D)*alpha_bar
    
    new_alpha = T1+T2+T3

    print("new_alpha = ", new_alpha)
    
    # Update state variables
    Q1.append(Q1[i]+delta_q)
    S.append(S[i]-delta_s[i])
    S1.append(S1[i]+delta_s[i])
    S0.append(S0[i])
    q1.append(q1[i]+delta_q)
    s1.append(s1[i]+delta_s[i])
    s.append(s[i]-delta_s[i])
    alpha.append(new_alpha)
    
print("alpha : ", alpha)
import matplotlib.pyplot as plt

plt.plot(delta_s)
plt.plot(alpha)<jupyter_output><empty_output><jupyter_text>Component Tests - June 23<jupyter_code># Set state variables
C = 7000
R = 3000

Q1 = [300]
S = [1000]
S1 = [500]
S0 = [200]

q1 = [10]
s1 = [13]

s = [50]

alpha = [0.5]

delta_s = [5, 6, 5, 1, 3, 2]
import math

for i in range(len(delta_s)): 
    
    print("--------------------", i, "---------------------")
    
    # Calculate delta q
    A = math.sqrt(1+(delta_s[i]/S[i]))
    delta_q = Q1[i]*(A-1)
    print("delta_q = ", delta_q)
    
    # Calculate B1 
    attest_prop_after = (q1[i]+delta_q)/(Q1[i]+delta_q)
    supply_prop_after = (S1[i]+delta_s[i])/S[i]
    attest_supply_before = (q1[i]/Q1[i])*(S1[i]/S[i])

    B1 = (C+R)*((attest_prop_after * supply_prop_after) - attest_supply_before) + (C)*(delta_s[i]/S[i])

    print("B1 = ", B1)
    
    # Compute alpha_bar

    alpha_bar = (delta_s[i]/S[i])*(R/B1)
    print("alpha_bar = ", alpha_bar)
    
    # Compute alpha_t+1

    E = 0.45

    D = delta_s[i]/(S0[i]+S1[i]+delta_s[i])
    
    T1 = E*alpha[i]
    T2 = (1-E)*(1-D)*alpha[i]  
    T3 = (1-E)*(D)*alpha_bar
    
    new_alpha = T1+T2+T3

    print("new_alpha = ", new_alpha)
    
    # Update state variables
    Q1.append(Q1[i]+delta_q)
    S.append(S[i]-delta_s[i])
    S1.append(S1[i]+delta_s[i])
    S0.append(S0[i])
    q1.append(q1[i]+delta_q)
    s1.append(s1[i]+delta_s[i])
    s.append(s[i]-delta_s[i])
    alpha.append(new_alpha)<jupyter_output>-------------------- 0 ---------------------
delta_q =  0.7490648364513186
B1 =  48.82525756790532
alpha_bar =  0.30721804138233705
new_alpha =  0.49924801363659776
-------------------- 1 ---------------------
delta_q =  0.9054181994856562
B1 =  59.23012810069612
alpha_bar =  0.3054265260164771
new_alpha =  0.4983484202341415
-------------------- 2 ---------------------
delta_q =  0.7615626435088391
B1 =  49.973664537975864
alpha_bar =  0.30349655818280225
new_alpha =  0.49760003668576
-------------------- 3 ---------------------
delta_q =  0.15362766836940397
B1 =  10.08924783928661
alpha_bar =  0.30218114733322393
new_alpha =  0.4974501337720308
-------------------- 4 ---------------------
delta_q =  0.46135173938293506
B1 =  30.350134160776534
alpha_bar =  0.3016673973560601
new_alpha =  0.49700146500107756
-------------------- 5 ---------------------
delta_q =  0.3090577295748399
B1 =  20.356871673421104
alpha_bar =  0.3007558861603277
new_alpha =  0.4967024758920405<jupyter_text>With alternate alpha derivation<jupyter_code># Set state variables
C = 7000
R = 3000

Q = [400]
Q1 = [300]
S = [1000]
S1 = [500]
S0 = [200]

q0 = [5]
s0 = [7]
q1 = [10]
s1 = [13]

s = [50]

alpha = [0.5]

delta_s = [5, 6, 5, 1, 3, 2]
import math

for i in range(len(delta_s)): 
    
    print("--------------------", i, "---------------------")
    
    # Calculate delta q
    A = math.sqrt(1+(delta_s[i]/S[i]))
    delta_q = Q1[i]*(A-1)
    print("delta_q = ", delta_q)
    
    # Calculate mu_1
    mu_1 = (((q1[i]+delta_q)/(Q[i]+delta_q))*(s1[i]+delta_s[i]/S[i]))-((q1[i]*s1[i])/Q[i]*S[i])
    
    # Calculate mu_0
    mu_0 = ((q0[i])/(Q[i]+delta_q))*(s0[i]/S[i]) - ((q0[i]*s0[i])/Q[i]*S[i])

    # Compute alpha_bar

    alpha_bar = ((delta_s[i]/S[i]) - (R*mu_0))/(-C*(delta_s[i]/S[i]) + ((C+R)*mu_1) - ((R)*mu_0))
    print("alpha_bar = ", alpha_bar)
    
    # Compute alpha_t+1

    E = 0.45

    D = delta_s[i]/(S0[i]+S1[i]+delta_s[i])
    
    T1 = E*alpha[i]
    T2 = (1-E)*(1-D)*alpha[i]  
    T3 = (1-E)*(D)*alpha_bar
    
    new_alpha = T1+T2+T3

    print("new_alpha = ", new_alpha)
    
    # Update state variables
    Q.append(Q[i]+delta_q)
    Q1.append(Q1[i]+delta_q)
    S.append(S[i]-delta_s[i])
    S1.append(S1[i]+delta_s[i])
    S0.append(S0[i])
    q0.append(q0[i])
    s0.append(s0[i])
    q1.append(q1[i]+delta_q)
    s1.append(s1[i]+delta_s[i])
    s.append(s[i]-delta_s[i])
    alpha.append(new_alpha)
import matplotlib.pyplot as plt

plt.plot(alpha)<jupyter_output><empty_output><jupyter_text>With original alpha derivation<jupyter_code># Set state variables
C = 7000
R = 3000

Q = [40]
Q1 = [30]
Q0 = [10]

S = [1000]
S1 = [900]
S0 = [100]

q0 = [5]
s0 = [7]
q1 = [10]
s1 = [13]

s = [50]

alpha = [0.9]

delta_s = [5, 6, 5, 1, 3, 2]
import math

for i in range(len(delta_s)): 
    
    print("--------------------", i, "---------------------")
    
    # Calculate delta q
    A = math.sqrt(1+(delta_s[i]/S[i]))
    delta_q = Q1[i]*(A-1)
    print("delta_q = ", delta_q)
    
    # Calculate mu_1
    pre1 = (q1[i]+delta_q)/(Q1[i]+delta_q)
    pre2 = (S1[i]+delta_s[i])/S[i]
    pre3 = (q1[i]*S1[i])/(Q1[i]*S[i])
    print("pre_1 = ", pre1, " | pre_2 = ", pre2, " | pre_3 = ", pre3)
    
    mu_1 = (pre1 * pre2) - pre3
    print("mu_1 = ", mu_1)
    
    # Compute alpha_bar
    pre4 = (R)*(delta_s[i]/S[i])
    pre5 = (C+R)*mu_1
    pre6 = (C)*(delta_s[i]/S[i])
    print("pre_4 = ", pre4, " | pre_5 = ", pre5, " | pre_6 = ", pre6)
    
    alpha_bar = pre4/(pre6 - pre5)
    print("alpha_bar = ", alpha_bar)
    
    # Compute alpha_t+1

    E = 0.2

    D = delta_s[i]/(S0[i]+S1[i]+delta_s[i])
    
    T1 = E*alpha[i]
    T2 = (1-E)*(1-D)*alpha[i]  
    T3 = (1-E)*(D)*alpha_bar
    
    new_alpha = T1+T2+T3

    print("new_alpha = ", new_alpha)
    
    # Update state variables
    Q.append(Q[i]+delta_q)
    Q1.append(Q1[i]+delta_q)
    S.append(S[i]-delta_s[i])
    S1.append(S1[i]+delta_s[i])
    S0.append(S0[i])
    q0.append(q0[i])
    s0.append(s0[i])
    q1.append(q1[i]+delta_q)
    s1.append(s1[i]+delta_s[i])
    s.append(s[i]-delta_s[i])
    alpha.append(new_alpha)<jupyter_output>-------------------- 0 ---------------------
delta_q =  0.07490648364513186
pre_1 =  0.3349937759282447  | pre_2 =  0.905  | pre_3 =  0.3
mu_1 =  0.003169367215061447
pre_4 =  15.0  | pre_5 =  31.69367215061447  | pre_6 =  35.0
alpha_bar =  4.536755180762762
new_alpha =  0.914474647485623
-------------------- 1 ---------------------
delta_q =  0.09054181994856561
pre_1 =  0.3369897971111093  | pre_2 =  0.9155778894472362  | pre_3 =  0.30469283137192105
mu_1 =  0.00384757583232076
pre_4 =  18.09045226130653  | pre_5 =  38.4757583232076  | pre_6 =  42.211055276381906
alpha_bar =  4.8431095273250016
new_alpha =  0.9331269199121601
-------------------- 2 ---------------------
delta_q =  0.0761562643508839
pre_1 =  0.33865943008858895  | pre_2 =  0.9261880687563195  | pre_3 =  0.31041223980608756
mu_1 =  0.00325008371377844
pre_4 =  15.166835187057634  | pre_5 =  32.5008371377844  | pre_6 =  35.38928210313448
alpha_bar =  5.250865212596992
new_alpha =  0.9501258895683997
-------------------[...]<jupyter_text>With initial $\alpha = 0.5$. At $\alpha = 0.5$, the corresponding state variables are initialized as:$$Q = 40$$$$Q1 = 20$$$$Q0 = 20$$$$S = 1000$$$$S1 = 500$$$$S0 = 500$$<jupyter_code>import matplotlib.pyplot as plt

plt.plot(alpha)
plt.title("alpha, initialized at 0.5")<jupyter_output><empty_output><jupyter_text>With initial $\alpha = 0.1$. At $\alpha = 0.1$, the corresponding state variables are initialized as:$$Q = 40$$$$Q1 = 10$$$$Q0 = 30$$$$S = 1000$$$$S1 = 100$$$$S0 = 900$$<jupyter_code>import matplotlib.pyplot as plt

plt.plot(alpha)
plt.title("alpha, initialized at 0.1")<jupyter_output><empty_output><jupyter_text>With initial $\alpha = 0.9$. At $\alpha = 0.9$, the corresponding state variables are initialized as:$$Q = 40$$$$Q1 = 30$$$$Q0 = 10$$$$S = 1000$$$$S1 = 900$$$$S0 = 100$$<jupyter_code>import matplotlib.pyplot as plt

plt.plot(alpha)
plt.title("alpha, initialized at 0.9")
import matplotlib.pyplot as plt

plt.plot(alpha)
plt.title("alpha, initialized at 0.6")
import matplotlib.pyplot as plt

plt.plot(alpha)
plt.title("alpha, initialized at 0.7")
import matplotlib.pyplot as plt

plt.plot(alpha)
plt.title("alpha, initialized at 0.7 and delta s w/ 20")
import matplotlib.pyplot as plt

plt.plot(alpha)
plt.title("alpha, initialized at 0.5 and delta s w/ 20")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.20032213529682466, 'fraction_numerical': 0.12959042797975148, 'mean_word_length': 3.0272424017790955, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '17', 'dir': 'jupyter-structured-clean-dedup', 'id': '81632', 'license': 'MIT', 'n_tokens_mistral': 10950, 'n_tokens_neox': 9414, 'n_words': 1701, 'path': 'tests/alpha_positive.ipynb', 'repo_name': 'witwiki/Risk-Adjusted-Bonding-Curves', 'size': '21730'}