In [2]:
%matplotlib inline
import numpy as np
import sympy as sp
import matplotlib.pyplot as plt

In [3]:
########## 2 ##########

In [4]:
a = np.cos(np.random.rand(1e5) * np.pi)
x = np.linspace(0, np.pi - 1e-2, 1e3)
b = 1 / (2 * np.pi * np.sin(x))
plt.plot(x, b, '.')
#plt.hist(a, bins=100)
plt.show()


/usr/local/lib/python3.5/dist-packages/ipykernel/__main__.py:1: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
  if __name__ == '__main__':
/usr/local/lib/python3.5/dist-packages/ipykernel/__main__.py:3: RuntimeWarning: divide by zero encountered in true_divide
  app.launch_new_instance()

In [ ]:


In [147]:
########## 3 ##########

In [ ]:


In [153]:
########## 4 ##########

In [154]:
########## 5 ##########
siz = 1e4
a = 1.60 + np.random.rand(siz) * 0.2
m = 50 + np.random.rand(siz) * 20
b = a / np.power(m, 1/3)
plt.hist(b, bins=40)
plt.show()


/usr/local/lib/python3.5/dist-packages/ipykernel/__main__.py:3: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
  app.launch_new_instance()
/usr/local/lib/python3.5/dist-packages/ipykernel/__main__.py:4: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future

In [ ]:
l = np.linspace(50*1.6, 70*1.8, siz)
z = a * m

In [39]:
#######3 6 #####3
f = 0.2
g = 0.9
h = 0.3
c = 0.25

t1 = f *g
t2 = (1-f)*h

c1 = t1*c
c2 = t2*c

cd = (c1/(c1+c2))

In [54]:
(c1 / (c1 + c2)) * f


Out[54]:
0.08571428571428573

In [55]:
pt = f * g + (1 - f) * h
pc = c * pt

In [72]:
(f * (c * f * g) + (1-f) * c * (1-f) * h)


Out[72]:
0.05700000000000001

In [68]:
(1-f) * c * (1-f) * h / pc


Out[68]:
0.4571428571428572

In [66]:
(c * f * g) / pc + c * (1-f) * h / pc


Out[66]:
1.0

In [74]:
(c * f * g) / pc + c * (1-f) * h / pc


Out[74]:
1.0

In [73]:
(1 - (1-f)) / (f - (1-f))


Out[73]:
-0.3333333333333332

In [ ]: