Writing Your Own Homework Problems Using PGML
(→Typical PGML Problem Example) |
(Adding link to 2015 PREP workshop dealing with problem authoring which focuses on using PGML) |
||
(10 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | + | = Intro To Writing Your Own Homework Problems Using PGML = | |
− | + | ||
− | + | ||
− | = Writing Your Own Homework Problems Using PGML = | + | |
== Introduction == | == Introduction == | ||
Line 11: | Line 8: | ||
* If PGML is so great, you may wonder why you don't see it used everwhere in the publically available WebWork problem libraries. Many of those libraries were written before PGML existed. Since many newcomers base their own custom problems on those same libraries, there is a lot (and a growing!) amount of problems that are not PGML based. However, now that you know the truth you can be one of the fortunate ones to start using PGML now. Even better is the fact that you can convert non-PGML based problems you like to PGML often quite easily. | * If PGML is so great, you may wonder why you don't see it used everwhere in the publically available WebWork problem libraries. Many of those libraries were written before PGML existed. Since many newcomers base their own custom problems on those same libraries, there is a lot (and a growing!) amount of problems that are not PGML based. However, now that you know the truth you can be one of the fortunate ones to start using PGML now. Even better is the fact that you can convert non-PGML based problems you like to PGML often quite easily. | ||
+ | == [http://webwork.maa.org/wiki/Problem_Authoring_Videos MAA PREP 2015 Problem Authoring Course Videos] == | ||
== Typical PGML Problem Example == | == Typical PGML Problem Example == | ||
Line 29: | Line 27: | ||
TEXT(beginproblem()); | TEXT(beginproblem()); | ||
$showPartialCorrectAnswers = 1; | $showPartialCorrectAnswers = 1; | ||
− | + | ||
+ | The contents in the above box will rarely change much in your custom WebWork homework problems. Depending on what features | ||
+ | you use in your problems, you may or may not need all the macros I have loaded above. On the other hand, one strategy is to | ||
+ | always include any and every macro you have ever used in the past, or will use in the future, so as to not have to bother thinking about this initial boilerplate. | ||
+ | |||
Context("Numeric") ; | Context("Numeric") ; | ||
Context()->flags->set(tolerance => 0.01); | Context()->flags->set(tolerance => 0.01); | ||
+ | |||
+ | You will want to define a "context" for your PGML homework problem. If your answers will be numbers or formulas, then just set it to Numeric and do not worry about it for now. Later you may want to learn about other contexts to allow things like strings and inequalities. The second line tells WebWork to accept student submissions as correct if they differ from the correct answer given below by 1% or less. | ||
+ | |||
+ | ###################################################################### | ||
BEGIN_PGML | BEGIN_PGML | ||
− | Simplify [`2x + 4x + 5x`]. | + | Simplify [`2 + 4 \cdot 5`]. |
− | [____________]{ | + | [____________]{"22"} |
+ | Now simplify [`2x + 4x + 5x`]. | ||
+ | [____________]{"11x"} | ||
END_PGML | END_PGML | ||
###################################################################### | ###################################################################### | ||
+ | |||
+ | The is what you will be changing the most as you create your own problems. What the student sees always goes in between BEGIN_PGML and END_PGML. If you want to include LaTeX, simply enclose it inside [` and `]. Your answer field is represented by [____________]. After the answer field, you specify the correct answer you desire in braces. In this example, the correct answer for the first question is a number and for the second it is an algebraic expression. If your answer is a number or formula, you can happily use the Compute function for a long time. Your problems can have only 1 question or even more than 2 if you wish. By the way, the hash marks which being and end this section are optional. I include them so I can easily see this part of any PGML problem quickly and easily. | ||
+ | |||
ENDDOCUMENT(); | ENDDOCUMENT(); | ||
− | + | This last part is more boilerplate that should not change much if at all. | |
+ | |||
+ | == For Further Study == | ||
+ | |||
+ | * '''[[Introduction to PGML]]''' -- a more complete introduction to PGML | ||
+ | * '''[[:Category:PGML|PGML Reference materia|]]''' -- full reference material on PGML | ||
+ | |||
+ | For further exploration of PGML, see the many [https://courses1.webwork.maa.org/webwork2/cervone_course/PGML-examples/?login_practice_user=true|live PGML examples] |
Latest revision as of 10:21, 6 May 2016
Contents |
Intro To Writing Your Own Homework Problems Using PGML
Introduction
- PGML makes writing your own homework problems so much nicer than what came before. Many chores which previously were difficult are now easier, if not automated away. The best part is that there is little to learn to get started. PGML is so elegant and intuitive that you can often get started by simply viewing and tweaking existing PGML based problem files.
So Why Isn't PGML Used Everywhere If It Is So Great?
- If PGML is so great, you may wonder why you don't see it used everwhere in the publically available WebWork problem libraries. Many of those libraries were written before PGML existed. Since many newcomers base their own custom problems on those same libraries, there is a lot (and a growing!) amount of problems that are not PGML based. However, now that you know the truth you can be one of the fortunate ones to start using PGML now. Even better is the fact that you can convert non-PGML based problems you like to PGML often quite easily.
MAA PREP 2015 Problem Authoring Course Videos
Typical PGML Problem Example
DOCUMENT(); loadMacros( "PGstandard.pl", "PGML.pl", "MathObjects.pl", "PGcourse.pl", "parserNumberWithUnits.pl", "contextArbitraryString.pl", "parserMultiAnswer.pl", "parserPopUp.pl", "contextInequalities.pl", "PGgraphmacros.pl", ); TEXT(beginproblem()); $showPartialCorrectAnswers = 1;
The contents in the above box will rarely change much in your custom WebWork homework problems. Depending on what features you use in your problems, you may or may not need all the macros I have loaded above. On the other hand, one strategy is to always include any and every macro you have ever used in the past, or will use in the future, so as to not have to bother thinking about this initial boilerplate.
Context("Numeric") ; Context()->flags->set(tolerance => 0.01);
You will want to define a "context" for your PGML homework problem. If your answers will be numbers or formulas, then just set it to Numeric and do not worry about it for now. Later you may want to learn about other contexts to allow things like strings and inequalities. The second line tells WebWork to accept student submissions as correct if they differ from the correct answer given below by 1% or less.
###################################################################### BEGIN_PGML Simplify [`2 + 4 \cdot 5`]. [____________]{"22"} Now simplify [`2x + 4x + 5x`]. [____________]{"11x"} END_PGML ######################################################################
The is what you will be changing the most as you create your own problems. What the student sees always goes in between BEGIN_PGML and END_PGML. If you want to include LaTeX, simply enclose it inside [` and `]. Your answer field is represented by [____________]. After the answer field, you specify the correct answer you desire in braces. In this example, the correct answer for the first question is a number and for the second it is an algebraic expression. If your answer is a number or formula, you can happily use the Compute function for a long time. Your problems can have only 1 question or even more than 2 if you wish. By the way, the hash marks which being and end this section are optional. I include them so I can easily see this part of any PGML problem quickly and easily.
ENDDOCUMENT();
This last part is more boilerplate that should not change much if at all.
For Further Study
- Introduction to PGML -- a more complete introduction to PGML
- PGML Reference materia| -- full reference material on PGML
For further exploration of PGML, see the many PGML examples