4.1.1. Basic Operations
>>> np.array( [1, 2, 3] ) #1차 배열 (벡터) 생성
>>> np.array( [ [1, 2, 3], [4, 5, 6] ) # 2x3 크기의 2차원 배열 (행렬) 생성c = np.linspace(0, 1, 6) # start, end, num-points
d = np.linspace(0, 1, 5, endpoint=False)c= [0. 0.2 0.4 0.6 0.8 1. ]
d= [0. 0.2 0.4 0.6 0.8]import numpy as np
a = np.array( [20,30,40,50] )
b = np.arange( 4 )
print("배열 a", a)
print("arrange로 생성한 b",b)
c = a-b
print("c=a-b 의 결과값",c)
print("b**2 의 결과값",b**2)
print("a의 sine값 * 10 의 결과값",10*np.sin(a))
print("a가 35보다 작은지에 대한 비교 결과",a<35)
AA = np.array( [[1,1],
[0,1]] )
BB = np.array( [[2,0],
[3,4]] )
print("AA * BB 의 결과값\n",AA * BB)
print("AA @ BB 의 결과값\n",AA @ BB)
print("AA.dot(BB) 의 결과값\n",AA.dot(BB))Last updated
Was this helpful?