Tag Archives: Excel

Doing matrix multiplication in TI Nspire and Excel

In TI Nspire, matrix multiplication can be accomplished in the Calculator page. The process is intuitive and easy with the visual templates.

Firstly use the matrix template to define one:
matrixnspire1matrixnspire2

Then simply do multiplication after filling in the matrix elements.
matrixnspire4

Doing so in Excel required the use of the MMULT() function. A little trick is needed for this function for returning answer in array format – by pressing CTRL+SHIFT+ENTER at the same time after inputting the function for the cells selected as output array.

First step, fill in the matrix with the elements into respective cells.
matrixexcel1

Mark the output region to use the array function. In this example it is also a 3×3 matrix.
matrixexcel2

Apply the MMULT() function on the upper left corner cell of the region selected.
matrixexcel3

The trick is here, when finished typing in the function, press CTRL+SHIFT+ENTER instead of just ENTER. The answer from the function will then be populated in the selected cells, and the formula will be displayed with curly brackets enclosed, like  {=MMULT(B2:D4,F2:H4)}.matrixexcel4

Advertisements

Solving a primary school math problem with Excel Solver

Since the last installment with a controversial primary school mathematical question, another interesting but no less challenging question is being popularized recently on local social media. The question involved finding the value of 9 single digit variables, namely A to H and P, that will fulfill the following simple calculation, where A to H are all of different values, and

primarydifficultexcel6

As reported in local newspaper, this question originated from a primary school for provoking student’s mathematical thinking and is not in standard syllabus. Yet it is challenging even for university graduates.

It is not the intention here to discuss the pedagogy of this problem, but only to explore solving this interesting problem using Excel without any programming.

The Excel Solver is able to solve this question by modelling it into constraints. Usually for Solver problems the variables are modeled in single cell values, but since this question mandated some intrinsic properties that are not easy to be defined in the Solver dialog, a special matrix is used instead of single cell value like in the below so that constraint of each variable carries different value can be defined.primarydifficultexcel1

The various constraints are modeled in the Solver dialog. Each sum of row must be one implies only one digit is selected for each run for A to H. Likewise each sum of column must be equal or less than one implies no duplicate digits for each run. Integer constraint is also applied. The target cell containing the equation of PPP – (AB – CD + GH) is set to zero. Simplex-LP method is selected for this problem, while it was believed that evolutionary methods better suit the model as the matrix has high resemblance of genes.
primarydifficultexcel2

Running the Excel Solver to obtain the result. On an Intel Core i5 it took almost 2 seconds!
primarydifficultexcel3

A more descriptive diagram showing the relationship between cells that the model is comprised of. The column next to the Sum of row one are sumproduct cells that will naturally return the values represented by each variable according to the selected single digit value.
primarydifficultexcel9

primarydifficultexcel8

Excel file download

The Excel Solver is not just versatile but also is fun in itself to work with tricky problem like this “primary school” question.

How old are they?

On a local newspaper yesterday, this question is reported to be controversial for primary school examination since it is too difficult. It goes like this. There are two people and the older one said:

“When I was at your age, you were only 5.
When you become as old as I am now, I will become 71.”
The question is, how old are these two people?

It turns out, according to the newspaper, the question is not aimed at simultaneous equation at all, but to solve the problem by graphically dividing lines in proportion.

To solve in an overkill fashion by Nspire:
agequestion1

And this is also a refresher on how to solve simultaneous equations on TI-84 series using the rref function (reduced row echelon form). Define the equations in form of matrix (as [A] below), and then run the rref() function on it. The result matrix contained the solution to the problem.
agequestion2agequestion3

And just in case Excel is the only tool available, no worry, its solver will get you covered (!).agequestion4