A Color picture is worth 1000 words Dafna

  • Slides: 19
Download presentation
A Color (picture) is worth 1000 words Dafna Minster July 2012 1

A Color (picture) is worth 1000 words Dafna Minster July 2012 1

introduction Matrices have many uses in mathematics and computer science. Matrices allow storage of

introduction Matrices have many uses in mathematics and computer science. Matrices allow storage of large amount of information regarding variables and also allow methods that define operations upon themselves. Students who are learning the subject of matrices have some difficulties. One difficulty is: understanding the ways of scanning the matrix. The difficulty lies within the fact that a nested loop (loop inside a loop) is required. Other problems include scanning the matrix' diagonals and all items above/bellow the diagonals. One operation that is especially difficult is to transpose – to swap between rows and columns. This tip shows visual methods on how to scan a matrix step by step. The first part of the tip will shows the outer loop by coloring the rows, and the second part will describe the inner loop by using a different color. This tip will help teachers to better convey the subject matrices using a graphical approach. As said in the title: A Color (picture) is worth 1000 words. All rights reserved to Dafna Minster

Matrix - rows Start row for ( int i = 0 ; i <

Matrix - rows Start row for ( int i = 0 ; i < matrix. length ; i++ ) End row 3 All rights reserved to Dafna Minster

Matrix - columns Start column for ( int i = 0 ; i <

Matrix - columns Start column for ( int i = 0 ; i < matrix. length ; i++ ) for ( int j = 0 ; j < matrix[i]. length ; j++ ) command ( matrix [ i ] [ j ] ); End column 4 All rights reserved to Dafna Minster

Matrix – main diagonal for ( int i = 0 ; i < matrix.

Matrix – main diagonal for ( int i = 0 ; i < matrix. length ; i++ ) command ( matrix [ i ] ) ; 5 All rights reserved to Dafna Minster

Matrix – secondary diagonal for ( int i = 0 ; i < matrix.

Matrix – secondary diagonal for ( int i = 0 ; i < matrix. length ; i++ ) command(matrix[i] [matrix. length-1 -i]); 6 All rights reserved to Dafna Minster

Matrix – above main diagonal j=i j = i +1 j = i -1

Matrix – above main diagonal j=i j = i +1 j = i -1 7 All rights reserved to Dafna Minster

Matrix – above main diagonal j=i j = i -1 j = i +1

Matrix – above main diagonal j=i j = i -1 j = i +1 Start row for ( int i = 0 ; i < matrix. length - 1 ; i++ ) End row 8 All rights reserved to Dafna Minster

Matrix – above main diagonal j=i j = i -1 j = i +1

Matrix – above main diagonal j=i j = i -1 j = i +1 Start column for ( int i = 0 ; i < matrix. length - 1 ; i++ ) for ( int j = i +1 ; j < matrix[i]. length ; j++ ) command ( matrix [ i ] [ j ] ); 9 End column

Matrix – Below main diagonal j=i j = i +1 j = i -1

Matrix – Below main diagonal j=i j = i +1 j = i -1 10 All rights reserved to Dafna Minster

Matrix – Below main diagonal j=i j = i +1 j = i -1

Matrix – Below main diagonal j=i j = i +1 j = i -1 Start row for ( int i = 1 ; i < matrix. length ; i++ ) End row 11

Matrix – Below main diagonal j=i j = i -1 j = i +1

Matrix – Below main diagonal j=i j = i -1 j = i +1 End column for ( int i = 1 ; i < matrix. length ; i++ ) for ( int j = 0 ; j < i ; j++ ) command ( matrix [ i ] [ j ] ) ; Start column 12

Matrix – above secondary diagonal j = matrix[i]. length - 2 - i j

Matrix – above secondary diagonal j = matrix[i]. length - 2 - i j = matrix[i]. length - 1 - i j = matrix[i]. length - i 13 All rights reserved to Dafna Minster

Matrix – above secondary diagonal j = matrix[i]. length - 2 - i j

Matrix – above secondary diagonal j = matrix[i]. length - 2 - i j = matrix[i]. length - 1 - i Start row for ( int i = 0 ; i < matrix. length - 1 ; i++ ) End row 14 All rights reserved to Dafna Minster

Matrix – above secondary diagonal j = matrix[i]. length - 2 - i j

Matrix – above secondary diagonal j = matrix[i]. length - 2 - i j = matrix[i]. length - 1 - i End column for ( int i = 0 ; i < matrix. length - 1 ; i++ ) for ( int j = 0; j < matrix[i]. length - 1 - i ; j++) command (matrix[i] j]); Start column 15

Matrix – Below secondary diagonal j = matrix[i]. length - 2 - i j

Matrix – Below secondary diagonal j = matrix[i]. length - 2 - i j = matrix[i]. length - 1 - i j = matrix[i]. length - i 16 All rights reserved to Dafna Minster

Matrix – below secondary diagonal j = matrix[i]. length - 1 - i j

Matrix – below secondary diagonal j = matrix[i]. length - 1 - i j = matrix[i]. length - i Start row for ( int i = 1 ; i < matrix. length ; i++ ) End row 17 All rights reserved to Dafna Minster

Matrix – above secondary diagonal j = matrix[i]. length - 1 - i j

Matrix – above secondary diagonal j = matrix[i]. length - 1 - i j = matrix[i]. length - i Start column for ( int i = 1 ; i < matrix. length ; i++ ) for ( int j = matrix[i]. length - i ; j < matrix[i]. length ; j++) command (matrix[ i ] [ j ]); 18 End column

The end Dafna Minster July 2012 All rights reserved to Dafna Minster

The end Dafna Minster July 2012 All rights reserved to Dafna Minster