Sagetex: Matrices

Problem Type 1: Finding an inverse

InverseMatrixHere are 2 sample problems involving the inverse of a matrix; one involves using an augmented matrix, the other doesn't. As written, the code makes sure that both matrices have an inverse (but the spacing is not correct as shown below).

while A.determinant() == 0:
A = random_matrix(ZZ,3,3)

You can download the file here: InverseMatrix (.tex) and see the proper code.

Problem Type 2: Solving systems of equations

SolveSystemsCode for solving systems of equations and matrix equations: SolveSystem (.tex)

Problem Type 3: Systems of Equations (with more control)

SolveSystems2Problem Type 2 had systems of equations created through producing an invertible matrix and then solving the matrix equations. That led to output that was a little clumsy and didn't cover all the cases that can result from 2 lines. The 3 cases are:

  1. 1 point of intersection
  2. parallel lines
  3. coinciding lines

This current batch of problems lets you pick which case you want for your specific problems and generates the random numbers for each case. By controlling the random numbers, the output looks better, too. Here's the code for the 3 case: SolveSystems (.tex)

Problem Type 4: Sending/receiving secret messages

SecretMessagesThere are many ways to use matrices to send/receive messages. The screenshot above shows 2 problems that use just the alphabet and set A=0, B=1,...,Z=25. Other alphabets allow for spaces, numbers, and so on. These problems form the message from across rows, rather than columns and use multiplication on the left rather than on the right. But the basic structure is here for you to modify to your taste and include in a test or quiz. You need to understand that if you're using a 2x2 matrix to encode a message then the message length should be divisible by 2. If it isn't then a dummy letter is needed to make it the correct length. Likewise, if you use a 3x3 matrix to encode a message then the message length should be divisible by 3; so you might need up to 2 dummy letters to end the message. I've chosen Z but Q (or X) is a logical choice, too. Here's the code: SecretMessages (.tex)

Problem Type 5: Polynomial Interpolation 1 (Fib Sequence)

Find a polynomial formula to justify any term to follow what appears to be the Fibonacci sequence.

FibSeq

Download the file: FibSeq  (.tex)

Leave a Reply

Your email address will not be published. Required fields are marked *

AlphaOmega Captcha Classica  –  Enter Security Code