Skip to content

Commit

Permalink
1) Remove old unreachable code from beyond ENDDOCUMENT
Browse files Browse the repository at this point in the history
2) Make two of the problems actually work as they didn't have any
loadMacros
  • Loading branch information
jirilebl committed Sep 19, 2019
1 parent 7f330fa commit 9a7c274
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 198 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@

DOCUMENT();

loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"parserNumberWithUnits.pl",
"parserFormulaWithUnits.pl",
"parserDifferenceQuotient.pl",
"PGcourse.pl"
);


TEXT(beginproblem());

Expand Down Expand Up @@ -94,81 +103,3 @@ Context()->normalStrings;
;

ENDDOCUMENT();





###########################
# Initialization


DOCUMENT();

loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"parserNumberWithUnits.pl",
"parserFormulaWithUnits.pl",
"parserDifferenceQuotient.pl",
"PGcourse.pl"
);

TEXT(beginproblem());


###########################
# Setup

Context("Numeric");

$limit = DifferenceQuotient("2*x+h","h");

$fp = Compute("2 x");


###########################
# Main text

Context()->texStrings;
BEGIN_TEXT
Simplify and then evaluate the limit.
$BR
$BR
\( \displaystyle
\frac{d}{dx} \big( x^2 \big)
=
\lim_{h \to 0} \frac{(x+h)^2-x^2}{h}
=
\lim_{h \to 0}
\big(
\)
\{ ans_rule(15) \}
\( \big) = \)
\{ ans_rule(15) \}
END_TEXT
Context()->normalStrings;


############################
# Answer evaluation

$showPartialCorrectAnswers = 1;

ANS( $limit->cmp() );
ANS( $fp->cmp() );


############################
# Solution

Context()->texStrings;
BEGIN_SOLUTION

Solution explanation goes here.
END_SOLUTION
Context()->normalStrings;

;

ENDDOCUMENT();
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,3 @@ Context()->normalStrings;
;

ENDDOCUMENT();


ENDDOCUMENT();
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@

DOCUMENT();

loadMacros(
"PGstandard.pl",
"PGchoicemacros.pl",
"unionTables.pl",
"LiveGraphics3D.pl",
"PGgraders.pl",
"PGcourse.pl"
);

TEXT(beginproblem());

Expand Down Expand Up @@ -135,82 +143,3 @@ ANS(str_cmp([@ALPHABET[@inv]]));
COMMENT("Uses interactive graphs");

ENDDOCUMENT();

DOCUMENT();

loadMacros(
"PGstandard.pl",
"PGchoicemacros.pl",
"unionTables.pl",
"LiveGraphics3D.pl",
"PGgraders.pl",
"PGcourse.pl"
);

$refreshCachedImages=1;

@surfaces = (
image("Surface01.png",width=>150,height=>150,tex_size=>220),
image("Surface17.png",width=>150,height=>150,tex_size=>220),
image("Surface18.png",width=>150,height=>150,tex_size=>220),
image("Surface19.png",width=>150,height=>150,tex_size=>220),
);

@contours = (
image("contour01.png",width=>150,height=>150,tex_size=>220),
image("contour17.png",width=>150,height=>150,tex_size=>220),
image("contour18.png",width=>150,height=>150,tex_size=>220),
image("contour19.png",width=>150,height=>150,tex_size=>220),
);

$n = scalar(@surfaces);
$k = $n; # $k can be less than $n
@subset = NchooseK($n,$k);

@subset_of_surfaces = @surfaces[@subset];
@subset_of_contours = @contours[@subset];
@permutation = NchooseK($k,$k);
@shuffled_subset_of_contours = @subset_of_contours[@permutation];
@numbercaptions = (1..$k);
@alphacaptions = @ALPHABET[0..$k-1];

TEXT(beginproblem());

BEGIN_TEXT
Match each graph with its contour plot. If you click on a graph,
a larger graph will appear in a new window. In the contour plots, darker areas represent
lower elevations and lighter areas represent higher elevations.
$BR$BR
END_TEXT

#for $j (1..$k) {
#BEGIN_TEXT
#$j. \{ pop_up_list(['?', @alphacaptions]) \} $SPACE$SPACE$SPACE$SPACE$SPACE
#END_TEXT
#}

BEGIN_TEXT
$BCENTER
\{
BeginTable().
AlignedRow([$subset_of_surfaces[0],$subset_of_surfaces[1],$subset_of_surfaces[2],$subset_of_surfaces[3]]).
TableSpace(5,0).
AlignedRow([pop_up_list(['Choose', @alphacaptions]),pop_up_list(['Choose', @alphacaptions]),pop_up_list(['Choose', @alphacaptions]),pop_up_list(['Choose', @alphacaptions])]).
TableSpace(25,6).
AlignedRow([$shuffled_subset_of_contours[0],$shuffled_subset_of_contours[1],$shuffled_subset_of_contours[2],$shuffled_subset_of_contours[3]]).
TableSpace(5,0).
AlignedRow(["A","B","C","D"]).
EndTable();
\}
$BR
(Click on a graph to enlarge it.)
$ECENTER
END_TEXT

install_problem_grader(~~&std_problem_grader);

$showPartialCorrectAnswers = 0;

ANS(str_cmp([@ALPHABET[invert(@permutation)]]));

ENDDOCUMENT();
Original file line number Diff line number Diff line change
Expand Up @@ -136,41 +136,3 @@ $showPartialCorrectAnswers = 1;
ANS( $answer->cmp() );

ENDDOCUMENT();



#############################
# Main text1

Context()->texStrings;
BEGIN_TEXT

The graph of \( f(t) \) is given below:

$BCENTER
\{ image( insertGraph($gr),
width=>200,height=>200,tex_size=>500 ) \}
$BR
(Click on graph to enlarge)
$ECENTER
$BR

Represent \( f(t) \) using a combination of Heaviside step functions. Use \( h(t-a) \) for the Heaviside function shifted \( a \) units horizontally.
$BR
$BR
\( f(t) = \)
\{ ans_rule(60) \}
\{ AnswerFormatHelp("formulas") \}

END_TEXT
Context()->normalStrings;


##############################
# Answer evaluation1

$showPartialCorrectAnswers = 0;

ANS( $answer->cmp() );

ENDDOCUMENT();

0 comments on commit 9a7c274

Please sign in to comment.