Skip to content

Commit 233a1b1

Browse files
authored
Merge pull request #1078 from gajennings/main
Fix bug 4775, convert to PGML
2 parents 0cf5795 + 302b69f commit 233a1b1

File tree

1 file changed

+21
-27
lines changed
  • OpenProblemLibrary/Union/setFunctionComposition

1 file changed

+21
-27
lines changed

OpenProblemLibrary/Union/setFunctionComposition/sw4_7_45.pg

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -30,50 +30,44 @@ DOCUMENT(); # This should be the first executable line in the problem.
3030

3131
loadMacros(
3232
"PGstandard.pl",
33-
"PGunion.pl",
3433
"MathObjects.pl",
34+
"PGML.pl",
3535
"PGcourse.pl"
3636
);
3737

3838
TEXT(beginproblem());
3939

4040
###################################
4141
# Setup
42+
43+
Context("Numeric");
44+
4245
$a = non_zero_random(-9,9,1);
4346
$b = random(2,9,1);
4447

45-
$f=Formula("x^$b")->reduce;
46-
$g=Formula("x+$a ")->reduce;
47-
48+
$f=Formula("x^$b");
49+
$g=Formula("x+$a")->reduce;
4850
$fcompg = $f ->substitute(x=>$g);
49-
#$gcompf = $g ->substitute(x=>$f);
50-
51-
###################################
52-
# Main text
53-
54-
Context()->texStrings;
55-
BEGIN_TEXT
56-
If the function
57-
\( h(x)=$fcompg\) is expressed in the form \(f \circ g\) with
58-
\(f(x)=$f,\) then find the function \(g(x)\).
59-
$PAR
60-
\(g(x)\)= \{ans_rule(15)\}
61-
END_TEXT
62-
Context()->normalStrings;
6351

64-
###################################
65-
# Answers
66-
67-
ANS( $fcompg->cmp(
52+
$cmp=$g->cmp(
53+
limits => [-$a - 2, -$a + 2],
54+
test_at => [[-$a - 1], [-$a + 1]],
6855
checker=>sub {
6956
my ( $correct, $student, $ansHash ) = @_;
70-
return $correct == ($f ->substitute(x=>$student))->reduce;
57+
my $stucomp = $f ->substitute(x=>$student);
58+
return $fcompg == $stucomp;
7159
}
72-
) );
73-
74-
##ANS($g->cmp);
60+
);
7561

7662
###################################
63+
# Main text
64+
65+
BEGIN_PGML
66+
If the function
67+
[` h(x)=[$fcompg]`] is expressed in the form [`f \circ g`] with
68+
[`f(x)=[$f]`], then find the function [`g(x)`].
69+
70+
[`g(x)`] = [_____]{$cmp}
71+
END_PGML
7772

78-
;
7973
ENDDOCUMENT();

0 commit comments

Comments
 (0)