import matplotlib import matplotlib.pyplot as plt from numpy import random, prod from typing import List number_of_samples = 4000 lower_bound = 0.997 units = (1 - lower_bound) * random.random_sample(size=number_of_samples) + lower_bound probability: List[float] = [] for i in range(0, len(units)): probability.append(prod(units[0:i], initial=units[0])) x = range(0, len(units)) plt.figure(figsize=[7, 10]) plt.subplot(2, 1, 1) plt.plot(x[0:500], probability[0:500], color='green') plt.title('Probability of a working system S') plt.ylabel('Probability of success') plt.grid() plt.subplot(2, 1, 2) plt.plot(x, probability) plt.ylabel('Probability of success') plt.grid() plt.xlabel('Number of layers') plt.savefig(f"graph_{lower_bound}.svg", format="svg") plt.show()