<jupyter_start><jupyter_text>Midterm Exam<jupyter_code>#1 Create a Python code that displays a square matrix whose length is 5.
import numpy as np
A = np.array([[11,12,13,14,15],[16,17,18,19,20],[21,22,23,24,25],[26,27,28,29,30],[31,32,33,34,35]])
print(A)

#2 Create a Python code that displays a square matrix whose elements below the principal diagonal are zero.
A = np.array([[1,2,3],[0,1,2],[0,0,3]])
print(A)
#3 Create a Python code that displays a square matrix which is symmetrical.
#display original matrix
A = np.array([[5,3,5],[1,3,2],[5,2,6]])
print(A)

#display transposed matrix
print(np.transpose(A))

print("\n Question 4")

B = np.array([[1,2,3],[2,3,3],[3,4,-2]])
print (B)
inv_A=np.linalg.inv(B)

#4 What is the inverse of matrix C? Show your solution by python coding.
A = np.array([[1,2,3],[2,3,3],[3,4,-2]])

#solution
print(np.linalg.inv(A))
#5 What is the determinant of the given matrix in Question 4? Show your solution by python coding.
A = np.array([[1,2,3],[2,3,3],[3,4,-2]])

#display
print("Numpy matrix is")
print(A)

#solution
determinant = np.linalg.det(A)

#display
print("\nthe determinant:")
print(int(determinant))

#6 Find the roots of the linear equations by showing its python codes.
X = np.array([[5,4,1],[10,9,4],[10,13,15]])
print(X)

#inverse for x
inv_X = np.linalg.inv(X)
print(inv_X)

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

#solution for the roots
#AA^-1x = B.A^-1

Z = np.dot(inv_X,Y)
print(Z)<jupyter_output>[[ 5  4  1]
 [10  9  4]
 [10 13 15]]
[[ 5.53333333 -3.13333333  0.46666667]
 [-7.33333333  4.33333333 -0.66666667]
 [ 2.66666667 -1.66666667  0.33333333]]
[[ 3.4]
 [ 8.8]
 [19.2]]
[[0.2]
 [0.4]
 [0.8]]
{'fraction_non_alphanumeric': 0.2018018018018018, 'fraction_numerical': 0.13993993993993994, 'mean_word_length': 4.9288256227758005, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 8, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '566489', 'license': 'Apache-2.0', 'n_tokens_mistral': 839, 'n_tokens_neox': 723, 'n_words': 182, 'path': 'Midterm_Exam.ipynb', 'repo_name': 'Francesca2020-eng/Linear-Algebra-58020', 'size': '1665'}