<jupyter_start><jupyter_text>Simulate Function<jupyter_code>def simulate_stop_time(M, b, n, sigma_b, sigma_n, delta, num_iters = 100):
    tau = 0
    for _ in range(num_iters):
        if debug: print('New Iteration')
        x = 0
        time = 0
        while x not in [(-1*M/2), M/2]:
            time += 1
            x = x + np.random.normal(b, np.sqrt(sigma_b)) - np.random.normal(n, np.sqrt(sigma_n))*(b/n + ((delta / 2) *np.sign(x)))
            x = min(M/2, max(x, (-1*M/2)))
            if debug: print(x)
        tau += time
    return tau / num_iters
        
simulate_stop_time(100, 15, 5, 1, 1, 10)
num_points = 20
max_value = .1
delta_grid = np.arange(0, max_value, max_value / num_points)
values = np.zeros(len(delta_grid))

index = 0
for delta in delta_grid:
    values[index] = simulate_stop_time(100, 15, 5, 1, 1, delta, 500)
    print(delta, values[index])
    index += 1
plt.plot(delta_grid, values)
plt.xlabel('Delta')
plt.ylabel('Stopping Time')
plt.plot(delta_grid, np.log(values))
plt.xlabel('Delta')
plt.ylabel('Log Stopping Time')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.155188246097337, 'fraction_numerical': 0.03764921946740129, 'mean_word_length': 3.037037037037037, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '661458', 'license': 'MIT', 'n_tokens_mistral': 465, 'n_tokens_neox': 420, 'n_words': 98, 'path': 'continuous_time_budget/simulate_system.ipynb', 'repo_name': 'seanrsinclair/Online-Resource-Allocation', 'size': '1089'}