PREP 2015 Question Authoring - Archived

Free Trial webwork version 2.8 is generating "Context" errors.

Free Trial webwork version 2.8 is generating "Context" errors.

by tim Payer -
Number of replies: 1
Hello all!

I just imported a number of problems into our campus' free trial webwork course version 2.8 that are getting a unknown "Context" error. These problems were working fine in webwork 2.10 that were created in the PREP 2015 course. 
I would like to find a solution. Are there certain contexts that are not valid in version 2.8 webwork?

I would like to find a solution as I suspect that the MAA may not be upgrading to version 2.10 by our campus's first day of class on Monday August 24th.

I have posted the error statement below and an associated problem.
The error is happinging even with pg problems. The context("Fraction"); is also generating this error. Help please??

Many thanks....

       Problem1
ERROR caught by Translator while processing problem file:Payer/M105_HW_1/M105_H1_rat_fract_19.pg
****************
ERRORS from evaluating PG file: 
begin|||Unknown context 'Context' at line 130 of [PG]/macros/Parser.pl Died within main::Context called at line 1352 of [PG]/macros/PGML.pl from within main::_PGML_init called at line 183 of [PG]/lib/PGloadfiles.pm from within PGloadfiles::loadMacros called at line 431 of [PG]/macros/PG.pl from within main::loadMacros called at line 14 of (eval 16441) |||end
****************
------Input Read 1 # DESCRIPTION Problem 17 2 # Algebra_Review 3 # WeBWorK problem written by TimPayer <tsp1@humboldt.edu> 4 # ENDDESCRIPTION 5 6 ## DBsubject(Algebra) 7 ## DBchapter(Fractions) 8 ## DBsection(Solving Formulas) 9 ## Institution(Humboldt State University) 10 ## Author(Tim Payer) 11 ## KEYWORDS(reduce, fraction, formulas) 12 13 DOCUMENT(); 14 loadMacros( 15 "PGstandard.pl", 16 "PGML.pl", 17 "MathObjects.pl", 18 "PGbasicmacros.pl", 19 "problemRandomize.pl", 20 "parserFormulaUpToConstant.pl" 21 ); 22 23 Context("Numeric"); 24 25 $a = Real(random(3,9,1)); 26 $plus =Real(random(1,7,1)); 27 $c = Compute("$a+$plus"); 28 $ac = Compute("$a-$c"); 29 $bm = Real(random(1,7,1)); 30 $dm = Real(random(1,7,1)); 31 $b = Compute("-$ac*$bm"); 32 $d = Compute("-$ac*$dm"); 33 34 Context()->variables->add(y=>"Real"); 35 36 37 BEGIN_PGML 38 >> Solve for [`x`]: << 39 40 >> [``[$a] x-[$b] = [$c] x -[$d] y``] << 41 42 >> [`x`] = [__________]{([$b]-[$d] y)/([$a]-[$c])} << 43 44 END_PGML 45 46 BEGIN_PGML_SOLUTION 47 *SOLUTION* 48 49 To solve for [`x`] within an equation we must first isolate the terms of [`x`] on the left side of the equation and then push the non terms of [`x`] on the right side of the equation. 50 [``\begin{aligned}&\\ 51 [$a] x-[$b] &= [$c] x -[$d] y\\ 52 - [$c] x +[$b] &= - [$c] x+ [$b] && \text{Adding and subtracting terms to push the x terms to the left side of the equation.}\\ 53 [$a] x - [$c] x &= -[$d] y + [$b] && \text{Balancing the equation.}\\ 54 [$ac] x &= -[$d] y + [$b] && \text{Collecting like terms.}\\ 55 \frac{[$ac] x}{ [$ac]} &= \frac{-[$d] y + [$b]}{[$ac]} && \text{Dividing by the leading coefficient.}\\ 56 x &= \frac{([$ac])[$dm] y + ([$ac]) [$bm]}{[$ac]} && \text{See the common factors of the fraction.}\\ 57 x &= [$dm] y + [$bm] && \text{Reduced.} 58 \end{aligned}``] 59 60 61 END_PGML_SOLUTION 62 63 ENDDOCUMENT();

In reply to tim Payer

Re: Free Trial webwork version 2.8 is generating "Context" errors.

by Davide Cervone -
This was a problem in PGML.pl that was fixed in March 2014 (in version 2.8.1). See this comment for details.

One work-around is to make sure that MathObjects.pl is loaded beforePGML.pl in the loadMacros() call. Another would be to get the current copy of PGML.pl and put it in your course/templates/macros directory.