## WeBWorK Main Forum

### Library of basic example problems ### Library of basic example problems

by James Mc Laughlin -
Number of replies: 5
I was looking around the site, trying to find if there was a small library of example problems, but could not find one.

What I am thinking of is a list of example problems that illustrate how to set up problems that need the different kinds of answers inputted, or need a particular kind of set up (random integers from a particular set, for example).

I know the art of problem writing cleverly combines several aspects of problem writing together (for example writing code to generate the Cartesian product of two sets, which becomes the answer), but what I am imagining are stripped down, bare bones examples of problems, so that a beginner like me could download the sample problem and modify it by changing some obvious lines of code.

As an example of what I am thinking of, in my previous post I asked how could I set things up so that students would have to input a list of ordered pairs, with letters as entries, as the answer.

Davide Cervone kindly answered and posted the code that I was able to incorporate into my problem to get it to work (below I changed Davide's code slightly to fit the way I usually set up answers, but his code would have worked as well, and is neater).

So taking this as an example, what I am envisioning is that on this sample problem library page with the most basic of code there would be a line with a link that contains text something like

"A problem with a list of ordered pairs, with letters as entries, as the answer", and when you click on the link it brings up a .pg file with code something like this:

# some lines of information about the author/source of the example problem
DOCUMENT(); # This should be the first executable line in the problem.
"PG.pl",
"PGbasicmacros.pl",
"PGchoicemacros.pl",
"PGauxiliaryFunctions.pl",
"MathObjects.pl"
);

TEXT(beginproblem());
#$showPartialCorrectAnswers = 1; #$showPartialCredit = 1;

Context("Numeric");
Context()->strings->are(
B => {caseSensitive=>1},
E => {caseSensitive=>1},
F => {caseSensitive=>1},
H => {caseSensitive=>1},
);

BEGIN_TEXT
# Some example of a very basic illustrative problem.
$$S = \lbrace (B,E),(B,F),(B,H) \rbrace$$.
$BR List the elements of $$S$$.$BR

$$S=\lbrace$$\{ans_rule(15)\}$$\rbrace$$.

END_TEXT

ANS(Compute("(B,E),(B,F),(B,H)")->cmp);

ENDDOCUMENT(); # This should be the last executable line in the problem.

This may sound trivial to experienced problem writers, but such a library would be a fantastic help to novices like myself.

If there is such a library and I have not found it yet, my apologies to its creator and its contributors. In reply to James Mc Laughlin

### Re: Library of basic example problems

by Arnold Pizer -
Hi,

This doesn't answer your question directly, but have you found http://webwork.maa.org/wiki/Authors, especially http://webwork.maa.org/wiki/Category:Subject_Area_Templates and http://webwork.maa.org/wiki/Problem_Techniques

Arnie ### Re: Library of basic example problems

by James Mc Laughlin -
Thanks, Arnie.

I will investigate there.

I sort of suspected that I had not looked deep enough.

Jimmy In reply to James Mc Laughlin

### Re: Library of basic example problems

by Sean Fitzpatrick -
This summer, one of my colleagues hired a student to help her go through all of the libraries, marcos, contexts, etc. and put together a collection of templates and programming examples. I got permission from her to put everything on a public GitHub repository; you can find the fruits of their efforts here:

https://github.com/ULeth-Math-CS/WeBWorK

The programming examples are not questions. They're an attempt at producing an exhaustive list of every possible way of inputting and evaluating something using the various contexts.
In the documentation there's a nice flowchart for deciding which context to use for a given problem.

I hope this is useful. It's the beginnings of what will hopefully be a longer project (done mostly over summers), so it's not yet as polished as it could be. ### Re: Library of basic example problems

by James Mc Laughlin -
Thanks Sean.

I will try there the next time I get stuck. 