-
Notifications
You must be signed in to change notification settings - Fork 0
/
exam5.py
47 lines (35 loc) · 836 Bytes
/
exam5.py
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
# To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'
# %%
import numpy as np
P = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
print(P)
# %%
# X coordination shifting
#s = np.array([[0,0], [0,0], [0,0]])
P = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
s = np.full((3, 2), 0)
P[:, 0:2] = s
print(P)
# %%
# Y coordination shifting
#s = np.array([[0, 0, 0], [0, 0, 0]])
P = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
s = np.full((2, 3), 0)
P[0:2, :] = s
print(P)
# %%
# -X coordination shifting
#s = np.array([[0,0], [0,0], [0,0]])
P = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
s = np.full((3, 2), 0)
P[:, -2:] = s
print(P)
# %%
# -Y coordination shifting
#s = np.array([[0, 0, 0], [0, 0, 0]])
P = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
s = np.full((2, 3), 0)
P[-2:, :] = s
print(P)
# %%