Once upon a time, there was a physicist. He was a good physicist, even thought he would have never agreed to that.

Our friend physicist encountered an interesting problem one day. This problem would take a whole page to describe, more than a whole hour to fully comprehend and it would bore you to tears. And this tale is not boring at all.

Instead we'll just get directly to the point. The physicist found a way of solving the problem but there was a big obstacle [1]: a system of 14 equations with 14 variables.

Now because our friend physicist was not just another physicist [2] he didn't dive into those equations without a second thought and spent next 3 to 5 hours trying to find some meaningful numbers that could be put in.

Instead, he thought for a moment and recalled that he had a friend who was a craftsman by trade. And his craft was computing.

His friend looked at the problem and said, "Hmm, this should not be that difficult. Gauss had already shown us the way of doing it. All we need is to get your equation into a matrix". The physicist obviously knew about the Gauss elimination method [3]. And without a doubt, he could have done it manually. But as everything that has some meaning in physics, he also wanted to stay at the lowest possible energy level.

The next step was to build a matrix of that system of 14 equations. The craftsman knew what their time was worth, so instead of transforming this system on the paper he opened up a spreadsheet editor on his machine, and rewrote the equations into cells and rows with physicist's help . The output matrix was separated by one empty cell.

So the system of equations was in matrix form. Now what? Both the physicist and the craftsman knew there were algorithms which could solve this system very easily. Implementing them would take hours and they needed the results in some kind of a nice format which would allow them to do additional computations with them. The craftsman knew what the answer was. It consisted of just three characters: CAS.

A long long time ago people were doing computations manually. It was
neither easy nor interesting but still very important task. So they used
created machines to help them with computations. These machines then proved
to be useful for lots of other stuff, people started to call them
*computers* in the meantime and their initial purpose started to vanish.
But there were still things that could help people with computations on
these machines. And these things are now better known as **C**omputer
**A**lgebra **S**ystems.

So much for historical bragging. Back to the story.

It is worth noting that both the physicist and the craftsman were just poor students and even though they realized the value of great software, they did not have money to spare for professional tools [4]. Moreover, the craftsman was involved in development of a simple open-source alternative and knew that it could solve their problem. So the answer was obvious:

After a brief quality assurance control [5], the craftsman exported the matrix into a CSV [6] file. The Mathics function the craftsman intended to use accepted two parameters: a matrix m and a vector b. In CAS a vector looks like this:

```
{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
```

and a matrix is just another way of saying 'many vectors stuck together' [7]. Our friends had the matrix and the vector in a CSV format. They needed the last column of each row (the b vector) and the input matrix itself (first 14 columns).

Without a second thought, the craftsman took his text-editing-katana called Vim and using two small upgrades and a few keystrokes they had the data in the desired format in less than a minute.

```
m = {{1,1,0,0,0,0,0,0,0,0,0,0,0,0},
{0,1,-1,-1,0,0,0,0,0,0,0,0,0,0},
{0,0,0,-1,1,1,0,0,0,0,0,0,0,0},
{-1,0,0,0,0,0,1,1,0,0,0,0,0,0},
{0,0,0,0,1,0,1,0,0,0,-1,0,0,0},
{0,0,0,0,0,0,0,0,0,0,-1,1,1,0},
{0,0,0,0,0,0,0,-1,1,1,0,0,0,0},
{0,0,0,0,0,0,0,0,0,1,0,0,1,-1},
{0,0,0,0,0,0,0,0,0,0,0,2,-2,-1},
{0,0,0,0,0,0,0,0,-2,2,0,0,0,1},
{0,0,0,0,0,0,1,-1,0,-1,1,0,1,0},
{0,0,0,0,-2,2,0,0,0,0,-2,-2,0,0},
{-1,1,0,1,1,0,-1,0,0,0,0,0,0,0},
{0,0,1,-2,0,-2,0,0,0,0,0,0,0,0}}
```

They then pugged the data into the LinearSolve function. The result was nice. It was a 14x1 vector. And they liked it.

```
LinearSolve[m, b]
```

Suddenly, the physicist said that he needed to double some of those values. The craftsman thought for a while and then stated the obvious: "Linear Algebra".

```
% * {2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1}
```

The result was, as expected, another nice 14x1 vector. Using linear algebra everything was now easy. So when the physicist said he needs to put every number in the vector to the second power the craftsman was on hype so his answer was:

```
% ^ 2
```

And when he said he needed to sum it all up it was obvious what to use: scalar product. He took the resulting vector and multiplied it by another 14x1 ones vector (a vector consisting of ones only).

```
% . {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
```

And then swapped those values in a truly mathematical fashion.

```
1/%
```

And the result was nice.

And they both liked it.

What is the moral of this story? There are three home take points. It depends on who you are:

**craftsmen**: You are only as sharp as your tools are. Make sure you- know them better than you think you do.

**physicists**: The difference between good and great often means having- friends who can help you with problems you don't have time to deal with.

**human being**: Learn more Linear algebra.

## Epilogue

The craftsman later discovered that this problem was from a set of problems at the Wopho competition. Among other things this means that the correct result was known and there was someone to correct the physicists solution.

The result the craftsman and the physicists computed was correct. However, the corrector noted that there was a 'neat trick' to it and that their solution was a brute force one.

Had the physicist found the trick, he would have missed the beauty of computation offered by linear algebra.

Also, since this was a competition there is one more thing to remember. There will be points awarded for a correct result, even if it was found using brute force methods. I am not sure if we can say the same about a solution which uses a neat trick but doesn't produce the right result.

[1] | Yes, that is right. A problem inside a problem is called an obstacle. |

[2] | Honestly, most of 'just another physicists' are just very dedicated sci-fi fans. |

[3] | Actually, he knew way more mathematics at that time than the craftsman ever would. |

[4] | Yes, there were student licenses for professional tools but even that kind of money was way too much for poor students from a poorish country. Using pirated version was also not an answer. They both believed that all the great things (such as physics, software or friends) should be free. |

[5] | Yes, old habits die hard. |

[6] | Even though I am not very excited about it you probably already met with these kind of files thanks to Excel-like spreadsheet editors. |

[7] | More specifically a matrix is a vector of vectors. |