<jupyter_start><jupyter_text>Question 1. Create a Python code that displays a square matrix whose length is 5<jupyter_code>import numpy as np #import Library
#A square matrix has the same length and breadth, it is a 5x5 matrix.

SquareMatrix = np.array ([[1,2,3,4,5],[2,0,0,0,0],[3,0,0,0,0],[4,0,0,0,0],[5,0,0,0,0]]) #5x5 matrix

print("This is an example of square matrix whose length is 5")
print() #this is for spacing and also optional
print(SquareMatrix)<jupyter_output>This is an example of square matrix whose length is 5

[[1 2 3 4 5]
 [2 0 0 0 0]
 [3 0 0 0 0]
 [4 0 0 0 0]
 [5 0 0 0 0]]<jupyter_text>Question 2. Create a Python code that displays a square matrix whose elements below the principal diagonal are zero<jupyter_code>import numpy as np
C = np.triu([[1,2,3],[2,4,6],[3,6,9,]])
print(C)<jupyter_output>[[1 2 3]
 [0 4 6]
 [0 0 9]]<jupyter_text>Question 3. Create a Python code that displays a square matrix which is symmetrical<jupyter_code>import numpy as np
square_matrix = np.array([[1,2,3,4,5],[2,1,2,3,4],[3,2,1,2,3],[4,3,2,1,2],[5,4,3,2,1]]) #Creation of a 5x5 matrix named as square matrix
print('A square matrix which is symmetrical: ') #Text message indicating the result
print(square_matrix) #Displays the final output<jupyter_output>A square matrix which is symmetrical: 
[[1 2 3 4 5]
 [2 1 2 3 4]
 [3 2 1 2 3]
 [4 3 2 1 2]
 [5 4 3 2 1]]<jupyter_text>Question 4. What is the inverse of matrix C? Show your solution by python coding.<jupyter_code>import numpy as np
C = np.array ([[1,2,3],[2,3,3],[3,4,-2]]) #The matrix of C

invC = np.linalg.inv(C)

print("Inverse of Matrix C:")
print(invC) #print the inverse of C<jupyter_output>Inverse of Matrix C:
[[-3.6  3.2 -0.6]
 [ 2.6 -2.2  0.6]
 [-0.2  0.4 -0.2]]<jupyter_text>Question 5. What is the determinant of the given matrix in Question 4? Show your solution by python coding.<jupyter_code>import numpy as np
C = np.array ([[1,2,3],[2,3,3],[3,4,-2]])

detOfC = np.linalg.det(C)

print("The determinant of the given matrix in Question 4:")
print(int(detOfC)) #print the determinant of C<jupyter_output>The determinant of the given matrix in Question 4:
5<jupyter_text>Question 6. Find the roots of the linear equations by showing its python codes<jupyter_code>import numpy as np
eq = np.array([[5,4,1],[10,9,4],[10,13,15]])

const = np.array([[[3.4],[8.8],[19.2]]])

roots = np.linalg.inv(eq) @ const

print("Roots of the given linear equations:")
print(roots)<jupyter_output>Roots of the given linear equations:
[[[0.2]
  [0.4]
  [0.8]]]
{'fraction_non_alphanumeric': 0.1466030989272944, 'fraction_numerical': 0.07906237584425904, 'mean_word_length': 4.966824644549763, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '353392', 'license': 'Apache-2.0', 'n_tokens_mistral': 1065, 'n_tokens_neox': 968, 'n_words': 335, 'path': 'Midterm_Exam.ipynb', 'repo_name': 'MishcaGestoso/Linear-Algebra-58019', 'size': '2517'}