Skip to content

Commit 99b4227

Browse files
committed
Fix the DiffCalc/AnswerWithUnits.pg sample problem.
The problem uses the "Units" context, but never activates that context and selects the units to use. So the problem fails to render.
1 parent 5c1759a commit 99b4227

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tutorial/sample-problems/DiffCalc/AnswerWithUnits.pg

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@ DOCUMENT();
2525
loadMacros('PGstandard.pl', 'PGML.pl', 'contextUnits.pl', 'PGcourse.pl');
2626

2727
#:% section = setup
28-
#: First, set the variable for the functions in the problem to be t,
29-
#: and assign the units "seconds" to it.
28+
#: First select the "Units" context, allow units for "length" and "time" in the
29+
#: context, and set the variable for functions in the context to be `t`.
30+
#:
31+
#: Then, assign the units "seconds" to the variable `t`.
3032
#:
3133
#: Use the differentiation operator `->D('t')` to compute the derivated, and the
3234
#: evaluation method `->eval()` to evaluate it as a function. All of these will
3335
#: now have the expect units.
34-
Context()->variables->are(t => 'Real');
36+
Context('Units')->withUnitsFor('length', 'time')->variables->are(t => 'Real');
3537
Context()->assignUnits(t => 's');
3638

3739
$v0 = random(16, 96, 16);

0 commit comments

Comments
 (0)