-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathvideo29.py
More file actions
62 lines (36 loc) · 635 Bytes
/
Copy pathvideo29.py
File metadata and controls
62 lines (36 loc) · 635 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# -*- coding: utf-8 -*-
"""Video29.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1RF2DLb_vxLph8Z392NUUjSzkPv5d8UqD
"""
import numpy as np
x = np.array([1,2,3,4])
y = np.array([2,5,6,0])
x+y
x-y
x*y
x.dot(y)
r = np.array([[1,2,3],
[4,5, -7.6]])
r
x[1]
r[1,1]
x[1:3]
x[1:]
import matplotlib.pyplot as plt
x = np.array([1,6,7,8,9])
y = 2*x
z = 3*x - 1
m = 5*x - 1
plt.plot(x,m, c='blue')
plt.plot(x,z, c='red')
n = 100
x = np.linspace(0,10,n)
x
yp = 2*x
yp
y = 2*x + np.random.normal(0,1, size = n)
y
y - yp
plt.scatter(x,y)