SCREEN 12 VIEW (1, 40)-(638, 328), 8, 4 'Grey box, red border WINDOW (0, 0)-(10, 40) 'Scale 0 to 10, 0 to 40 LINE (0, 0)-(10, 0), 9 'Axis in bright blue PRINT "Now a similar simulation allows a `live input' to perturb it" PRINT "Press number keys 0 to 9 to change the input" ' dt = .00002 'Make dt larger if you want to speed up running k = .5 x = 10 'Initial value t = 0 PSET (0, 10) DO a$ = INKEY$ 'These two lines turn a IF a$ <> "" THEN u = 2 * VAL(a$) 'key-press into a value for u x = x + (-k * x + u) * dt 'This is the simulation t = t + dt LINE -(t, x) 'This displays the result LOOP UNTIL t > 10