-
-
Notifications
You must be signed in to change notification settings - Fork 436
Expand file tree
/
Copy pathbeth2algfun.pg
More file actions
105 lines (83 loc) · 2.6 KB
/
Copy pathbeth2algfun.pg
File metadata and controls
105 lines (83 loc) · 2.6 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
## DESCRIPTION
## Algebra
## ENDDESCRIPTION
## Tagged by cmd6a 8/6/06
## DBsubject(Algebra)
## DBchapter(Functions)
## DBsection(Compositions and combinations of functions)
## Date(6/3/2002)
## Institution(ASU)
## MLT(cc-graphs-evaluate)
## Level(2)
## TitleText1('College Algebra')
## AuthorText1('Stewart, Redlin, Watson')
## EditionText1('3')
## Section1('4.7')
## Problem1('12')
## KEYWORDS('algebra','function','graph', 'combining functions')
DOCUMENT(); # This should be the first executable line in the problem.
loadMacros(
"PGstandard.pl",
"PGchoicemacros.pl",
"PGcourse.pl"
);
TEXT(beginproblem());
$showPartialCorrectAnswers = 1;
TEXT(EV2(<<EOT));
The functions \(f(x)\) and \(g(x)\) are given in the graph.
$PAR \{ image("srw2_8_23.gif", width=>298, height=>283,
alt=>"Graph showing two functions f(x) and g(x) with f as a line segment and g as a curved segment, intersecting near the origin on a coordinate plane."
) \} $PAR
$BR
Find the corresponding function values.
If there is no function value, type $BITALIC DNE$EITALIC in the answer blank.
$BR
$BR
EOT
#This will produce the addition of functions question
$quest1 = '\( (f+g)(-1) \)';
$ans1 = "DNE";
$quest2 = '\( (f+g)(0) \)';
$ans2 = "1";
$quest3 = '\( (f+g)(1) \)';
$ans3 = "0";
$quest4 = '\( (f+g)(2) \)';
$ans4 = "3";
$quest5 = '\( (f+g)(3) \)';
$ans5 = "4";
$quest6 = '\( (f+g)(4) \)';
$ans6 = "5";
@questions =( $quest1,$quest2,$quest3,$quest4,$quest5,$quest6);
@answers =( $ans1,$ans2,$ans3,$ans4,$ans5,$ans6);
## Now choose randomly 1 questions out of the 6 questions strings above.
@slice = NchooseK(scalar(@questions),1);
## Next we output the chosen questions.
BEGIN_TEXT
$questions[$slice[0]] = \{ ans_rule(10)\}$BR
END_TEXT
#Answer to the first question
ANS(num_cmp($answers[$slice[0]], strings=>['dne']));
#This will produce the subtraction of functions question
$quest11 = '\( (f-g)(-1) \)';
$ans11 = "DNE";
$quest12 = '\( (f-g)(0) \)';
$ans12 = "-1";
$quest13 = '\( (f-g)(1) \)';
$ans13 = "-2";
$quest14 = '\( (f-g)(2) \)';
$ans14 = "-7";
$quest15 = '\( (f-g)(3) \)';
$ans15 = "-4";
$quest16 = '\( (f-g)(4) \)';
$ans16 = "-1";
@questions1 =( $quest11,$quest12,$quest13,$quest14,$quest15,$quest16);
@answers1 =( $ans11,$ans12,$ans13,$ans14,$ans15,$ans16);
## Now choose randomly 1 questions out of the 6 questions strings above.
@slice1 = NchooseK(scalar(@questions1),1);
## Next we output the chosen question.
BEGIN_TEXT
$questions1[$slice1[0]] = \{ ans_rule(10)\}
END_TEXT
#Answer to the first question
ANS(num_cmp($answers1[$slice1[0]], strings=>['dne']));
ENDDOCUMENT(); # This should be the last executable line in the problem.