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

# + [markdown] id="IuY4NLLnG9qg"
# ##Final Exam

# + id="rsgVdfa5K0B3"
import numpy as np
from numpy.linalg import eig

# + [markdown] id="t-tpyF9gHCY1"
# ##Problem 1 
#
# ##Student A, Student B, and Student C have a total of Php 89 cash in their banks. Student A has 6 less than Student C. Student B has 3 times what Student C has. How much does each student have? 

# + colab={"base_uri": "https://localhost:8080/"} id="RYxRRplDG8nF" outputId="0d5d22df-18ca-4a85-8437-3841810b6734"
Stu1 = np.array([[1,1,1],[1,0,4],[0,0,5]])
Stu2 = np.array([[89],[89],[95]])

T = np.linalg.inv(Stu1).dot(Stu2)
print(T)

# + [markdown] id="nhb3Oy0aH4R0"
# ##Problem 2
#
# ##Solve each system: (30 points)
#
# 3x - y + z = 5
#
# 9x - 3y +3z = 15
#
# -12x +4y -4z = -20 

# + [markdown] id="pp5I9mb5ZSnq"
# ##Answer
# The matrix is singular, we cannot somehow inverse it but we can use pinv to see the output and the results.

# + [markdown] id="Q_NKM1KAIB2y"
# ##Problem 3 Consider the matrix, (40 points)
#
# 1. Find the eigenvalue/s
# 2. Find the eigenvectors
#

# + colab={"base_uri": "https://localhost:8080/"} id="fVH4ELUaIKqb" outputId="75822a5f-0fe5-4a5b-e1c0-58e62212bf7c"
z=np.array ([[8,5,-6],[-12,-9,-12],[-3,-3,5]]) #Create an array from the given
print(z)

b,c= np.linalg.eig(z)   #This syntax shows how to find the eigenvalues and vectors
print ("The eigenvalue/s is/are:",b)

# + colab={"base_uri": "https://localhost:8080/"} id="LZUiCumrM9DK" outputId="163ca801-8cf2-4e36-aee5-c8276dc97c61"
print ("The eigenvectors are:",c)

StarcoderdataJupyterScriptsDedupFiltered