<jupyter_start><jupyter_text>Solving Systems of Linear Equations  A notebook detailing codes for solving a system of linear equations using the Gaussian Elimination Method:<jupyter_code>def Gaussian(M):
    # eliminate columns
    for i in range(len(M[0])):
        for j in range(i+1, len(M)):
            r = [(jValue * (-(M[j][i] / M[i][i]))) for jValue in M[i]]
            M[j] = [sum(pair) for pair in zip(M[j], r)]
    # backsolve by substitution
    ans = []
    M.reverse() # makes it easier to backsolve
    for sol in range(len(M)):
            if sol == 0:
                ans.append(M[sol][-1] / M[sol][-2])
            else:
                inner = 0
                # substitute in all known coefficients
                for x in range(sol):
                    inner += (ans[x]*M[sol][-2-x])
                # the equation is now reduced to ax + b = c form
                # solve with (c - b) / a
                ans.append((M[sol][-1]-inner)/M[sol][-sol-2])
    ans.reverse()
    return ans<jupyter_output><empty_output><jupyter_text>Given:\begin{equation}2x+y+z = 1 \\6x+2y+z = -1 \\-2+2y+z = 7\end{equation}<jupyter_code>M = [[2, 1, 1, 1],
     [6, 2, 1, -1],
     [-2, 2, 1, 7]]
Mans = Gaussian(M)
print 'x = %i' %Mans[0]
print 'y = %i' %Mans[1]
print 'z = %i' %Mans[2]<jupyter_output>x = -1
y = 2
z = 1
{'fraction_non_alphanumeric': 0.16540785498489427, 'fraction_numerical': 0.026435045317220542, 'mean_word_length': 2.1030444964871196, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '68444', 'license': 'MIT', 'n_tokens_mistral': 512, 'n_tokens_neox': 481, 'n_words': 136, 'path': 'Numerical Method Codes/Gaussian Elimination Method.ipynb', 'repo_name': 'lindleezy/Numerical-Methods', 'size': '1324'}