Tutorials > Getting Started > Task 4–2: Defining Matrices
Task 4–2: Defining Matrices
1. To define matrix A, type A:[
2. Type 1 4 2, pressing Shift+Spacebar between each number.
3. To insert a row, press Shift+Enter, or place the pointer on the last element of the matrix (2 in this case) and press Tab.
To edit matrices from the Ribbon, on the Matrices/Tables tab, in the Rows and Columns group, select one of the options.
4. Place the cursor in the leftmost empty placeholder. Type 5 6 2 7 9 1 8 5 4, pressing Tab between each number.
5. Type B and then insert the definition operator.
6. On the Matrices/Tables tab, in the Matrices and Tables group, click Insert Matrix. To insert a matrix with 4 rows and 3 columns, drag the pointer for a 4 × 3 matrix.
7. Type the following numbers in the empty placeholders:
8. Define matrix C. Assign to this variable an expression that contains A and B.
When you add matrices, they must be of the same size. Here, both A and B are 4 × 3 matrices.
9. Evaluate elements of matrix C.
To evaluate the first element of matrix C, type C, insert the Matrix Index operator, and then type 0,0=
To evaluate the third element of the first column, type C, insert the Matrix Index operator, and then type 2,0=
To evaluate the second element of the second column, type C, insert the Matrix Index operator, and then type 1,1=
The indices are counted from the top leftmost element. The indices of the first element are controlled by the system variable ORIGIN. You can change ORIGIN on the Calculation tab or in your worksheet. The default value of ORIGIN is 0, so the indices of the first matrix element are (0, 0).
10. Assign new values to these three elements. For the first element, type C, insert the Matrix Index operator, and then type 0,0:0
When you evaluate C, you can see the elements that you have redefined:
Range Variables and Complex Numbers
1. To create two range variables, type i:0..1 and then j:0..2
A range variable defines a number sequence. You can define range variables using the range operator or the step range operator. For more information on the difference between these two operators, refer to the Operators book in the Help.
2. To display the sequence of numbers associated with each range variable, evaluate the range variables.
When you evaluate a range variable, its sequence of numbers is presented as a column vector. However, range variables and column vectors have different properties. For example, you cannot plot a range variable against a column vector.
3. To define several matrix elements at once, insert the range variables as indices, and then refer to the range variables in the math expression.
You must include a scaling or multiplication operator between the integers and the i or the j. Otherwise, PTC Mathcad identifies the terms 2i and 3j as imaginary numbers:
To change the format of complex results, on the Math Formatting tab, in the Results group, select a format from the Complex Values list.
Was this helpful?