# Writing Your Own Homework Problems Using PGML

From WeBWorK

(Difference between revisions)

(→Typical PGML Problem Example) |
|||

Line 13: | Line 13: | ||

== Typical PGML Problem Example == | == 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; | ||

+ | ###################################################################### | ||

+ | |||

+ | Context("Numeric") ; | ||

+ | Context()->flags->set(tolerance => 0.01); | ||

+ | |||

+ | BEGIN_PGML | ||

+ | Simplify [`2x + 4x + 5x`]. | ||

+ | |||

+ | [____________]{Compute("11*x")} | ||

+ | END_PGML | ||

+ | |||

+ | ###################################################################### | ||

+ | ENDDOCUMENT(); |

## Revision as of 03:56, 21 November 2012

(Note: This page is under construction by Christian Seberino... Nov 21, 2012. )

## Contents |

# 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.

## 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;

Context("Numeric") ; Context()->flags->set(tolerance => 0.01);

BEGIN_PGML Simplify [`2x + 4x + 5x`].

[____________]{Compute("11*x")} END_PGML

ENDDOCUMENT();