Linear Algebra with Sage
<Vectors>
Made by SKKU Linear Algebra Lab (2011)
Define a vector @@ \textbf{v}_1 @@(벡터 @@ \textbf{v}_1 @@생성 및 확인)
v1 = vector([1,2]); v1 |
(1, 2)
Find 0.5 @@\textbf{v}_1@@ (스칼라 배)
print 0.5*v1 show(plot(v1, color="blue")+plot(1/2*v1, color="green"), aspect_ratio=1) |
(0.5, 1)
Define a vector @@\textbf{v}_2@@ (벡터 @@\textbf{v}_2@@ 생성 및 확인)
v2=vector([3,1]); v2 |
(3, 1)
Find @@\textbf{v}_1 + \textbf{v}_2@@ (두 벡터의 합)
print v1+v2 show(plot(v1, color="blue")+plot(v2, color="red")+plot(v1+v2, color="purple"), aspect_ratio=1) |
(4, 3)
Find @@\textbf{v}_1 - \textbf{v}_2@@ (두 벡터의 차)
print v1-v2 show(plot(v1, color="blue")+plot(v2, color="red")+plot(v1-v2, color="purple"), aspect_ratio=1) |
(-2, 1)
Find @@\textbf{v}_1 \cdot \textbf{v}_2@@ (두 벡터의 내적)
v1.dot_product(v2) |
5
Find @@ || \textbf{v}_1 ||@@ (벡터의 크기)
v1.norm() |
sqrt(5)