Bernoulli.py

From Werner KRAUTH

(Difference between revisions)
Jump to: navigation, search
Revision as of 14:41, 6 June 2024
Werner (Talk | contribs)

← Previous diff
Revision as of 14:44, 6 June 2024
Werner (Talk | contribs)

Next diff →
Line 1: Line 1:
==Context== ==Context==
-This page is part of my Lectures on "The second Markov chain revolution" at the [https://www.ipht.fr/Meetings/BegRohu2024/index.html 2024 Beg Rohu] Summer School "Concepts and Methods of Statistical Physics" (3 - 15 June 2024).+This page is part of my [[BegRohu_Lectures_2024|Lectures]] on "The second Markov chain revolution" at the [https://www.ipht.fr/Meetings/BegRohu2024/index.html 2024 Beg Rohu] Summer School "Concepts and Methods of Statistical Physics" (3 - 15 June 2024).
==Python program== ==Python program==

Revision as of 14:44, 6 June 2024

Context

This page is part of my Lectures on "The second Markov chain revolution" at the 2024 Beg Rohu Summer School "Concepts and Methods of Statistical Physics" (3 - 15 June 2024).

Python program

import random
p = 0.7
count_a = 0
N_trial = 1000000
for iter in range(N_trial):
    Upsilon = random.uniform(0.0, 1.0)
    if Upsilon < p: count_a += 1
print(count_a / N_trial)
Personal tools