1. http://www.dm.unibo.it/~lenci/teaching/14/maa/octavetut.pdf - Learnt basic syntax and their implementation
2. https://www.gnu.org/software/octave/doc/v4.0.1/Binary-I_002fO.html - Learnt how to write output into a text file
3. https://www.gnu.org/software/octave/doc/v4.0.0/Rearranging-Matrices.html - Learnt how to reshape matrix
4. https://www.gnu.org/software/octave/doc/v4.0.1/The-if-Statement.html - Learnt to use if statement
5. http://stackoverflow.com/questions/19387181/octave-mod-function-and-integer - Faced a problem in mod operator, so this answer on stack exchange on the default behavior of mod operator greatly helped in solving the problem.
6. https://en.wikibooks.org/wiki/Octave_Programming_Tutorial/Vectors_and_matrices - Extracting a sub-matrix of a matrix
7. http://pari.math.u-bordeaux.fr/archives/pari-users-0301/msg00002.html - Figured out how to find matrix inverse in mod 2
Reflection Essay:
A1, A2 involved solving non-linear equations. For solving the equations, we used fsolve function. We did face problems with that as fsolve spat out different solutions for slightly different starting estimates which is a normal thing, given that it employs numerical methods to solve the equations so different starting estimates may converge to a bit different answers. This is always going to be a drawback so it is good to have as good an estimate as possible
The Lights Out! puzzle is an extremely interesting problem and can involve further analysis regarding existence of solutions which is assumed in the problem given, and the number of solutiobs. B1, B2 involved solving a system of linear equations or in other words a matrix equation. Building the toggle matrix was pretty trivial. What took the most time was solving the equation in a finite field or mod 2 or Galois field(2). Some internet "research" showed that matrix inverse mod 2 can simply be obtained by multiplying the normal inverse with the determinant. This observation had been made by us already just by looking at the values the inv() function turned up with.
On a lighter note, this assignment though quite interesting took a toll on us in not being able to celebrate a friend's birthday :P It was Vishwajeet's birthday and we couldn't even get a birthday cake for him because we were all busy. He's gonna hold that against us for long...
B= [0 0 1;0 1 0;0 1 1;1 0 0;1 0 1;1 1 0;1 1 1]; % Matrix to check what the bottom row is
T= [0 1 1;1 1 1;1 0 0;1 1 0;1 0 1;0 0 1;0 1 0]; % The corresponding operations in the top row to be performed on the basis of the entries of the bottom row
We pledge on our honor that we have not received or given any unauthorised assistance in this assignment or any previous task.
Note:
Task B1: function lookup_solve_3 takes a single argument (a 3 × 3 matrix representing the initial state of the board) and outputs the action matrix.
Task B2: function final_state_3 takes as input two 3×3 matrix describing the initial state and the switches pressed, and outputs a 3×3 matrix representing the final state of the board.
Citations :
1. https://www.gnu.org/software/octave/doc/v4.0.0/Terminal-Input.html - Learnt how to take input from user
2. https://www.gnu.org/software/octave/doc/v4.0.0/Rearranging-Matrices.html - Learnt how to reshape matrix
3. http://www.dm.unibo.it/~lenci/teaching/14/maa/octavetut.pdf - Learnt basic syntax and their implementation
Reflection Essay:
Created different functions for improved readability
Octave does not support functions with arguments passed by reference so if we want to change the value of an argument passed, pass it also as output
Implemented the light chasing algorithm for solving 'Lights Out!' game
It was the first lab so it took some getting used to to this novel method of "googling" to learn everything in the code. We had to tweak the code quite a lot but finally it did work. We got it wrong with the physical equation as we assumed a different physical situation; that took a lot of time. We tried 'fsolve' in the beginning and then moved to 'fzero'. We also had to create a different file for the funtion definition.