Skip to content

atomic-guy/Python-scripts-SimpleMonteCarloExercises

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python scripts - solutions to simple Monte Carlo exercises



Description

My Python3.7 scripts prepared during the university course "Machine Learning" to solve Monte Carlo excersises.

Sorry for the variable names, comments, etc. in Polish in scripts. Sure the scripts aren't perfect, but they work.

  • ball.py
    [PL] Napisz program "ball" wykreślający objętość n-wymiarowej kuli o promieniu jednostkowym oraz błąd jej oszacowania w funkcji liczby wymiarów n. Program zaznacza objętość kropkami a błąd słupkami błędu. Na tym samym rysunku program wykresla linią łamaną wartości dokładne.
    [EN] Write a program "ball" plotting the volume of a n-dimensional sphere with a unit radius and the error of its estimation as a function of the number of dimensions n. The program marks the volume with dots and the error with error bars. In the same drawing, the program plots exact values with a polyline.

  • children.py
    [PL] Każdemu małżeństwu dzieci rodzą się zawsze pojedynczo, do narodzenia pierwszej dziewczynki lub osiągnięcia największej dopuszczalnej liczby dzieci N. Napisz program "children", który wczytuje N i wykreśla na jednym rysunku oczekiwane liczby dziewczynek i chłopców w rodzinie w funkcji prawdopodobieństwa urodzenia dziewczynki.
    [EN]For each married couple, children are always born singly, until the first girl is born or until the maximum number of children N is reached. Write the program "children", which loads N and plots the expected numbers of girls and boys in the family as a function of the girl's birth rate in one drawing.

  • coin.py
    [PL] Jaś i Małgosia rzucają kilka razy uczciwą monetą. Za każdego orła Jaś daje Małgosi złotówke, a za każdą reszkę odwrotnie. Napisz program "coin", który wykreśla oczekiwaną wygraną oraz dyspersję wygranej dowolnego gracza w funkcji liczby rzutów. Program zaznacza wartość oczekiwaną kropkami a dyspersję słupkami błędu.
    [EN] Hansel and Gretel toss the honest coin several times. Hansel gives Gretel a zloty for each eagle, and the other way round for each head. Write a program "coin" that plots the expected win and the dispersion of any player's win against the number of throws. The program marks the expected value with dots and the dispersion with error bars.

  • cube.py
    [PL] W sześcianie o boku jednostkowym rozmieszczamy losowo kilka punktów. Napisz program "cube", który wykreśla oczekiwaną średnią arytmetyczną odległości między tymi punktami oraz dyspersję średniej arytmetycznej w funkcji liczby punktów. Wartość oczekiwana zaznacza kropkami zaś dyspersję słupkami błędu.
    [EN] We place a few points randomly in a cube with a unit side. Write a program "cube" that plots the expected arithmetic mean of the distances between these points and the dispersion of the arithmetic mean as a function of the number of points. The expected value marks with dots and the dispersion with error bars.

  • mere.py
    [PL] Napisz program "mere", który wypisuje prawdopodobieństwo otrzymania przynajmniej jednej szóstki w czterech rzutach jedną kostką, prawdopodobienstwo otrzymania przynajmniej jednej podwójnej szóstki w dwudziestu czterech rzutach dwiema kostkami, oraz błędy oszacowania tych wielkości.
    [EN] Write a program "mere" that prints the probability of getting at least one six in four dice rolls, the probability of getting at least one double six in twenty-four throws with two dice, and the errors in estimating these amounts.

Releases

No releases published

Packages

 
 
 

Languages