Update Día 1 PSANTACRUZ

parent 4515b9b7
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment