summaryrefslogtreecommitdiff
path: root/posts/linear_system_solver.html~
blob: a280a8bd1c040713e557174263e2ccbba941531e (plain)
1
2
3
4
5
6
7
8
9
10
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77

<h2>Linear Systems Solver</h2>
<h3>2021-08-01 by Matthew Kosarek</h3>
<p>
  I wanted to write a little algorithm to visually solve linear systems of equations for fun. I am only going to deal with 3x3 matrices for now, but I'll make it so that I can easily extend it to more matrices in the future if I think that would be cool.

  <br/><br/>

  <div id='equation_container'>
    <div id='matrix_lhs'></div>
    <label>&times;</label>
    <div id='unknown_variables'></div>
    <label>=</label>
    <div id='matrix_rhs'></div>
  </div>
  
  <div id='solution_container'>
  </div>

  <div id='actions_container'>
    <button class='action_button'id='reset_button'>
      Reset
    </button>
    <button class='action_button' id='solve_button'>
      Solve
    </button>
  </div>
  
  <script src='/posts/linear_system_solver.js'></script>

  <style>
    #equation_container {
        display: flex;
        flex-direction: row;
        align-items: center;
        width: 100%;
        justify-content: center;
    }

    #equation_container input {
        width: 128px;
    }

    #equation_container > label {
        padding: 1rem;
    }

    #matrix_lhs {
        display: grid;
        grid-gap: 1rem;
        grid-template-columns: repeat(3, 1fr);
    }

    #unknown_variables {
        display: grid;
        grid-gap: 1rem;
    }

    #unknown_variables > input {
        text-align: center;
    }

    #matrix_rhs {
        display: grid;
        grid-gap: 1rem;
    }

    #actions_container {
        padding: 1rem;
        text-align: center;
    }

    #solve_button {
        background-color: lightgreen;
    }
  </style>
</p>