# ---
# 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/amnbg/Linear-Algebra-58020/blob/main/Applications_of_Linear_Systems.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>

# + [markdown] id="XYM0jrqyZhPS"
# # Systems of Linear Equations

# + [markdown] id="d9aKHutOaHjR"
# # Systems of Linear Equations can be solved with arrays and NumPy.

# + colab={"base_uri": "https://localhost:8080/"} id="I_Kw78nmaQJ5" outputId="36d1c71d-6992-41fe-bbe2-1f818736c436"
from scipy.linalg import solve

A = np.array([[4,5],[3,-2]])
print(A)
B = np.array([[7],[11]])
print(B)

inv_A = np.linalg.inv(A)
print(inv_A)
X = np.linalg.inv(A).dot(B)
print(X)

# + colab={"base_uri": "https://localhost:8080/"} id="aIs14PuNb0Bo" outputId="17ccc724-d347-4262-bc94-1eb0eba9983a"
inv_A = np.linalg.inv(A)
print(inv_A)
X = np.dot(inv_A,B)
print(X)

# + colab={"base_uri": "https://localhost:8080/"} id="lVMYvjwkct2Z" outputId="f918ca7a-4036-44ab-e0ca-4124892c8d8e"
X = np.linalg.solve(A,B)
print(X)

# + colab={"base_uri": "https://localhost:8080/"} id="cF-7_9M8d_NI" outputId="3da68f43-f99c-4c7d-c417-e10be665faaa"
from scipy.linalg import solve
X = solve(A,B)
print(X)

StarcoderdataJupyterScriptsDedupFiltered