From a0d55f617f87618046bae343d39f9f5b9fa6347b Mon Sep 17 00:00:00 2001 From: dc97a6904245e0d07c1302ee90fceec3 Date: Wed, 18 Jun 2025 15:34:59 +0000 Subject: [PATCH] no commit message --- module2/exo1/toy_notebook_en.ipynb | 64 ------------------------------ 1 file changed, 64 deletions(-) diff --git a/module2/exo1/toy_notebook_en.ipynb b/module2/exo1/toy_notebook_en.ipynb index 87c2a9f..e0ba403 100644 --- a/module2/exo1/toy_notebook_en.ipynb +++ b/module2/exo1/toy_notebook_en.ipynb @@ -1,24 +1,5 @@ { "cells": [ - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# On the computation of $\\pi$" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "## Asking the maths library\n", - "My computer tells me that $\\pi$ is *approximatively*" - ] - }, { "cell_type": "code", "execution_count": 1, @@ -37,24 +18,6 @@ " print(pi)" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "## Buffon's needle" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "Applying the method of [Buffon's needle](https://en.wikipedia.org/wiki/Buffon%27s_needle_problem), we get the __approximation__" - ] - }, { "cell_type": "code", "execution_count": 2, @@ -80,24 +43,6 @@ " 2/(sum((x+np.sin(theta))>1)/N)" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "## Using a surface fraction argument" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "A method that is easier to understand and does not make use of the $\\sin$ function is based on the fact that if $X\\sim U(0,1)$ and $Y\\sim U(0,1)$, then $P[X^2+Y^2\\leq 1] = \\pi/4$ (see [\"Monte Carlo method\" on Wikipedia](https://en.wikipedia.org/wiki/Monte_Carlo_method)). The following code uses this approach:" - ] - }, { "cell_type": "code", "execution_count": 3, @@ -132,15 +77,6 @@ " ax.set_aspect('equal')" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "It is then straightforward to obtain a (not really good) approximation to $\\pi$ by counting how many times, on average, $X^2 + Y^2$ is smaller than 1:" - ] - }, { "cell_type": "code", "execution_count": 4, -- 2.18.1