E-Code

Markov chain: n steps and the steady state — a TI-89 Titanium program

By E-Code · updated

MARKOV89 is a TI-89 BASIC program for the TI-89 Titanium. Type a transition matrix (rows sum to 1 — type fractions like 1/3 to stay exact), a starting row vector and a number of steps: the probability of each state after n steps (S1, S2, …) and the steady state (SS1, SS2, …).

What it asks for and what it shows

It asks for 3 values at its prompts. In the example below it shows S1, S2, SS1, SS2, AFTER 3 STEPS:, STEADY STATE:.

Example run

One of its oracle test cases: “2 states, 3 steps”. The inputs are typed in order, and the results are the values the case expects on the screen.

StepValue
You enter
Input 1[[9/10,1/10][1/2,1/2]]
Input 2[[1,0]]
Input 33
The screen shows
S1=211/250
S2=39/250
SS1=5/6
SS2=1/6
TextAFTER 3 STEPS:
TextSTEADY STATE:

How it's checked

7 test cases, each checked against an independent method. Replayed key by key on a virtual TI-89 Titanium, they make 66 checks.

How E-Code checks every program

Run it or put it on your calculator

Related programs

All TI-89 Titanium statistics programs · All TI-89 Titanium programs