-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtutorial1.py
More file actions
34 lines (31 loc) · 817 Bytes
/
tutorial1.py
File metadata and controls
34 lines (31 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import math
import numpy as np
from matplotlib import pyplot as plt
from scipy.stats import norm
s=np.linspace(0,20,20)
N=20
def likelihood(domain):
i=0
sum=0
while(i<N):
sum+=pow(s[i]-domain,2)
i=i+1
a=-0.5*sum-(N/2)*(math.log(2*3.14))
return a
b = np.vectorize(likelihood)
domain=np.linspace(0,20,20)
#required decoration
fig, ax = plt.subplots(nrows=1, ncols=1)
ax.set_xlabel('X-axis')
ax.set_ylabel('Y-axis')
ax.spines['bottom'].set_color('white')
ax.spines['left'].set_color('white')
ax.xaxis.label.set_color('white')
ax.tick_params(axis='x', colors='white')
ax.yaxis.label.set_color('white')
ax.tick_params(axis='y', colors='white')
ax.set_facecolor('xkcd:salmon')
ax.set_facecolor((0, 0, 0))
#end of decoration
plt.plot(domain,b(domain))
plt.plot(domain,b(domain),'go-')