# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     name: python3
# ---

# + [markdown] id="view-in-github" colab_type="text"
# <a href="https://colab.research.google.com/github/MichaelSumagui/Linear-Algebra-58020/blob/main/Python_Exercise_2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>

# + [markdown] id="7P_ERPToLUi2"
# Vector Space Operations

# + colab={"base_uri": "https://localhost:8080/"} id="Q3n1y3yDKrDu" outputId="13c7337c-7f33-4953-efcd-f47c7955d63e"
import numpy as np
A = np.array ([4,3])
B = np.array ([2,-5])

print('Vector A is', A)
print('Vector B is', B)

# + colab={"base_uri": "https://localhost:8080/"} id="s5xRDmVTS_-j" outputId="bdf90bfe-f550-44b1-8ad3-2ff520093b9e"
import numpy as np
ball1 = np.array ([1,2,3])
ball2 = np.array ([0,1,-1])
pool = np.array ([ball1,ball2])
pool.shape

# + colab={"base_uri": "https://localhost:8080/"} id="8NjOdifnTFQD" outputId="b09c7353-fe15-47d8-9f37-b537cb55a83c"
import numpy as np
ball1 = np.array ([1,2,3])
ball2 = np.array ([0,1,-1])
pool = np.array ([ball1,ball2])
print(pool.shape)
print(pool.size)

# + colab={"base_uri": "https://localhost:8080/"} id="akgGG6w7THrr" outputId="8b54cd85-6df1-40d9-da58-2d4c61409186"
import numpy as np
ball1 = np.array ([1,2,3])
ball2 = np.array ([0,1,-1])
pool = np.array ([ball1,ball2])
pool.shape
pool.ndim

# + [markdown] id="tcbN7mppTRIH"
# Vector Addition
#

# + colab={"base_uri": "https://localhost:8080/"} id="eLfRihJlTTYb" outputId="967169a2-ea95-42f7-e272-fe37928f2e54"
import numpy as np
A = np.array ([4,3])
B = np.array ([2,-5])

print('Vector A is', A)
print('Vector B is', B)

# + colab={"base_uri": "https://localhost:8080/"} id="W0bn7uuFTWWs" outputId="9d0b5edf-e96b-4255-bc8d-1dd05c4fa846"
R = np.add(A,B)
R

# + [markdown] id="t0DXA876TggD"
# Vector Subtraction

# + colab={"base_uri": "https://localhost:8080/"} id="s1AJoVwXTdLy" outputId="9066d9fd-1d5a-47a7-a174-66bdf029e1d9"
import numpy as np
A = np.array ([4,3])
B = np.array ([2,-5])

print('Vector A is', A)
print('Vector B is', B)

# + colab={"base_uri": "https://localhost:8080/"} id="16J7skjUTkvb" outputId="84ac00e5-1089-4b09-a9c7-6476a8600aac"
R = np.subtract(A,B)
R

# + [markdown] id="btvoW8s1ToZy"
# Vector Scaling

# + colab={"base_uri": "https://localhost:8080/"} id="IG37IIpJTqgL" outputId="117aad77-2f6d-45f0-b9e6-15c4eee9c253"
A = np.array([1,5,8,9])
S = 5*A
S

# + colab={"base_uri": "https://localhost:8080/"} id="Y3Y8MnAmTs-U" outputId="734ce588-74dd-480a-e3bb-f1f7368c485a"
A = np.array([1,5,8,9])
S = np.multiply(5,A)
S

# + [markdown] id="eZMVXp2XTusL"
# Vector Cross Product

# + colab={"base_uri": "https://localhost:8080/"} id="QnW8hAuVTxQn" outputId="5cf91521-8a2a-45aa-beb9-ecb1a168d494"
import numpy as np

A = np.array([2,3])
B = np.array([1,7])

output = np.cross(A,B)
print(output)

# + colab={"base_uri": "https://localhost:8080/"} id="b1Uq40IlT8sU" outputId="81b0cf37-658a-4f34-cad0-12b61ed226b7"
A = np.array([2,3])
B = np.array([1,7])

cross = np.cross(A,B)
print(cross)

# + colab={"base_uri": "https://localhost:8080/"} id="Ao2bze1BT-sy" outputId="27713fff-92f9-4bb1-8181-8c010deb26b0"
A = np.array([2,3,4])
B = np.array([1,7,0])

cross = np.cross(A,B)
print(cross)

StarcoderdataJupyterScriptsDedupFiltered