summaryrefslogtreecommitdiff
path: root/ipl/gprogs/orbit.icn
blob: 3f09ee9cac9e8e4f6f3e582ee083f9b7d825858a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
############################################################################
#
#	File:     orbit.icn
#
#	Subject:  Program to display quadratic orbit
#
#	Author:   Ralph E. Griswold
#
#	Date:     June 17, 1994
#
############################################################################
#
#   This file is in the public domain.
#
############################################################################
#
#  This is a barebones version of a display of the orbit of a quadratic
#  equation.  It has deliberately been left simple and free of options so
#  that the basic idea is clear and so that it can be used as the basis of
#  more capable versions.
#
#  This program is based on material given in "Chaos, Fractals,
#  and Dynamics", Robert L. Devaney, Addison-Wesley, 1990.
#
############################################################################
#
#  Requires:  Version 9 graphics
#
############################################################################
#
#  Links:  wopen
#
############################################################################

link wopen

procedure main()
   local extent, c, i, j, m, x

   extent := 360

   WOpen("label=orbit", "height=" || extent, "width=" || extent) |
      stop("*** cannot open window")

   every i := -320 to 40 do {
      x := 0.0
      c := i / 160.0
      m := 160 * (c + 2)
      every j := 0 to extent do {
         x := x ^ 2 + c
         if j < 50 then next		# wait for things to take hold
         DrawPoint(m,  75 * (2 - x))
         }
      }
    
   Event()

end