Difference between revisions of "PGLabs"
(25 intermediate revisions by 3 users not shown)  
Line 1:  Line 1:  
−  ==PG Labs== 

Online labs for rendering of PG code. These two 
Online labs for rendering of PG code. These two 

labs allow you to experiment with PG syntax. 
labs allow you to experiment with PG syntax. 

−  === Test PG code fragments === 
+  === Test your PG code fragments === 
−  +  Click on this link to go to PG calculator: 

−  For example: 

+  https://demo.webwork.rochester.edu/webwork2/wikiExamples/MathObjectsLabs2/2/?login_practice_user=true 

−  Context("Numeric"); 

+  For example you could enter the code fragment below into the calculator: 

−  $f = Compute("x^23x+5"); 

+  
−  $fp = $f>D; # calculate the derivative 

+  Context("Numeric"); 

−  TEXT($fp>cmp>evaluate("2x3")>pretty_print ); 

+  $f = Compute("x^23x+5"); 

+  $fp = $f>D; # calculate the derivative 

+  checkAnswer($fp, "2x3"); # the first argument is a MathObject, the second the student's answer string 

* On the last line <code>TEXT</code> prints the results of (reading from left to right) 
* On the last line <code>TEXT</code> prints the results of (reading from left to right) 

−  ** Constructing the AnswerEvaluator for the contents of the Formula $fp 
+  ** Constructing the AnswerEvaluator for the contents of the Formula <code>$fp</code> 
−  ** Evaluating the string "2x3" using this AnswerEvaluator to produce an AnswerHash 
+  ** Evaluating the string <code>"2x3"</code> using this AnswerEvaluator to produce an AnswerHash 
−  ** Recursively representing the contents of the AnswerHash in a nice table 
+  ** Recursively representing the contents of the AnswerHash in a nice table. 
+  
+  <code>checkAnswer()</code> inserts its arguments into a more complicated command. e.g. last line above becomes: 

+  
+  TEXT($fp>cmp>evaluate("2x3")>pretty_print); 

+  
+  === PGML markup lab === 

+  * Experiment with the new PG markup language syntax (PGML) which simplifies the graphical layout of the mathematics question. 

+  
+  https://courses1.webwork.maa.org/webwork2/cervone_course/PGML?login_practice_user=true 

−  === Experimental PGML markup lab === 

+  Several dozen questions illustrating the use of PGML: 

−  * Experiment with the new PG markup language syntax (PGML)] which simplifies the graphical layout 

−  of the mathematics question. This is still under development and can't yet be used in standard 

−  PG problems. 

−  +  https://courses1.webwork.maa.org/webwork2/cervone_course/PGMLexamples/?login_practice_user=true 

+  To use these commands in your own courses you will need to include <code>PGML.pl</code> in your <code>loadMacros()</code> segment. Start the display of your problem text with <code>BEGIN_PGML</code> which expands to 

−  Homework sets using PGML 

+  TEXT(PGML::Format2(<<'END_PGML')); 

−  http://hosted2.webwork.rochester.edu/webwork2/cervone_course/PGMLexamples/?effectiveUser=practice1&displayMode=images&showOldAnswers=0&user=practice1&key=TaYZ1D0Uzj1mUYGwRMY7xqkupxGtc1ha 

+  and end with <code>END_PGML</code>. These are used instead of the usual <code>BEGIN_TEXT/END_TEXT</code> construction. You can use both <code>BEGIN_TEXT/END_TEXT</code> and <code>BEGIN_PGML/END_PGML</code> in the same problem, if you wish. See [[SampleProblem4]] for an example (with explanation) that uses PGML. 

[[Category:Authors]] 
[[Category:Authors]] 
Latest revision as of 21:01, 26 February 2020
Online labs for rendering of PG code. These two labs allow you to experiment with PG syntax.
Test your PG code fragments
Click on this link to go to PG calculator:
For example you could enter the code fragment below into the calculator:
Context("Numeric"); $f = Compute("x^23x+5"); $fp = $f>D; # calculate the derivative checkAnswer($fp, "2x3"); # the first argument is a MathObject, the second the student's answer string
 On the last line
TEXT
prints the results of (reading from left to right) Constructing the AnswerEvaluator for the contents of the Formula
$fp
 Evaluating the string
"2x3"
using this AnswerEvaluator to produce an AnswerHash  Recursively representing the contents of the AnswerHash in a nice table.
 Constructing the AnswerEvaluator for the contents of the Formula
checkAnswer()
inserts its arguments into a more complicated command. e.g. last line above becomes:
TEXT($fp>cmp>evaluate("2x3")>pretty_print);
PGML markup lab
 Experiment with the new PG markup language syntax (PGML) which simplifies the graphical layout of the mathematics question.
https://courses1.webwork.maa.org/webwork2/cervone_course/PGML?login_practice_user=true
Several dozen questions illustrating the use of PGML:
https://courses1.webwork.maa.org/webwork2/cervone_course/PGMLexamples/?login_practice_user=true
To use these commands in your own courses you will need to include PGML.pl
in your loadMacros()
segment. Start the display of your problem text with BEGIN_PGML
which expands to
TEXT(PGML::Format2(<<'END_PGML'));
and end with END_PGML
. These are used instead of the usual BEGIN_TEXT/END_TEXT
construction. You can use both BEGIN_TEXT/END_TEXT
and BEGIN_PGML/END_PGML
in the same problem, if you wish. See SampleProblem4 for an example (with explanation) that uses PGML.