# 213 - A6 - Linear Dynamical System

## 494 days ago by Professor213

This worksheet allows the user to input a transition matrix and initial vector and then iterate for any desired number of time steps.

John Travis

Mississippi College

%hide %auto N=2 print pretty_print(html("<font size=+2 color=blue>Enter N below. Click Update when you are finished.</font>")) @interact def _(Size_of_System=[2..10],update=false): global N N = Size_of_System pretty_print(html("<font size=+2 color=blue>The size of your square system will be "+str(N)+"$\\times$"+str(N)+"</font>")) pretty_print(html("<font size=+2 color=blue>Evaluate the cell below and enter the system data.</font>"))

Enter N below. Click Update when you are finished. None
 Size_of_System 2 3 4 5 6 7 8 9 10 update

## Click to the left again to hide and once more to show the dynamic interactive window

%auto print pretty_print(html("<font size=+2 color=blue>Enter the transition matrix for your dynamical system and the starting state below.<p> You can tab to navigate between cells. Click Update when you are finished.</font><p>")) @interact def _(Transition_Matrix=zero_matrix(QQ,N,N),Initial_State=zero_matrix(QQ,N,1),auto_update=False): global A global b A = Transition_Matrix b = Initial_State

Enter the transition matrix for your dynamical system and the starting state below.

You can tab to navigate between cells. Click Update when you are finished.

None

Transition_Matrix
Initial_State

## Click to the left again to hide and once more to show the dynamic interactive window

%auto print 'Using the data' show(A) b0 = copy(b) show(b0)
 Using the data  Using the data 

Assignment: For a given dynamical systems problem (should be stated here):

• Perform one step below to make certain your dynamical system is working properly
• Perform a small number of steps (say 5-10) and notice any drastic changes in any of the various populations
• Perform a large number of steps and notice whether the populations tend to stabilize about a given value.
• Write up your results in a text cell below. Be certain to cut-and-paste the transition matrix and initial values into another cell for me to see what you used. A copy is output below the interactive cell below for you to grab and save.
 [1/10 1/10 1/5 1/5] [ 2/5 1/10 1/2 1/10] [3/10 3/5 1/10 2/5] [ 1/5 1/5 1/5 3/10] [1/10 1/10 1/5 1/5] [ 2/5 1/10 1/2 1/10] [3/10 3/5 1/10 2/5] [ 1/5 1/5 1/5 3/10]
%auto @interact def _(steps = slider(1,100,1,1)): global A,b b = copy(b0) print b terms = range(b.nrows()) colors = rainbow(b.nrows()) P = Graphics() # S = Graphics() for term in terms: P += point2d((0,b[term]),color=colors[term]) for k in range(1,steps): b = A*b # S += point2d((b[k],b[k])) for term in terms: P += point2d((k,b[term]),color=colors[term],size=30) show(P) # show(S) print pretty_print(html('Final values:\n'),b.n())

steps

## Click to the left again to hide and once more to show the dynamic interactive window

%auto show(A) show(b0) show(b)