Working with matrices

Working with matrices

The matrix is the fundamental data type in GAUSS. This tutorial will teach you how to operate with and on matrices in GAUSS.

Let's get started by supposing that we have the average exam scores for a group of students included in the table below:

  Exam 1 Exam 2 Exam 3
History 77 82 86
Math 94 87 84
English 88 85 82

and that we would like to compare them.

Our first step is to enter this as a GAUSS matrix. In GAUSS, matrices are defined using curly braces {}. Spaces are used to separate elements in each row and commas are used to separate columns. Create the matrix avg_scores by entering:

avg_scores = { 77 82 86, 94 87 84, 88 85 82 };

The average score for the first math exam is located in the second row of the first column. GAUSS uses square brackets [] to perform matrix indexing. Enter:

print avg_scores[2, 1];

to print the element from the average score for the first mat exam.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy