Forum archive 2000-2006

Michael Gage - PG language

Michael Gage - PG language

by Arnold Pizer -
Number of replies: 0
inactiveTopicPG language topic started 4/25/2000; 11:06:45 PM
last post 8/15/2000; 8:03:05 PM
userMichael Gage - PG language  blueArrow
4/25/2000; 11:06:45 PM (reads: 15907, responses: 2)


Intro to the PG language

ww_bluesq:Tutorial
Step-by-step introduction to the process of writing a problem and the basic types of problems. This covers all the essential PG macros. Shows how to use each of the various list objects useful for creating matching questions, true/false questions, and multiple choice questions that are intuitive to the students. Even covers the less tested idea of using Java or Javascript in your problems.

 

ww_bluesq: WeBWorK Newbie Guide
A Dartmouth College website, maintained and created by Prof. Tom Shemanske, covers many of the basics needed to understand and use the WeBWork system. It also contains several references on LaTeX that range from covering the essentials to being extremely comprehensive.

 

ww_bluesq:PG language basics
Basic PG language reference material. Covers some perl syntax necessary for understanding how to better manipulate data in problem. Also contains list of macros and basic references on managing answers and using answer evaluators.

 

ww_bluesq:PG reference documents
Primary reference documents. These are the comments taken directly from comments in the source code of all of the major macro files and PG packages. These comments tend to be somewhat technical and often terse but are usually the most up to date because they come directly from source itself.

ww_bluesq: manpages Detailed descriptions of individual macros. (under construction)

 

PG overview

PG language stands for Problem Generating language. It is implemented as a suite of Perl macros. The underlying constructions are for the most part identical with those in Perl with the exception of the use of the backslash which is replaced by ~~ (see Perl basics below).

The parts of the problem description which require calculations are written in Perl. To avoid damage to the computer system, only a portion of the Perl language is available. Commands which write to disk and system commands are disabled.

Mathematical formulas are written using the syntax of LaTeX. Most commands in LaTeX start with a backslash and because of this, the backslash is reserved for LaTeX math formulas.

<| Post or View Comments |>


userMichael Gage - PG language basics  blueArrow
8/15/2000; 7:57:01 PM (reads: 10560, responses: 0)

PG basics

ww_bluesq:Basic Perl Syntax
Fortunately you only need a little knowledge of Perl in order modify or write problems for WeBWorK. If you know more, you can write very powerful macros. It's possible to outgrow many problem generating languages as you become more ambitious about the kind of math problems you'd like to present. This is unlikely to happen with PG because it is based on Perl, and allows you nearly full access to the constructs of that very powerful language.
ww_bluesq:The problem text
Details how The problem text is evaluated and printed when placed within the BEGIN_TEXT .... END_TEXT construction.

Arithmetic functions in PG

 

ww_bluesq:Accepted math functions

More on answer evaluators

( this doesn't yet have all of the latest macros -- check PGanswermacros.pl for more)
ww_bluesq:PG answer evaluators
Describes some of the subroutines which can be used for checking the answers.

Numerical methods

Advanced graphics

<| Post or View Comments |>


userMichael Gage - PG advanced reference  blueArrow
8/15/2000; 8:03:05 PM (reads: 9960, responses: 0)

PG language Reference

Specifications of data types

Managing answers: Answer label specifications.
Describes the rules for labeling answer rules and answer evaluators, as well as the macros which define answer rules and answer evaluators.
Answer hash datatype specification
Each answer evaluator should accept a single input from the student and return an answer hash satisfying these specifications.
PG environment variables
A list of all of the variables that are predefined for a WeBWorK PG problem.
Define your own environment variables
How to define additional environment variables in webworkCourse.ph using %PG_environment

List of Pod documents

 

Detailed descriptions of macros

These descriptions are intermixed with the code itself. They are likely to be somewhat technical and terse, but, since they are close to the actual code, they are also likely to be the most up-to-date and complete descriptions available.

Note: If your are accessing this page from webwork.math.rochester.edu, these descriptions may not be viewable. If not, connect to our dynamic site webhost.math.rochester.edu/webworkdocs to view the descriptions.

ww_bluesq:PGtranslator.pm
The main code for rendering PG problems is found here. There is an example showing the PGtranslator methods used in rendering a problem.
ww_bluesq:Macros in the file PG.pl
This macro file contains the macros which define the basic aspects of the Program Generating language. DOCUMENT(); TEXT(); HEADER_TEXT(); ANS(); ENDDOCUMENT;
ww_bluesq:Macros in the file dangerousMacros.pl
This implements macros that require access to disk files: alias, loadMacros,insertGraph,tth
ww_bluesq:Macros in the file extraAnswerEvaluators.pl
As the name implies, this contains additional answer evaluators contributed by John Jones at Arizona State University.
ww_bluesq:Macros in the file PGasu.pl
Additional macros contributed by John Jones at Arizona State University.
ww_bluesq:Macros in the file PGanswermacros.pl
This contains some details on how to use the basic answer evaluator factories -- num_cmp, str_cmp and function_cmp. This documentation, and the implementation of answer macros is due for redesign and streamlining this summer.
ww_bluesq:Macros in the file PGbasicmacros.pl
The majority of the commonly used macros are in this file, including ans_rule
ww_bluesq:Macros in the file PG_CAPAmacros.pl
Contains the runtime macros used to render files translated from the CAPA language. (Currently these are mostly physics problems.)
ww_bluesq:Macros in the file PGchoicemacros.pl
Describes the basic macros for implimenting matching lists and true false questions. For examples see the Matching list example and the True false example above. For more details look at the Match and Select packages described below. Some older macros which were used in the past to implement matching lists are also available, for backward compatibility.
ww_bluesq:Macros in the file PGcomplexmacros.pl
This describes some of the macros for printing and manipulating complex numbers. See also Complex.pm
ww_bluesq:Macros in the file PGdiffeqmacros.pl
Describes the macros for use with differential equations. While these macros have been used in courses at the University of Rochester, these macros have not yet been completely tested and polished. Regard them as a Beta release and use at your own risk.
ww_bluesq:Macros in the file PGgraders.pl
A collection of alternative graders -- different methods of scoring the problems.
ww_bluesq:Macros in the file PGgraphmacros.pl
Describes the macros for simple uses of the graph objects.
ww_bluesq:Macros in the file PGmatrixmacros.pl
This describes some of the macros which manipulate and display matrices. See also Matrix.pm.
ww_bluesq:Macros in the file PGnumericalmacros.pl
This describes some of the numerical routines, including Newton's method, and integration routines, which can be used in defining PG problems.
ww_bluesq:Macros in the file PGpolynomialmacros.pl
Describes the macros for manipulating polynomials as objects.
ww_bluesq:Macros in the file PGstatisticsmacros.pl
Describes a few macros for statistics, in particular there are formulas for calculating the area under the normal distribution between two points (as well as the inverse of this function). See also Distributions.pm and Regression.pm
ww_bluesq:Macros in the file StdConst.pg and StdUnits.pg
These files contain runtime constants used by files translated from the CAPA language.

 

Detailed descriptions of packages augmenting the PG language:

These descriptions are intermixed with the code itself. They are likely to be somewhat technical and terse, but, since they are close to the actual code, they are also likely to be the most up-to-date and complete descriptions available.
The AnswerHash.pm interface
Describes the structure of the AnswerHash object used by all answer evaluators. Also contains a description of the AnswerEvaluator object which can be used to build answer evaluators.
ww_bluesq:The Circle.pm interface
Describes the circle graph object.
ww_bluesq:The Complex.pm interface
Describes complex number objects.
ww_bluesq:The Distributions.pm interface
Objects for statistics problems
ww_bluesq:The Fun.pm interface
Describes the commands recognized by the function objects (which live in the graph object). This is useful for creating more complicated graphics examples than those described in PGgraphmacros.pl for constructing PG macros such as those in PGgraphmacros.pl. T hey can also be used directly to create things such as parametric functions, or functions with complicated definitions or other special functions that are not easily handled by the macro plot_functions in PGgraphmacros.pl.
ww_bluesq:The Hermite.pm interface
Describes the commands for defining a Hermite polynomial (for use in drawing graphs).
ww_bluesq:The Label.pm interface
Describes the label graph object.

 

ww_bluesq:The List.pm interface
The list object is a powerful replacement for both the Match.pm and Select.pm modules. It also has additional capabilities.
ww_bluesq:The Match.pm interface
Describes the commands for writing questions involving matching.
ww_bluesq:The Matrix.pm interface
Describes matrix objects and operations
ww_bluesq:The Multiple.pm interface
Describes the commands for writing multiple choice objects.
ww_bluesq:The PGrandom.pm interface
Low level pseudo-random generator object. Used mostly in other macro files.
ww_bluesq:The Regression.pm interface
Objects for use in statistics problems.
ww_bluesq:The Select.pm interface
Describes the commands for writing true-false questions or lists of short answer questions.
ww_bluesq:The Units.pm interface
Describes the basic command for using units in answers. There is also a complete List of Units one can use. See also macros in the file PGanswermacros.pl
ww_bluesq:The VectorField.pm interface
Describes the commands for drawing graphs of vector fields.
ww_bluesq:The WWPlot.pm interface
Describes the commands recognized by the graph objects. Useful for constructing PG macros such as the ones in PGgraphmacros.pl
ww_bluesq:The GD.pm interface
Each WWPlot object contains a GD object in which to draw. The GD.pm module is maintained on CPAN. You can reach the GD object within WWplot like so: $gd_object = $wwplot_object->im$.

<| Post or View Comments |>