Errors parsing PGML:
Error evaluating command: Unrecognized character \xE2; marked by <-- HERE after n;
image(<-- HERE near column 22.
It looks as if you have your problem file now, but I'm not seeing the image. The error message "Error evaluating command: Unrecognized character \xE2;" stems from having a smart double quote in the image call: “ instead of ". Blech. I changed the smart quotes to the dumb quote and it loads fine.
That said, it looks as if the image file "file.png" doesn't exist in the directory, which means that the problem loads with an error and broken image.
Does that help?
Gavin
Is this in the PREP2015 course? I don't seem to see the directory anywhere. If it is, can you tell me where your Hoffman_21_2.pg file currently lives?
The directory was a little hidden:
local/Payer-Homework1/Hoffman_21_2
Thanks, Tim
PG question failed to render
Unable to obtain error messages from within the PG question.
WeBWorK Warnings
WeBWorK has encountered warnings while processing your request. If this occured when viewing a problem, it was likely caused by an error or ambiguity in that problem. Otherwise, it may indicate a problem with the WeBWorK system itself. If you are a student, report these warnings to your professor to have them corrected. If you are a professor, please consult the warning output below for more information.
Warning messages
Processing of this PG problem was not completed. Probably because of a syntax error.
The translator died prematurely and no PG warning messages were transmitted. at /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Problem.pm line 932.
Request information
Time | Tue Jun 30 10:14:51 2015 |
Method | GET |
URI | /webwork2/2015_PREP_Problem_Authoring/Payer-Homework1/28/ |
# Webwork Workshop 2015 for Payer, Homework 1, Practice: # Exercises for Survival and Renewal applications: pg460, #34 DOCUMENT(); loadMacros("PGstandard.pl", "MathObjects.pl", "PGML.pl"); Context("Numeric")->flags->set( tolerance => 1.0, tolType => 'absolute', ); Context()->variables->add(t=>"Real"); $po = Real(random(1000, 9000,1000)); $R =Real(random(8, 40,1)); $T =Real(random(5, 14,1)); $ex =Real(random(0.01, 0.15,0.01)); $a =Real(random(5, 14,1)); $c =Real(random(5, 14,1)); $cb =Real(random(5, 14,1)); $g =Formula("($a/($cb))"); #$g1 =Compute("($cbr-1)"); $g1 =Formula("exp(-$ex*$T)*($po+($R/$ex)*(exp($ex*$T)-1))"); $g2 =floor($g1); TEXT(beginproblem()); BEGIN_PGML >> [@ image("Dragonfly_BryonRoberts.png", width=>727, height=>620, tex_size=>500) @]* Bryon_Roberts_Copy_Right_2007.<< During the summer months a dragonfly population at the Musky marsh follows a survival and renewal equation with an initial population of [`P_0 = [$po]`] dragonflies, a renewal rate of [`R = [$R]`] , and a survival function of [``S(t) = e^{-[$ex] t}``] at time [`t`] in weeks. Find the population of dragonflies at [`T = [$T]`] weeks. *Note!* Round your decimal answer down to the number of complete dragonflies. [______________________]{$g2} END_PGML BEGIN_PGML_SOLUTION *SOLUTION* To find the average number of bacteria over the first [`[$c]`] minutes we must integrate the function multiplied by the reciprocal of the limits of integration. [``\begin{aligned}&\\ Average &= \frac{1}{[$c] - 0}\int_{0}^{[$c]}[$a] e^{[$b] t} dt\\ Average &= \frac{[$a]}{[$c]}\int_{0}^{[$c]} e^{[$b] t} dt && \text{ Pull the constant.}\\ Average &= \frac{[$a]}{[$c]}\frac{e^{[$b] t}}{([$b] t)'} \Big|_0^[$c] && \text{ Integrate the exponential.}\\ Average &= \frac{[$a]}{[$c]\times[$b]}\left(e^{[$c]\times[$b]} -e^{0\times[$b]}\right) && \text{Pull constants and Evaluate.}\\ Average &= \frac{[$a]}{[$cb]}\left(e^{[$cb]} -1\right) && \text{Reduce.}\\ Average &= [$g]\left(e^{[$cb]} -1\right) && \text{Reduce.}\\ Average &= [$g2] && \text{The average number of bacteria over the first } [$c] \text{ minutes.} \end{aligned}``] END_PGML_SOLUTION ENDDOCUMENT();
The error message you give above suggests that you added the problem to a homework set before you used the File Manager to move the .pg file into the sub-directory, so that homework set still points to the file in its original location.
Your homework set seems to include two copies of the problem (problems 27 and 28 point point to the original location of the file). All the other files in that homework set don't seem to be available. I have changed the location of problem 28 to point to the new location, so you should be able to view the problem with its image using problem 28 from your homework set. Problem 27 still points to the old location. But there is a copy of the .pg file there as well. If I were you, I'd remove that one and only keep the one in the sub-directory. Otherwise, you are likely to edit the wrong one and be confused about why the changes aren't showing up when you view it.
So from what I can see, you have everything in place and working, it was just the homework set that had the wrong file name in it, which I have fixed for problem 28.
Davide
# Webwork Workshop 2015 for Payer, Homework 1, Problem 2: # Given the coordinates for the critical point of a general function the student # should be able to determine the constants of the parameters for the # function. Then evaluate the function for a specified input. DOCUMENT(); loadMacros("PGstandard.pl", "MathObjects.pl", "PGML.pl"); loadMacros("contextFraction.pl"); Context("Numeric"); Context("Fraction"); $m = list_random(3,6,10,12,15,20,30); $d = Real(random(2,10,1)); $t1 = Real(random(1,3,1)); $h = 60; ($mr,$hr) = reduce($m,$h); $frac =Compute("$m/$h"); $k1 = Compute("$h/$m"); $a = Compute("$k1*$d"); $a1 = Compute("$k1*$d*e"); $at = Compute("$a*$t1"); $kt = Compute("$k1*$t1"); $kt1 = Compute("1-$kt"); $ktn = Compute("$kt-1"); $ans2 = Compute("$at/(e**($ktn))"); Context()->variables->add(A=>"Real"); Context()->variables->add(k=>"Real"); Context()->variables->add(t=>"Real"); TEXT(beginproblem()); BEGIN_PGML >> [@ image("Intravenous.png", width=>694, height=>657, tex_size=>400) @]* An intravenous drug injection.<< The concentration of a particular drug within the bloodstream can be determined by the function: [``C(t) = Ate^{-kt}``], where t is the number of hours since the drug was ingested orally and [`C(t)`] is the concentration of the drug in micrograms per ml of blood. Given that [`A`] and [`k`] are both positive constants. 1. Given that the maximum concentration of [$d] occurs [$m] minutes after ingesting the drug, find the value of [`A`] and [`k`]. [`k`] = [_____]{("60/[$m]")} [`A`] = [_____]{("60*[$d]*e/[$m]")} 2. What is concentration of the drug in the bloodstream [$t1] hours after its ingestion? [`C([$t1])`] = [________]{Compute("(60*[$d]*[$t1]*e**{1-60*[$t1]/[$m]})/[$m]")} END_PGML BEGIN_PGML_SOLUTION *SOLUTION* 1. The maximum concentration of the drug will occur at a critical point because the drug must increase from zero at ingestion and reach a peak value and then gradually dissipate as the body breaks it down. Then the given information yields two equations both of which can be used to solve for [`k`] and [`A`]. The two equations are: [`C(\text{c.p.}) = [$d]`], and [`C'(\text{c.p.}) = 0`], where c.p. = critical point. Recognize that the time in minutes at the maximum concentration must be converted into hours: So t = [$m] minutes = [``\frac{[$m]}{60} = [$frac]``] hours. Then we will use C[``\left([$frac]\right) = [$d]``] and [``C'\left([$frac]\right) = 0``] to solve for the constants of [`k`] and [`A`]. * First apply the prime tics for the product rule and chain rule. [``C'(t) = A(t'e^{-kt} + t(e^{-kt})'(-kt)')``] * Take the derivative. [``C'(t) = A(e^{-kt} -kte^{-kt})``] * Pull the common factor of [``e^{-kt}``] and reduce. [``C'(t) = Ae^{-kt}(1 -kt)``] * Input [`t = [$frac]`] into the derivative and set to zero to solve for [`k`]. [``C'\left([$frac]\right) = Ae^{-[$frac]k}(1 -[$frac]k) = 0``] * Recognize that [`A`] and [``e^{-[$frac]k}``] can not be zero as both are positive. [``\begin{aligned} 1 -[$frac]k &= 0 \\ [$frac]k &= 1 \\ k &= \frac{1}{[$frac]}\\ k &=[$k1] \end{aligned}``] * We can now substitute [`k = [$k1]`] into the general equation of [``C(t) = Ate^{-kt}``] and use [``C\left([$frac]\right) = [$d]``] to solve for [`A`]. [``\begin{aligned} C\left([$frac]\right) &= A([$frac])e^{-3\left([$frac]\right)} = [$d]\\ A([$frac])e^{-1} &= [$d]\\ \frac{A}{[$k1]e} &= [$d]\\ A &= [$a]e \\ A &= [$a1] \end{aligned}``] * Substituting both [`k = [$k1]`] and [`A = [$a]e`] values into the general equation yields the specific equation for the blood concentration: [``\begin{aligned} C(t) &= Ate^{-kt}\\ &= [$a]ete^{-[$k1]t} \end{aligned}``] * Combine the common base of e using the rule of exponents to reduce: [``C(t) = [$a]te^{1-[$k1]t}``] 2. Evaluate [``C(t)``] at [``t = [$t1]``] hours to determine the concentration of the drug in the blood stream. We use the reduced form: [``\begin{aligned} &\\ C([$t1]) &= [$a]([$t1])e^{1-[$k1]([$t1])}\\ & = [$at]e^{1-[$kt]}\\ & = [$at]e^{[$kt1]}\\ & = \frac{[$at]}{e^{[$ktn]}}\\ & = [$ans2] \end{aligned}``] END_PGML_SOLUTION ENDDOCUMENT();
If you use File Manager to move the problem file after it has been added to a homework set, you will get this error. It has nothing to do with the image, only with the fact that you have move the problem from where it was when you added it to the homework set.
The error message:
WeBWorK::Utils::readFile(/opt/webwork/courses/2015_PREP_Problem_Authoring/templates/local/Payer-Homework1/Hoffman_H19_65b.pg) says: failed to read file /opt/webwork/courses/2015_PREP_Problem_Authoring/templates/local/Payer-Homework1/Hoffman_H19_65b.pg: No such file or directoryIs telling you that the .pg file can't be found (because you moved it). Note that the path is
templates/local/Payer-Homework1/Hoffman_H19_65b.pgbut the file is now at
templates/local/Payer-Homework1/Hoffman_H19_65b/Hoffman_H19_65b.pgBecause the file has been moved, the homework set now doesn't know where it is. You either have to change the path in the homework set using the Homework Sets Editor, or add the problem to the set again using its new location.
Again, you have properly set up the directory, moved the .pg file, and uploaded the .png. All of that is correct. You just need to get it linked to the homework set correctly. That is the only missing step.
- for organization: so that the pg file and its associated images stay bundled together in an orderly way
- for maintenance: so that the image files do not get separated from their pg file
- for automatic features implemented in the Library Browser: the creators of webwork designed it so that when webwork searches a directory (and its subdirectories) for pg files to display in the Library Browser, it will recognize constructs like Problem01/Problem01.pg and treat the directory Problem01/ like a single entity that renders one pg problem rather than a subdirectory that contains multiple pg problems.