BSD 1 development
[unix-history] / puman / bigger6.p
CommitLineData
5bd13011
BJ
1\0\0\0\0\01\0\0(*
2\0\0\0\0\02\0\0\0* Graphic representation of a function
3\0\0\0\0\03\0\0\0* f(x) = exp(-x) * sin(2 * pi * x)
4\0\0\0\0\04\0\0\0*)
5\0\0\0\0\05\0\0program graph1(output);
6\0\0\0\0\06\0\0const
7\0\0\0\0\07\0\0\0\0\0\0\0\0\0\0d = 0.0625; (* 1/16, 16 lines for interval [x, x+1] *)
8\0\0\0\0\08\0\0\0\0\0\0\0\0\0\0s = 32; (* 32 character width for interval [x, x+1] *)
9\0\0\0\0\09\0\0\0\0\0\0\0\0\0\0h = 34; (* Character position of x-axis *)
10\0\0\0\010\0\0\0\0\0\0\0\0\0\0c = 6.28138; (* 2 * pi *)
11\0\0\0\011\0\0\0\0\0\0\0\0\0\0lim = 32;
12\0\0\0\012\0\0var
13\0\0\0\013\0\0\0\0\0\0\0\0\0\0x, y: real;
14\0\0\0\014\0\0\0\0\0\0\0\0\0\0i, n: integer;
15\0\0\0\015\0\0begin
16\0\0\0\016\0\0\0\0\0\0\0\0\0\0for i := 0 to lim do begin
17\0\0\0\017\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0x := d / i;
18\0\0\0\018\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0y := exp(-x) * sin(c * x);
19\0\0\0\019\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0n := round(s * y) + h;
20\0\0\0\020\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0repeat
21\0\0\0\021\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0write(' ');
22\0\0\0\022\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0n := n - 1
23\0\0\0\023\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0until n = 0;
24\0\0\0\024\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0writeln('*')
25\0\0\0\025\0\0\0\0\0\0\0\0\0\0end
26\0\0\0\026\0\0end.