Table of Contents

Hints & Tips

DM41X Matrix

Matrix functions in the Advantage Pac

Background

The matrix functionality isn't a standalone program, with a menu, like CFIT and PLY.

It's a collection of individual programs that can be used for many matrix tasks. Each one has to be called individually as needed.

There are many commands, the most used are those for

Shortcuts to Matrix Commands

To make things easier it's best to use the DM41X CST custom command shortcut mechanism.

Start with a blank CST and add the commands you need. Then save this CST so that it's easy to switch to other CST setups, and then return to the Matrix setup later.

I have the following

AMATDIMI
BMEDITJ
CCMEDITK
DMINVL
EM*MMZK?YN
FMDETNEMDIR
GTRNPSOEMDIRX
HMSYSPPURFL

Matrices are saved in Extended Memory, and I put commands in CST to find and remove them once I'm finished: EMDIR, EMDIRX and PURFL and I have ZK?YN to quickly access DM41X 41z Module complex number functions (assuming the module is plugged-in).

Basic Workflow

All matrix addressing is done via the ALPHA register

Dimension a new Matrix

Populate a new Matrix

For a 3×3 matrix

| 1 1 -1 | | 4 6 6 | | 1 8 9 |

Determinant

With A still in the ALPHA register use the MDET command from the CST menu F

Multiplication

Using M*M

For matrix multiplication you need 3 matrix definitions:

To multiply two matrices together they must have the correct dimensions

Create Matrix A

Follow the same procedure as above.

Make sure ALPHA has only the letter A

A different numerical example

A will be a 3×2 matrix

| 2 3 | | 4 5 | | 7 6 |

Create Matrix B

B will be a 2×2 matrix

Make sure ALPHA only has B and then dimension B with MATDIM from CST menu A

| 2 3 | | 4 5 |

* Use MEDIT via CST menu

We now have defined the matrices to be multiplied together.

Create Matrix C

We need a results matrix C

The dimensions of C will be rows of A and columns of B which is 3 rows and 2 columns : 3.002

Make sure ALPHA only has C and dimension C with MATDIM from CST menu A

That's enough to create the results matrix

Multiply the matrices

View the result

The result in C is

| 16 21 | | 28 37 | | 38 51 |

System of Equations

A simple example first

Set of Equations

3 unknowns

3x + 4y + 6z = 39.7 2x - 4y - 3z = -7.0 y + 8z = 63.4

Matrix representation

Matrix A

| 3 4 6 | | 2 -4 -3 | | 0 1 8 |

Matrix B

| 39.7 | | -7.0 | | 63.4 |

Simultaneous Equations represented in Matrix Form

|A| x |C| = |B| | 3 4 6 | | x | | 39.7 | | 2 -4 -3 | x | y | = | -7.0 | | 0 1 8 | | z | | 63.4 |

Create Matrix A

Create Matrix B

Run MSYS

Examine Matrix B

The solution

x = 1.5 y = -3.8 z = 8.4

Matrix A

Another way to solve a system

Instead of the MSYS function you could do it manually by entering Matrix A and Matrix B, and define Matrix C such that

A X C = B

C = B / A

C = A* X B where A* is Inverse A

Create Matrix C with dimensions 3.001 in the usual way then and do:

The Complex Matrix

It is possible to define, edit and carry out operations with matrices containing Complex Numbers.

The matrix is defined with twice as many rows and columns as appears necessary, and edited with the function CMEDIT, in CST menu C

Example Definition

| 1+j2 5+j6 | | 3+j4 7+j8 |

Two rows and two columns 2×2 containing complex numbers, so the definition/dimension is 4.004

The numbers are actually saved as if in a larger real matrix as

| 1 -2 5 -6 | | 2 1 6 5 | | 3 -4 7 -8 | | 4 3 8 7 |

The entry is via CMEDIT via CST menu C, which asks for each Real and Imaginary part in turn

Multiplication of Complex Matrices

Create a second matrix

| 3+j4 | | 2+j6 |

Dimension second matrix

This is dimensioned as double the basic size of 2×1 : 4.002 and then populated with CMEDIT

Create a result matrix

Matrix 'C' which will be also be a 2×1 complex with dimension :4.002

Multiply A X B = C

Inspect Result Matrix C

The result matrix is therefore

| -31+j52 | | -41+j82 |

Which agrees with my long-hand calculation (thanks to DM41X 41z Module )

|(1+j2).(3+j4) + (5+j6).(2+j6)| |(3+J4).(3+J4) + (7+J8).(2+J6)|

| (-5+j10) + (-26+j42) | | (-7+j24) + (-34+j58) |

| -31+j52 | | -41+j82 |

Systems of Complex Equations....

Once you can enter and manipulate Complex Matrices you can also use MSYS to solve systems with complex matrices in the same way as usual - the only difference is entering the matrices as Complex.

Clearing Up Extended Memory

After creating and manipulating (and some finger trouble) there will be a bunch of files in Extended Memory.

Most will be simple matrix definitions with obvious names A, B, C etc. but occasionally you'll accidentally have run MATDIM with some nonsense in the ALPHA register and created a nonsensical filename in extended memory, which it's tricky to spell out correctly in ALPHA in order to run PURLF - this is where EMDIRX comes in.

To simplify clearing up I include EMDIR, EMDIRX and PURFL in the CST menu.

Assuming you have other files in Extended Memory, the quickest way is to find the number of files in EM with EMDIR.

Further Information