-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontinuity.pg
95 lines (79 loc) · 2.19 KB
/
continuity.pg
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
DOCUMENT();
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"parserPopUp.pl",
# "PGanswermacros.pl",
"PGchoicemacros.pl",
"PGcourse.pl",
"PGgraphmacros.pl",
"PGML.pl",
);
TEXT(beginproblem());
$gr = init_graph(-1,-1,7,15,grid=>[8,16],axes=>[0,0],pixels=>[400,200]);
$gr -> lb('reset');
foreach my $k (0..15) {
$gr -> lb(new Label(-0.125, $k, $k,'black','center','middle'));
$gr -> lb(new Label($k, -0.5, $k,'black','center','middle'));
}
@i = NchooseK(7,7);
@j = NchooseK(15,15);
#@i = (0..6);
#@j = (0..14);
$aneg1 = $j[7];
$b7 = $j[9];
@a = ($j[4], $j[1], $j[0], $j[6], $j[12], $j[11], $j[13]);
@b = ($j[4], $j[1], $j[0], $j[3], $j[5], $j[8], $j[10]);
@c = ($j[4], -2, $j[2], -2, $j[14], $j[11], $j[10]);
foreach my $k (0..5) {
$gr->moveTo($k,$a[$i[$k]]); $gr->lineTo($k+1,$b[$i[$k+1]]);
}
$gr->moveTo(-1,$aneg1); $gr->lineTo(0,$b[$i[0]]);
$gr->moveTo(6,$a[$i[6]]); $gr->lineTo(7,$b7);
foreach my $k (0..6) {
$gr -> stamps(open_circle($k, $a[$i[$k]]));
$gr -> stamps(open_circle($k, $b[$i[$k]]));
$gr -> stamps(closed_circle($k, $c[$i[$k]]));
}
@continuitytype = (
"Continuity",
"Removable discontinuity",
"Jump discontinuity",
"Infinite discontinuity",
);
@e = (0,1,1,2,2,2,2);
@answers = NchooseK(3,3);
do {$x1 = random(0,6);} until ($e[$i[$x1]] == $answers[0]);
do {$x2 = random(0,6);} until ($e[$i[$x2]] == $answers[1]);
do {$x3 = random(0,6);} until ($e[$i[$x3]] == $answers[2]);
$popup1 = PopUp(["",
$continuitytype[0],
$continuitytype[1],
$continuitytype[2],
$continuitytype[3],
], $continuitytype[$e[$i[$x1]]]);
$popup2 = PopUp(["",
$continuitytype[0],
$continuitytype[1],
$continuitytype[2],
$continuitytype[3],
], $continuitytype[$e[$i[$x2]]]);
$popup3 = PopUp(["",
$continuitytype[0],
$continuitytype[1],
$continuitytype[2],
$continuitytype[3],
], $continuitytype[$e[$i[$x3]]]);
BEGIN_PGML
[@image(insertGraph($gr), width=>400, height=>200, tex_size=>900)@]*
What type of discontinuity (or continuity)
does `f(x)` have at `x=[$x1]`?
[_]{$popup1}
What type of discontinuity (or continuity)
does `f(x)` have at `x=[$x2]`?
[_]{$popup2}
What type of discontinuity (or continuity)
does `f(x)` have at `x=[$x3]`?
[_]{$popup3}
END_PGML
ENDDOCUMENT();