-
-
Notifications
You must be signed in to change notification settings - Fork 436
Expand file tree
/
Copy pathrich2.pg
More file actions
154 lines (132 loc) · 5.13 KB
/
Copy pathrich2.pg
File metadata and controls
154 lines (132 loc) · 5.13 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
## DESCRIPTION
## Algebra
## ENDDESCRIPTION
## Tagged by cmd6a 8/6/06
## DBsubject(Algebra)
## DBchapter(Functions)
## DBsection(Definition, concept)
## Institution(ASU)
## MLT(intgraph)
## Level(2)
## KEYWORDS('algebra','function','graph')
DOCUMENT(); # This should be the first executable line in the problem.
loadMacros(
"PGstandard.pl",
"PGchoicemacros.pl",
"PGgraphmacros.pl",
"PGasu.pl",
"PGcourse.pl"
);
TEXT(beginproblem());
$showPartialCorrectAnswers = 0;
@x = (-.16, 0, 2, 4, 6, 8, 10,12,12.165);
@y1 = (92.2, 92, 88, 86, 85, 88,94,99,99.2);
@y2 = (41.2, 41, 37, 34, 32, 35,39,44,44.2);
@y3 = (49.2, 49, 47, 44, 45, 47,50,51,51.2);
@y4 = (66.2, 66, 64, 61, 60, 62,66,68,68.2);
@y5 = (82.2, 82, 78, 75, 73, 74,77,82,82.2);
@yy = (@y1, @y2, @y3, @y4, @y5);
@month = ('warm July','cool January', 'cool December', 'mild October', 'warm August');
@ymax = (100, 45, 55, 70, 85);
@ymin = (78, 28, 38, 53, 68);
@ax = (80, 30, 40, 55, 70);
for ($n=0; $n<=4; $n++) {
$d[$n] = $ymax[$n]-$ymin[$n]; }
$i = random(0,4);
if ($i==0) {@y=@y1; @arr = (1, 2, 3, 4); }
elsif ($i==1) {@y=@y2; @arr = (0, 2, 3, 4); }
elsif ($i==2) {@y=@y3; @arr = (0, 1, 3, 4); }
elsif ($i==3) {@y=@y4; @arr = (0, 1, 2, 4); }
else {@y=@y5; @arr = (0, 1, 2, 3); }
for ($n=0; $n<=4; $n++) {
$graph[$n] = init_graph(-1,$ymin[$n],13,$ymax[$n],'grid'=>[ 14,$d[$n] ]);
$l1 = new Label(0.07, $ax[$n], "0",'black','left');
$l2 = new Label(12.07, $ax[$n], "12",'black','left');
$jj = 9*$n +1;
for ($j=1; $j<7; $j++) {
$k = $j+1; $kk = $jj + 1;
$a = ($yy[$kk]-$yy[$jj])/($x[$k]-$x[$j]);$b = $yy[$jj]-$a*$x[$j];
$f = "$a*x+$b for x in <$x[$j],$x[$k]> using color:blue and weight:2";
plot_functions($graph[$n], $f);
$graph[$n]->stamps(closed_circle($x[$j],$yy[$jj],'red'));
$jj = $kk; }
$graph[$n]->stamps(closed_circle($x[$k],$yy[$kk],'red'));
$graph[$n]->lb('erase');
# put in x-axis
$graph[$n]->h_axis($ax[$n], 'black');
# most of y-axis
$graph[$n]->moveTo(0, $ax[$n]+1); $graph[$n]->lineTo(0,$ymax[$n],'black');
#squiggle in y-axis
$graph[$n]->moveTo(0, $ymin[$n]); $graph[$n]->lineTo(0,$ax[$n]+.2,'black');
$graph[$n]->lineTo(.2,$ax[$n]+.3,'black');
$graph[$n]->lineTo(-.2,$ax[$n]+.6,'black');
$graph[$n]->lineTo(0,$ax[$n]+1,'black');
for ($ijk=$ax[$n]+2; $ijk<=$ymax[$n]-1; $ijk +=2) {
$graph[$n]->lb( new Label(0, $ijk, $ijk,'black','right','middle'));
}
$graph[$n]->lb($l1, $l2);
}
@ym = (0, 0, 4,4, 4, -4, -4,0,0 );
$herm = new Hermite(~~@x, ~~@y, ~~@ym);
$gr2 = init_graph(-1,$ymin[$i],13,$ymax[$i],
'grid'=>[14,$d[$i] ]);
new Fun($herm->rf_f,$gr2);
$gr2->lb('erase');
$l1 = new Label(0.07, $ax[$i], "0",'black','left');
$l2 = new Label(12.07, $ax[$i], "12",'black','left');
$gr2->lb($l1,$l2);
# put in x-axis
$gr2->h_axis($ax[$i], 'black');
# most of y-axis
$gr2->moveTo(0, $ax[$i]+1); $gr2->lineTo(0,$ymax[$i],'black');
#squiggle in y-axis
$gr2->moveTo(0, $ymin[$i]); $gr2->lineTo(0,$ax[$i]+.2,'black');
$gr2->lineTo(.2,$ax[$i]+.3,'black');
$gr2->lineTo(-.2,$ax[$i]+.6,'black');
$gr2->lineTo(0,$ax[$i]+1,'black');
for ($ijk=$ax[$i]+2; $ijk<=$ymax[$i]-1; $ijk +=2) {
$gr2->lb( new Label(0, $ijk, $ijk,'black','right','middle'));
}
for ($j=1; $j<=7; $j++) {
$gr2->stamps(closed_circle($x[$j],$y[$j],'red')); }
$m = new_multiple_choice();
$m->qa( "Which graph best represents the data?",image(insertGraph($graph[$i]),
alt=>"Scatter plot showing seven data points of temperature T versus time t, with a squiggle break on the y-axis indicating a truncated scale."
) );
$m->extra(image(insertGraph($graph[$arr[0]]),
alt=>"Scatter plot showing temperature readings in Fahrenheit versus time in hours, with seven data points plotted as red dots on a coordinate grid."
),
image(insertGraph($graph[$arr[1]]),
alt=>"Scatter plot showing temperature readings in degrees Fahrenheit versus time in hours, with data points plotted from midnight to noon."
), image(insertGraph($graph[$arr[2]]),
alt=>"Scatter plot showing temperature readings in degrees Fahrenheit versus time in hours, with data points plotted at 2-hour intervals from midnight to noon."
),
image(insertGraph($graph[$arr[3]]),
alt=>"Scatter plot showing temperature readings in degrees Fahrenheit versus time in hours, with data points recorded every 2 hours from midnight to noon."
),
image(insertGraph($gr2),
alt=>"Scatter plot showing temperature readings in Fahrenheit versus time in hours, with seven data points marked from midnight to noon."
) );
BEGIN_TEXT
Temperature readings $BITALIC T $EITALIC (in degrees Fahrenheit) were recorded every 2 hours from midnight to noon in Tempe, Arizona on a $month[$i] morning. The time $BITALIC t $EITALIC was measured in hours after midnight.
$BR $BCENTER
\{ begintable(2 ) \}
\{row('time, $BITALIC t $EITALIC','Temp, $BITALIC T $EITALIC') \}
\{row($x[1],$y[1] ) \}
\{row($x[2],$y[2] ) \}
\{row($x[3],$y[3] ) \}
\{row($x[4],$y[4] ) \}
\{row($x[5],$y[5] ) \}
\{row($x[6],$y[6] ) \}
\{row($x[7],$y[7] ) \}
\{endtable()\}
$ECENTER
$BR
\{ $m->print_q() \}
$BR $BBOLD Note: $EBOLD Click on any graph to view a larger graph.
$BR
\{ $m->print_a() \}
$BR
END_TEXT
ANS(radio_cmp( $m->correct_ans ) ) ;
ENDDOCUMENT(); # This should be the last executable line in the problem.