Jump to content

Are arrays sort of like matrices?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
5 replies to this topic

#1
Sionofdarkness

Sionofdarkness

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 384 posts
I was looking at an array and it reminded me kind of a matrix. Are arrays a type of matrix? I was just thinking about it and wanted to know for sure.

#2
dirkfirst

dirkfirst

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 354 posts
Yup. Multi-dimensional arrays are even more like a matrix. To think of it in programming think about a chess board. Not sure how many squares are across or up or down but lets say 10.

You'd make an array like array[10][10] (not sure howto in Java as I don't know java) and each cell would represent a place on the board such as

A 1 2 3 4 5 6
B 1 2 3 4 5 6
C 1 2 3 4 5 6
D 1 2 3 4 5 6
E 1 2 3 4 5 6
...

Hence you would get your moves like A3 or E4. Sort of like a spreadsheet in excel.

#3
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Yes and no. An array is presented visually and referenced much like a matrix. However, it does not have any arithmetic operations, and the way it is stored in a computer's memory is usually as a line, regardless of the number of dimensions. An array can have far more than just 2 dimensions.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#4
Sionofdarkness

Sionofdarkness

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 384 posts
What does an array with more than two dimensions look like? I can't imagine how it could look with more than two.

#5
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
You can visuallize a 3d array as being a cube. Above 3 dimensions, it's hard to visuallize, but can be very useful. 4d could be thought of as having several Excel workbooks, each with multiple sheets and each sheet having the 2d grid of cells. 5d could be similar, but multiple computers of multiple workbooks.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#6
Sionofdarkness

Sionofdarkness

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 384 posts
Cool. I'm reviewing some Algebra II right now and I'll go over matrices again.