From 4d302edd8bb66524e2c0c96ced68f56a324501cb Mon Sep 17 00:00:00 2001 From: d932cd8408420be151b222f5aab7b293 Date: Fri, 16 Dec 2022 00:38:47 +0000 Subject: [PATCH] =?UTF-8?q?Update=20D=C3=ADa=201=20PSANTACRUZ?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "D\303\255a 1 PSANTACRUZ" | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git "a/D\303\255a 1 PSANTACRUZ" "b/D\303\255a 1 PSANTACRUZ" index 2033650..1cc73f3 100644 --- "a/D\303\255a 1 PSANTACRUZ" +++ "b/D\303\255a 1 PSANTACRUZ" @@ -3,4 +3,31 @@ - Los datos son colocados como comandos. -Con el tiempo se va acostumbrando al uso de esos datos. * Ahora es más difícil prque debo cambiar los nombres y códigos - * Se debe conocer los códigos para poder analizar los datos. \ No newline at end of file + * Se debe conocer los códigos para poder analizar los datos. + + *PI + *In [1]: from math import * +print(pi) +3.141592653589793 + +*In [2]: import numpy as np +np.random.seed(seed=42) +N = 10000 +x = np.random.uniform(size=N, low=0, high=1) +theta = np.random.uniform(size=N, low=0, high=pi/2) +2/(sum((x+np.sin(theta))>1)/N) +Out[2]: 3.1289111389236548 + +*In [3]: %matplotlib inline +import matplotlib.pyplot as plt +np.random.seed(seed=42) +N = 1000 +x = np.random.uniform(size=N, low=0, high=1) +y = np.random.uniform(size=N, low=0, high=1) +1 +accept = (x*x+y*y) <= 1 +reject = np.logical_not(accept) +fig, ax = plt.subplots(1) +ax.scatter(x[accept], y[accept], c='b', alpha=0.2, edgecolor=None) +ax.scatter(x[reject], y[reject], c='r', alpha=0.2, edgecolor=None) +ax.set_aspect('equal') \ No newline at end of file -- 2.18.1