Sei sulla pagina 1di 1

Computer Lab Assignment Applications Handout (Part II)

In this lab we will be looking at various applications of matrices and systems of equations. (1) Read the Finite Linear Games section on pages 109-113 of the handout, then do problems 23, 24, 26, 27, and 29 (extra credit for 25, 28, and 30 but do these later you can do the matrix work on your calculators). (2) Read the Balancing Chemical Equations section on pages 103-104 of the handout, then do problems 11 and 14 (on page 114). You should either create a diary file, or copy the commands and relevant output from MATLAB into a text file to edit. I find it easier and more efficient to copy everything from the MATLAB command window (or the diary file) and then delete what I dont need instead of copying bits and pieces. Each problem should look something like the following (based on example 2.33 note the use of the mod( ) command).

(Page 110) Here we set up the matrices for the effects of the switches and the initial state vector:
>> a=[1 1 0 0 0]';b=[1 1 1 0 0]';c=[0 1 1 1 0]'; >> d=[0 0 1 1 1]';e=[0 0 0 1 1]';s=[1 0 1 0 0]'; >> (a+s)' % Find the sum of a and s as a row vector ans = 2 1 1 0 0 >> mod((a+s)',2) ans = 0 1 % Find that same sum, but mod(2). 1 0 0

To determine whether we can achieve a target configuration t starting from an initial configuration s, we need to determine whether there are scalars x1 ,, x5 in Z2 such that s + x1a + x2b + + x5e = t , which in mod(2) equates to x1a + x2b + + x5e = t s = t + s 1. In other words, we need to see if there is some combination of button pushes (possibly including multiple pushes for any given button) that will lead us from s to t. In other words, we need to solve the following system, and in mod(2) this works exactly as it does otherwise:
>> A=[a b c d e [1 0 1 0 1]'] % Create the matrix A from the pre-defined vectors a,,e. A = 1 1 0 0 0 1 1 1 1 0 0 0 0 1 1 1 0 1 0 0 1 1 1 0 0 0 0 1 1 1 >> mod(rref(A),2) ans = 1 0 0 1 0 0 0 0 0 0 % Row-reduce the matrix, but do so mod(2). 1 0 1 1 0 1 1 1 0 0 % We get the solution shown on p. 111.

0 0 1 0 0

0 0 0 1 0

TURN IN Turn in all MATLAB code used to solve the required problems, leaving space (if necessary) for any hand-written calculations.

Check this if youre not convinced. Calculate the possible sums and differences of the numbers 0 and 1 and you will find that t + s and t s actually ARE equivalent (and this is easy to prove). By the way, in mod 3, t s = t + 2s (also easy to prove).

Potrebbero piacerti anche