<jupyter_start><jupyter_text>$u_{n} = 1 + c n - S_{n}$ où $S_{n} = \sum_{i = 0}^{N_{n}} X_i$.<jupyter_code>dN1 = np.random.poisson(lambda_T, N)
dX1 = np.random.exponential(1 / lambda_X, (N, 5))
dS1 = np.sum((np.arange(5) < dN1.reshape(N, 1)) * dX1, axis=1)
S1 = np.cumsum(dS1)
plt.plot(S1)
plt.show()
n_samples_per_time_unit = 1 + int(lambda_T + 5 * np.sqrt(lambda_T))
M = 10
dN = np.hstack((np.zeros((M, 1)), np.random.poisson(lambda_T, (M, N - 1))))
dX = np.random.exponential(1 / lambda_X, (M, N, n_samples_per_time_unit))
dS = np.sum((np.arange(n_samples_per_time_unit) < dN.reshape(M, N, 1)) * dX, axis=2)
S = np.cumsum(dS, axis=1)
plt.plot(S.T)
plt.show()
u = 1 + c * np.arange(N) - S
plt.plot(u.T)
plt.show()
u_alive = ~np.cumsum(u<0, axis=1).astype(bool)
u_cutted = u*(u_alive)
plt.title("Évolution des réserves monétaires avec accidents à couvrir")
plt.xlabel("temps (en s)")
plt.ylabel("trésorerie (en €)")
plt.plot(u.T, c='gray')
plt.plot(u_cutted.T)
# plt.plot(u_cutted.T, c=np.array(['r', 'b'])[(u_alive[:, -1]).astype(int)])
plt.show()
plt.title("Probabilité de non-ruine")
plt.xlabel("temps (en s)")
plt.ylabel("probabilité")
plt
plt.plot(np.mean(u_alive, axis=0))
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.22377049180327868, 'fraction_numerical': 0.02459016393442623, 'mean_word_length': 5.3264248704663215, 'pattern_counts': {'":': 0, '<': 8, '<?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': '319489', 'license': 'MIT', 'n_tokens_mistral': 635, 'n_tokens_neox': 600, 'n_words': 104, 'path': 'model1/ruine.ipynb', 'repo_name': 'jeanHeibig/casinoRoulette', 'size': '1220'}