In my last article, I touched upon the concept of linear transformation when explaining the concept of eigen vectors and eigen values. The core of linear transform is matrix multiplications. The article is here: Eigen Values and Eigen Vectors: Visually Explained!
So today, I am announcing a contest for anyone with an access to a computer and a programming language installed in it to try out. This coding competition is very easy to be honest. I am making this very easy so that most people can participate in it.
Problem to be solved
Consider a 2D set of XY coordinate points. Like say numbers -10 to 10(with a suitable resolution of your choice) in X and Y dimensions. Now this XY coordinate set will be your input data. Now define a 2 X 2 matrix which I will call A. Say A =[1 0.5; 0.5 1].
A=
1 0.5
0.5 1
Apply this matrix A on the input 2D coordinates. This is the linear transformation here. This is simply a matrix multiplication of matrix A on each coordinate. Like illustrated below:
What you will be doing is performing these multiplications(efficiently) to each coordinate in the input 2D space to get the set of transformed output 2D space. And then you should plot your input versus output. Also, you may want to superimpose the eigen vectors weighted with eigen values onto your transformed space in visualization. If you have doubts about that, read my previous post here.
This wikipedia article has lot of examples. Also this video by 3blue1brown of youtube has one of the most beautiful illustrations regarding linear transformations:
Task
Write your own code (by making it more general and fancy) in any programming language. It would be easier if you use any of the coding languages mentioned below:
- Python
- Matlab
- Julia
- Mathematica
But in case you want to use something else that too is fine.
And post your code and results as comments to this post. Make it as fancy as possible. You may want to superimpose the eigen vectors weighted with eigen values on the transformed space. If you want to create gif animations or videos which can illustrate this concept best, it would be great! You can also use any online coding services like repl.it etc for doing your coding.
Sample Code (Updated!)
I will post a very basic Matlab code in coming days, if people here struggle to come up with even basic solutions. This will help people who are not familiar with programming to participate in the contest. The link below:
The input and output of the code is given below:
Input
Output
The transformation matrix considered is
A=
1 0.5
0.5 1
Grading Policy (Total: 7 points)
Elegant and readable code(with comments etc): maximum 2.5 points
Beautiful visualizations(figures): maximum 2.5 points
For those who do gifs/animations: maximum 2 points
The prize
There will be 5 winners.
First prize: 8 SBD
Second prize: 6 SBD
And the next three accounts will get 2 SBD each.
If the entries are less than 5, I will divide the remaining total prize money among people who attempted. If any ties happen, I will consider who posted first in deciding the winners.
Deadline: April 12th (updating the extension from April 8th)
STATUS: OPEN
Minor changes in the contest rules like deadline extension can happen.
Acknowledgement
I thank @reggaemuffin for explaining things to me regarding how a programming contest should be done. And he is sponsoring half the prize money! Thanks @reggaemuffin ! I want to thank @suesa too for directing me towards @reggaemuffin for guidance.
So let the contest begin!
References [Books for further reading]
[1]: Introduction to Linear Algebra, Fifth Edition (2016) by Gilbert Strang
[2]: Coding The Matrix: Linear Algebra Through Computer Science Applications by Philip N. Klein
If you like this post, please upvote and resteem it.
Below is my recent posts, you may find it interesting:
Eigen Values and Eigen Vectors: Visually Explained!
A google trends analysis on "COW": India versus Pakistan
Join #steemSTEM
Join the active science community #steemSTEM at discord: https://discord.gg/BZXkmWw
And to steemSTEM beginners:
You can ask for help in our discord page. There are people ready to help you there.
All images without image sources are my creations :)
Follow me @dexterdev
____ _______ ______ _________ ____ ______
/ _ / __\ \//__ __/ __/ __/ _ / __/ \ |\
| | \| \ \ / / \ | \ | \/| | \| \ | | //
| |_/| /_ / \ | | | /_| | |_/| /_| \//
\____\____/__/\\ \_/ \____\_/\_\____\____\__/