summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/probsoln/samples
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/probsoln/samples
Initial commit
Diffstat (limited to 'macros/latex/contrib/probsoln/samples')
-rw-r--r--macros/latex/contrib/probsoln/samples/prob-1stprncp.tex63
-rw-r--r--macros/latex/contrib/probsoln/samples/prob-args.tex49
-rw-r--r--macros/latex/contrib/probsoln/samples/prob-easy.tex114
-rw-r--r--macros/latex/contrib/probsoln/samples/prob-easy2.tex137
-rw-r--r--macros/latex/contrib/probsoln/samples/prob-implicit.tex52
-rw-r--r--macros/latex/contrib/probsoln/samples/prob-mchoice.tex37
-rw-r--r--macros/latex/contrib/probsoln/samples/prob-mixed.tex78
-rw-r--r--macros/latex/contrib/probsoln/samples/prob-newdata.tex27
-rw-r--r--macros/latex/contrib/probsoln/samples/prob-nosoln.tex9
-rw-r--r--macros/latex/contrib/probsoln/samples/prob-probspaces.tex33
-rw-r--r--macros/latex/contrib/probsoln/samples/prob-probspaces2.tex43
-rw-r--r--macros/latex/contrib/probsoln/samples/prob-tabmchoice.tex18
-rw-r--r--macros/latex/contrib/probsoln/samples/prob-verb.tex28
-rw-r--r--macros/latex/contrib/probsoln/samples/sample-exclude.pdfbin0 -> 99030 bytes
-rw-r--r--macros/latex/contrib/probsoln/samples/sample-exclude.tex79
-rw-r--r--macros/latex/contrib/probsoln/samples/sample.pdfbin0 -> 81303 bytes
-rw-r--r--macros/latex/contrib/probsoln/samples/sample.tex64
-rw-r--r--macros/latex/contrib/probsoln/samples/sample2.pdfbin0 -> 84108 bytes
-rw-r--r--macros/latex/contrib/probsoln/samples/sample2.tex48
-rw-r--r--macros/latex/contrib/probsoln/samples/sample3.pdfbin0 -> 31898 bytes
-rw-r--r--macros/latex/contrib/probsoln/samples/sample3.tex25
-rw-r--r--macros/latex/contrib/probsoln/samples/sample4.pdfbin0 -> 92887 bytes
-rw-r--r--macros/latex/contrib/probsoln/samples/sample4.tex21
-rw-r--r--macros/latex/contrib/probsoln/samples/sample5.pdfbin0 -> 73973 bytes
-rw-r--r--macros/latex/contrib/probsoln/samples/sample5.tex34
-rw-r--r--macros/latex/contrib/probsoln/samples/sample6.pdfbin0 -> 26997 bytes
-rw-r--r--macros/latex/contrib/probsoln/samples/sample6.tex11
-rw-r--r--macros/latex/contrib/probsoln/samples/sample7.pdfbin0 -> 65512 bytes
-rw-r--r--macros/latex/contrib/probsoln/samples/sample7.tex20
-rw-r--r--macros/latex/contrib/probsoln/samples/sample8.pdfbin0 -> 35582 bytes
-rw-r--r--macros/latex/contrib/probsoln/samples/sample8.tex15
-rw-r--r--macros/latex/contrib/probsoln/samples/sample9.pdfbin0 -> 79269 bytes
-rw-r--r--macros/latex/contrib/probsoln/samples/sample9.tex19
33 files changed, 1024 insertions, 0 deletions
diff --git a/macros/latex/contrib/probsoln/samples/prob-1stprncp.tex b/macros/latex/contrib/probsoln/samples/prob-1stprncp.tex
new file mode 100644
index 0000000000..343d6b3e1c
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/prob-1stprncp.tex
@@ -0,0 +1,63 @@
+ % This file is public domain
+ %
+ % These problems all involve differentiating from 1st principles
+
+\newproblem{dfp:xcube}{%
+Differentiate $f(x) = x^3$ with respect to $x$ by first principles.}{%
+\begin{eqnarray*}
+\frac{dy}{dx} & = & \lim_{\Delta x\rightarrow 0}\frac{f(x+\Delta x) - f(x)}{\Delta x}\\
+ & = & \lim_{\Delta x\rightarrow 0}\frac{(x+\Delta x)^3-x^3}{\Delta x}\\
+ & = & \lim_{\Delta x\rightarrow 0}\frac{(x+\Delta x)(x^2+2x\Delta x+(\Delta x)^2)-x^3}{\Delta x}\\
+ & = & \lim_{\Delta x\rightarrow 0}\frac{x^3+3x^2\Delta x+3x(\Delta x)^2+(\Delta x)^3-x^3}{\Delta x}\\
+ & = & \lim_{\Delta x\rightarrow 0}\frac{3x^2\Delta x+3x(\Delta x)^2+(\Delta x)^3}{\Delta x}\\
+ & = & \lim_{\Delta x\rightarrow 0}3x^2+3x\Delta x + (\Delta x)^2\\
+ & = & 3x^2
+\end{eqnarray*}}
+
+\newproblem{dfp:Ioverxsq}{%
+Differentiate $\displaystyle f(x) = \frac{1}{x^2}$ with respect to $x$ by first principles.}{%
+\begin{eqnarray*}
+\frac{df}{dx} & = & \lim_{\Delta x\rightarrow 0}\frac{\frac{1}{(x+\Delta x)^2}-\frac{1}{x^2}}{\Delta x}\\
+ & = & \lim_{\Delta x\rightarrow 0}\frac{\frac{x^2-(x+\Delta x)^2}{x^2(x+\Delta x)^2}}{\Delta x}\\
+ & = & \lim_{\Delta x\rightarrow 0}\frac{x^2-(x^2+2x\Delta x+(\Delta x)^2)}{x^2\Delta x(x+\Delta x)^2}\\
+ & = & \lim_{\Delta x\rightarrow 0}\frac{-2x\Delta x-(\Delta x)^2}{x^2\Delta x(x+\Delta x)^2}\\
+ & = & \lim_{\Delta x\rightarrow 0}\frac{-2x-\Delta x}{x^2(x+\Delta x)^2}\\
+ & = & \frac{-2x}{x^2x^2}\\
+ & = & -\frac{2}{x^3}
+\end{eqnarray*}}
+
+\newproblem{dfp:sqrtx}{%
+Differentiate from first principles $f(x) = \surd x$}{%
+\begin{eqnarray*}
+\frac{df}{dx} & = & \lim_{\Delta x\rightarrow 0}\frac{\sqrt{x+\Delta x}-\surd x}{\Delta x}\\
+ & = & \lim_{\Delta x\rightarrow 0}\frac{(\sqrt{x+\Delta x}-\surd x)(\sqrt{x+\delta x}+\surd x)}{\Delta x(\sqrt{x+\Delta x}+\surd x)}\\
+ & = & \lim_{\Delta x\rightarrow 0}\frac{x+\Delta x - x}{\Delta x(\sqrt{x+\Delta x}+\surd x)}\\
+ & = & \lim_{\Delta x\rightarrow 0}\frac{\Delta x}{\Delta x(\sqrt{x+\Delta x}+\Delta x)}\\
+ & = & \lim_{\Delta x\rightarrow 0}\frac{1}{\sqrt{x+\Delta x}+\surd x}\\
+ & = & \frac{1}{2\surd x}
+\end{eqnarray*}}
+
+\newproblem{dfp:cons}{%
+Differentiate from first principles $f(x) = c$ where $c$ is a constant.}{%
+\begin{eqnarray*}
+\frac{df}{dx} & = & \lim_{\Delta x\rightarrow 0}\frac{c-c}{\Delta x}\\
+ & = & \lim_{\Delta x\rightarrow 0}0\\
+ & = & 0
+\end{eqnarray*}}
+
+\newproblem{dfp:cosx}{%
+Given
+\begin{eqnarray*}
+\lim_{x \rightarrow 0} \frac{\cos x - 1}{x} & = & 0\\
+\lim_{x \rightarrow 0} \frac{\sin x}{x} & = & 1
+\end{eqnarray*}
+differentiate from first principles $f(x) = \cos x$.}{%
+\begin{eqnarray*}
+\frac{df}{dx} & = & \lim_{\Delta x \rightarrow 0}\frac{f(x + \Delta x) - f(x)}{\Delta x}\\
+ & = & \lim_{\Delta x \rightarrow 0} \frac{\cos(x + \Delta x) - \cos(x)}{\Delta x}\\
+ & = & \lim_{\Delta x \rightarrow 0} \frac{\cos x\cos\Delta x - \sin x\sin\Delta x - \cos x}{\Delta x}\\
+ & = & \lim_{\Delta x \rightarrow 0} \frac{\cos x(\cos\Delta x - 1) - \sin x\sin\Delta x}{\Delta x}\\
+ & = & \cos x\lim_{\Delta x \rightarrow 0}\frac{\cos\Delta x - 1}{\Delta x}
+ - \sin x\lim_{\Delta x \rightarrow 0}\frac{\sin\Delta x}{\Delta x}\\
+ & = & -1 \qquad\mbox{(using given results)}
+\end{eqnarray*}}
diff --git a/macros/latex/contrib/probsoln/samples/prob-args.tex b/macros/latex/contrib/probsoln/samples/prob-args.tex
new file mode 100644
index 0000000000..8276790feb
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/prob-args.tex
@@ -0,0 +1,49 @@
+ % This file is public domain
+ %
+ % These problems require arguments
+%
+ % Arguments: #1->a_2, #2->a_1 and #3->a_0
+ % (Arguments must be integers)
+\newcount\ctr
+\newproblem[3][{1}{2}{3}]{diff:quad}{%
+\(f(x) =
+\ifnum#1=0
+\else
+\ifnum#1=1\else#1\fi x^2
+\fi
+\ifnum#2=0
+\else
+\ifnum#2>0 \ifnum#1=0 \else + \fi \fi
+\ifnum#2=1\else#2\fi x
+\fi
+\ifnum#3=0
+\else
+\ifnum#3>0 \ifnum#2=0 \ifnum#1=0 \else + \fi \else + \fi\fi
+#3
+\fi\)
+}{%
+\(f'(x) =
+\ifnum#1=0
+\else
+\ctr=2
+\multiply\ctr by #1
+\the\ctr x
+\fi
+\ifnum#2=0
+\else
+\ifnum#2>0 \ifnum#1=0 \else + \fi \fi
+#2
+\fi
+ % print 0 if both #1 and #2 are 0
+\ifnum#1=0 \ifnum#2=0 0 \fi\fi
+\)
+}
+
+\begin{defproblem}[1][{6}]{diff:sin}
+\begin{onlyproblem}
+ \(f(x) = \sin(#1x)\)
+\end{onlyproblem}
+\begin{onlysolution}
+ \(f'(x) = #1\cos(#1x)\)
+\end{onlysolution}
+\end{defproblem}
diff --git a/macros/latex/contrib/probsoln/samples/prob-easy.tex b/macros/latex/contrib/probsoln/samples/prob-easy.tex
new file mode 100644
index 0000000000..0527e3e464
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/prob-easy.tex
@@ -0,0 +1,114 @@
+ % This file is public domain
+ %
+ % These are all easy differentiation problems
+
+\newproblem{diffeasy:gpowh}{%
+\(f(x) = g(x)^{h(x)}.\)}{%
+\begin{eqnarray*}
+f(x) & = & e^{\ln g(x)^{h(x)}}\\
+ & = & e^{h(x)\ln g(x)}\\
+f'(x) & = & e^{h(x)\ln g(x)}(h'(x)\ln g(x) + h(x)\frac{g'(x)}{g(x)})\\
+ & = & g(x)^{h(x)}(h'(x)\ln g(x) + \frac{h(x)g'(x)}{g(x)})
+\end{eqnarray*}}
+
+\newproblem{diffeasy:arcsin}{%
+\(y = \arcsin(x)\)}{%
+\[\sin(y) = x\]
+diff. w.r.t. $x$:
+\begin{eqnarray*}
+\cos y \frac{dy}{dx} & = & 1\\
+\frac{dy}{dx} & = & \frac{1}{\cos y}\\
+ & = & \frac{1}{\sqrt{1 - \sin^2y}}\\
+ & = & \frac{1}{\sqrt{1-x^2}}.
+\end{eqnarray*}}
+
+\newproblem{diffeasy:arccos}{%
+$y = \arccos x$.}{%
+\(\cos y = x\)
+diff. w.r.t. $x$:
+\begin{eqnarray*}
+-\sin y \frac{dy}{dx} & = & 1\\
+\frac{dy}{dx} & = & \frac{-1}{\sin y}\\
+ & = & \frac{-1}{\sqrt{1-\cos^2y}}\\
+ & = & \frac{-1}{\sqrt{1-x^2}}
+\end{eqnarray*}}
+
+\newproblem{diffeasy:tan}{%
+\(y = \tan x\)}{%
+\begin{eqnarray*}
+y & = & \tan x\\
+ & = & \frac{\sin x}{\cos x}\\
+\frac{dy}{dx} & = & \frac{\cos x}{\cos x} + \sin x\times\frac{-1}{\cos^2x}\times -\sin x\\
+ & = & 1 + \tan^2x\\
+ & = & \sec^2x.
+\end{eqnarray*}}
+
+\newproblem{diffeasy:arctan}{%
+\(y = \arctan x = \tan^{-1}x\)}{%
+\[\tan y = x\]
+diff w.r.t. $x$:
+\begin{eqnarray*}
+\sec^2y\frac{dy}{dx} & = & 1\\
+\frac{dy}{dx} & = & \frac{1}{\sec^2y}\\
+ & = & \frac{1}{1+\tan^2y}\\
+ & = & \frac{1}{1+x^2}
+\end{eqnarray*}}
+
+\newproblem{diffeasy:cot}{%
+\(y = (\tan x)^{-1} = \cot x\)}{%
+\begin{eqnarray*}
+\frac{dy}{dx} & = & -(\tan x)^{-2}\sec^2x\\
+ & = & -\frac{\cos^2x}{\sin^2x}\cdot\frac{1}{\cos^2x}\\
+ & = & \frac{-1}{\sin^2x}\\
+ & = & -\csc^2x.
+\end{eqnarray*}}
+
+\newproblem{diffeasy:cosxsqsinx}{%
+$y = \cos(x^2)\sin x$.}{%
+\[\frac{dy}{dx} = -\sin(x^2)2x\sin x + \cos(x^2)\cos x\]}
+
+\newproblem{diffeasy:xlnx}{%
+$y = (x+1)\ln(x+1)$.}{%
+\begin{eqnarray*}
+\frac{dy}{dx} & = & \ln(x+1) + \frac{x+1}{x+1}\\
+ & = & 1 + \ln(x+1).
+\end{eqnarray*}}
+
+\newproblem{diffeasy:glng}{%
+$f(x) = g(x)\ln(g(x))$.}{%
+\begin{eqnarray*}
+f'(x) & = & g'(x)\ln(g(x)) + \frac{g(x)}{g(x)}g'(x)\\
+ & = & g'(x)(1+\ln(g(x))).
+\end{eqnarray*}}
+
+\newproblem{diffeasy:sinx/x}{%
+$y = \frac{\sin x}{x}$.}{%
+\[\frac{dy}{dx} = \frac{\cos x}{x} - \frac{\sin x}{x^2}\]}
+
+\newproblem{diffeasy:exp4x}{%
+ $y = \exp(4x)$
+}%
+{%
+ \[\frac{dy}{dx} = 4\exp(4x)\]
+}
+
+\newproblem{diffeasy:exp3x+2}{%
+ $y = \exp(3x+2)$
+}%
+{%
+ \[\frac{dy}{dx} = 3\exp(3x+2)\]
+}
+
+\newproblem{diffeasy:cubic}{%
+ $y=x^3 + 4x^2 - x + 3$
+}%
+{%
+ \[\frac{dy}{dx} = 3x^2 + 8x - 1\]
+}
+
+\newproblem{diffeasy:quad}{%
+ $y=2x^3 + 6x -1$
+}%
+{%
+ \[\frac{dy}{dx} = 6x + 6 = 6(x+1)\]
+}
diff --git a/macros/latex/contrib/probsoln/samples/prob-easy2.tex b/macros/latex/contrib/probsoln/samples/prob-easy2.tex
new file mode 100644
index 0000000000..d6edc7ee3c
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/prob-easy2.tex
@@ -0,0 +1,137 @@
+ % This file is public domain
+ %
+ % These are all easy differentiation problems
+
+\begin{defproblem}{diffeasy:gpowh}%
+\begin{onlyproblem}%
+\(f(x) = g(x)^{h(x)}.\)%
+\end{onlyproblem}%
+\begin{onlysolution}%
+\begin{eqnarray*}
+f(x) & = & e^{\ln g(x)^{h(x)}}\\
+ & = & e^{h(x)\ln g(x)}\\
+f'(x) & = & e^{h(x)\ln g(x)}(h'(x)\ln g(x) + h(x)\frac{g'(x)}{g(x)})\\
+ & = & g(x)^{h(x)}(h'(x)\ln g(x) + \frac{h(x)g'(x)}{g(x)})
+\end{eqnarray*}%
+\end{onlysolution}%
+\end{defproblem}
+
+\begin{defproblem}{diffeasy:arcsin}%
+\begin{onlyproblem}%
+\(y = \arcsin(x)\)%
+\end{onlyproblem}%
+\begin{onlysolution}%
+\[\sin(y) = x\]
+diff. w.r.t. $x$:
+\begin{eqnarray*}
+\cos y \frac{dy}{dx} & = & 1\\
+\frac{dy}{dx} & = & \frac{1}{\cos y}\\
+ & = & \frac{1}{\sqrt{1 - \sin^2y}}\\
+ & = & \frac{1}{\sqrt{1-x^2}}.
+\end{eqnarray*}
+\end{onlysolution}%
+\end{defproblem}
+
+\begin{defproblem}{diffeasy:arccos}%
+\begin{onlyproblem}%
+$y = \arccos x$.%
+\end{onlyproblem}%
+\begin{onlysolution}%
+\(\cos y = x\)
+diff. w.r.t. $x$:
+\begin{eqnarray*}
+-\sin y \frac{dy}{dx} & = & 1\\
+\frac{dy}{dx} & = & \frac{-1}{\sin y}\\
+ & = & \frac{-1}{\sqrt{1-\cos^2y}}\\
+ & = & \frac{-1}{\sqrt{1-x^2}}
+\end{eqnarray*}
+\end{onlysolution}%
+\end{defproblem}
+
+\begin{defproblem}{diffeasy:tan}%
+\begin{onlyproblem}%
+\(y = \tan x\)%
+\end{onlyproblem}
+\begin{onlysolution}%
+\begin{eqnarray*}
+y & = & \tan x\\
+ & = & \frac{\sin x}{\cos x}\\
+\frac{dy}{dx} & = & \frac{\cos x}{\cos x} + \sin x\times\frac{-1}{\cos^2x}\times -\sin x\\
+ & = & 1 + \tan^2x\\
+ & = & \sec^2x.
+\end{eqnarray*}
+\end{onlysolution}%
+\end{defproblem}
+
+\begin{defproblem}{diffeasy:arctan}%
+\begin{onlyproblem}%
+\(y = \arctan x = \tan^{-1}x\)%
+\end{onlyproblem}%
+\begin{onlysolution}%
+\[\tan y = x\]
+diff w.r.t. $x$:
+\begin{eqnarray*}
+\sec^2y\frac{dy}{dx} & = & 1\\
+\frac{dy}{dx} & = & \frac{1}{\sec^2y}\\
+ & = & \frac{1}{1+\tan^2y}\\
+ & = & \frac{1}{1+x^2}
+\end{eqnarray*}
+\end{onlysolution}%
+\end{defproblem}
+
+\begin{defproblem}{diffeasy:cot}%
+\begin{onlyproblem}%
+\(y = (\tan x)^{-1} = \cot x\)%
+\end{onlyproblem}
+\begin{onlysolution}%
+\begin{eqnarray*}
+\frac{dy}{dx} & = & -(\tan x)^{-2}\sec^2x\\
+ & = & -\frac{\cos^2x}{\sin^2x}\cdot\frac{1}{\cos^2x}\\
+ & = & \frac{-1}{\sin^2x}\\
+ & = & -\csc^2x.
+\end{eqnarray*}
+\end{onlysolution}%
+\end{defproblem}
+
+\begin{defproblem}{diffeasy:cosxsqsinx}%
+\begin{onlyproblem}%
+$y = \cos(x^2)\sin x$.%
+\end{onlyproblem}%
+\begin{onlysolution}%
+\[\frac{dy}{dx} = -\sin(x^2)2x\sin x + \cos(x^2)\cos x\]
+\end{onlysolution}%
+\end{defproblem}
+
+\begin{defproblem}{diffeasy:xlnx}%
+\begin{onlyproblem}%
+$y = (x+1)\ln(x+1)$.
+\end{onlyproblem}%
+\begin{onlysolution}%
+\begin{eqnarray*}
+\frac{dy}{dx} & = & \ln(x+1) + \frac{x+1}{x+1}\\
+ & = & 1 + \ln(x+1).
+\end{eqnarray*}
+\end{onlysolution}
+\end{defproblem}
+
+\begin{defproblem}{diffeasy:glng}%
+\begin{onlyproblem}%
+$f(x) = g(x)\ln(g(x))$.
+\end{onlyproblem}
+\begin{onlysolution}%
+\begin{eqnarray*}
+f'(x) & = & g'(x)\ln(g(x)) + \frac{g(x)}{g(x)}g'(x)\\
+ & = & g'(x)(1+\ln(g(x))).
+\end{eqnarray*}
+\end{onlysolution}%
+\end{defproblem}
+
+\begin{defproblem}{diffeasy:sinx/x}
+\begin{onlyproblem}%
+$y = \frac{\sin x}{x}$.
+\end{onlyproblem}
+\begin{onlysolution}%
+\[\frac{dy}{dx} = \frac{\cos x}{x} - \frac{\sin x}{x^2}\]
+\end{onlysolution}%
+\end{defproblem}
+
diff --git a/macros/latex/contrib/probsoln/samples/prob-implicit.tex b/macros/latex/contrib/probsoln/samples/prob-implicit.tex
new file mode 100644
index 0000000000..dd847d96e3
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/prob-implicit.tex
@@ -0,0 +1,52 @@
+ % This file is public domain
+ %
+ % These are all implicit differentiation problems
+
+\newproblem{imd:circ}{%
+Find the gradient of the unit circle ($x^2 + y^2 = 1$).}{%
+Differentiating with respect to $x$ gives:
+\begin{eqnarray*}
+2x + 2y\frac{dy}{dx} & = & 0\\
+\frac{dy}{dx} & = & \frac{-2x}{2y}\\
+ & = & \frac{-x}{\sqrt{1-x^2}}.
+\end{eqnarray*}}
+
+\newproblem{imd:ellipse}{%
+Find the gradient of the ellipse given by $4x^2 + 3y^2 = 25$.}{%
+Differentiating with respect to $x$ gives:
+\begin{eqnarray*}
+8x + 6y\frac{dy}{dx} & = & 0\\
+\frac{dy}{dx} & = & \frac{-8x}{6y}\\
+ & = & \frac{-4x}{\sqrt{25-4x^2}}.
+\end{eqnarray*}}
+
+\newproblem{imd:ysq:xcuov2mx}{%
+Find $\frac{dy}{dx}$, given
+\begin{displaymath}
+y^2 = \frac{x^3}{2-x}
+\end{displaymath}}{%
+Differentiating both sides w.r.t.\ $x$:
+\begin{eqnarray*}
+2y\frac{dy}{dx} & = & \frac{(2-x)3x^2 - x^3(-1)}{(2-x)^2}\\
+ & = & \frac{3x^2(2-x) + x^3}{(2-x)^2}\\
+ & = & \frac{6x^2 - 3x^3 + x^3}{(2-x)^2}\\
+ & = & \frac{6x^2-2x^3}{(2-x)^2}\\
+ & = & 2x^2\frac{3-x}{(2-x)^2}
+\end{eqnarray*}
+Therefore
+\begin{displaymath}
+y\frac{dy}{dx} = x^2\frac{3-x}{(2-x)^2}
+\end{displaymath}}
+
+\newproblem{imd:exy:IIxay}{%
+Differentiate w.r.t.\ $x$:
+\begin{displaymath}
+e^{xy} = 2x + y
+\end{displaymath}}{%
+Differentiating both sides w.r.t.\ $x$:
+\begin{eqnarray*}
+e^{xy}(1y + x\frac{dy}{dx}) & = & 2 + \frac{dy}{dx}\\
+xe^{xy}\frac{dy}{dx} - \frac{dy}{dx} & = & 2 - ye^{xy} \\
+\frac{dy}{dx}(xe^{xy}-1) & = & 2 - ye^{xy}\\
+\frac{dy}{dx} & = & \frac{2-ye^{xy}}{xe^{xy}-1}
+\end{eqnarray*}}
diff --git a/macros/latex/contrib/probsoln/samples/prob-mchoice.tex b/macros/latex/contrib/probsoln/samples/prob-mchoice.tex
new file mode 100644
index 0000000000..22886ce9b2
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/prob-mchoice.tex
@@ -0,0 +1,37 @@
+ % This file is public domain
+ %
+ % These problems are for multiple choice questions
+\newproblem{mc:prod}{%
+Which of the following is the derivative of $x\sin(x)$?
+(Circle the correct answer.)
+\ifthenelse{\boolean{showanswers}}{}%
+{\begin{description}
+\item[A] $\sin(x)$
+\item[B] $x\cos(x)$
+\item[C] $\sin(x) + x\cos(x)$
+\end{description}
+}}{%
+\begin{description}
+\item[A] $\sin(x)$
+\item[B] $x\cos(x)$
+\item[\textcircled{C}] $\sin(x) + x\cos(x)$ (product rule).
+\end{description}
+}
+
+\newproblem{mc:quot}{%
+Which of the following is the derivative of $\frac{\sin(x)}{x}$?
+(Circle the correct answer.)
+\ifthenelse{\boolean{showanswers}}{}%
+{\begin{description}
+\item[A] $\sin(x)$
+\item[B] $\cos(x)$
+\item[C] $\frac{\cos(x)x-\sin(x)}{x^2}$
+\end{description}
+}}{%
+\begin{description}
+\item[A] $\sin(x)$
+\item[B] $\cos(x)$
+\item[\textcircled{C}] $\frac{\cos(x)x-\sin(x)}{x^2}$
+(quotient rule)
+\end{description}
+}
diff --git a/macros/latex/contrib/probsoln/samples/prob-mixed.tex b/macros/latex/contrib/probsoln/samples/prob-mixed.tex
new file mode 100644
index 0000000000..1f43968b8a
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/prob-mixed.tex
@@ -0,0 +1,78 @@
+ % This file is public domain
+ %
+ % These problems are a mixture of essay-style and questions with
+ % answers. One of these problems requires the tikz package
+
+\newproblem*{oop}{Describe what is meant by object-oriented
+programming.}
+
+\begin{defproblem}{inheritance}
+ Describe what is meant by the term \emph{inheritance} in
+ object-oriented programming. Use examples.
+\end{defproblem}
+
+\begin{defproblem}{weightedcoin}%
+ \begin{onlyproblem}
+ A coin is weighted so that heads is four times as likely
+ as tails. Find the probability that:
+ \begin{textenum}
+ \item tails appears,
+ \item heads appears
+ \end{textenum}%
+ \end{onlyproblem}%
+ \begin{onlysolution}
+ Let $p=P(T)$, then $P(H)=4p$. We require $P(H)+P(T)=1$,
+ so $4p+p=1$, hence $p=\frac{1}{5}$. Therefore:
+ \begin{textenum}
+ \item $P(T)=\frac{1}{5}$,
+ \item $P(H)=\frac{4}{5}$
+ \end{textenum}
+ \end{onlysolution}
+\end{defproblem}
+
+\begin{defproblem}{validprobspaces}
+\begin{onlyproblem}%
+Under which of the following functions does
+$S=\{a_1,a_2\}$ become a probability space?
+\par
+\begin{textenum}
+\begin{tabular}{ll}
+\item $P(a_1)=\frac{1}{3}$, $P(a_2)=\frac{1}{2}$
+&
+\item\label{validprobspacescorrect1} $P(a_1)=\frac{3}{4}$,
+$P(a_2)=\frac{1}{4}$
+\\
+\item\label{validprobspacescorrect2} $P(a_1)=1$, $P(a_2)=0$
+&
+\item $P(a_1)=\frac{5}{4}$, $P(a_2)=-\frac{1}{4}$
+\end{tabular}
+\end{textenum}
+\end{onlyproblem}%
+\begin{onlysolution}%
+\ref{validprobspacescorrect1} and \ref{validprobspacescorrect2}%
+\end{onlysolution}
+\end{defproblem}
+
+\begin{defproblem}{digraph}
+ \begin{onlyproblem}\label{ex:digraph}
+ Identify, if any, the sinks and sources of the digraph shown in Figure~\ref{fig:digraph}.
+
+ \begin{figure}[tbh]
+ \centering
+ \begin{tikzpicture}[every node/.style={draw,circle}]
+ \path (0,0) node (A) {$A$}
+ (1,0) node (B) {$B$}
+ (0,1) node (C) {$C$};
+ \draw[->] (A) -- (B);
+ \draw[->] (B) -- (C);
+ \draw[->] (A) -- (C);
+ \end{tikzpicture}
+ \par
+ \caption{Digraph for Question~\ref{ex:digraph}}
+ \label{fig:digraph}
+ \end{figure}
+ \end{onlyproblem}
+ \begin{onlysolution}
+ $A$ is a souce and $C$ is a sink.
+ \end{onlysolution}
+\end{defproblem}
diff --git a/macros/latex/contrib/probsoln/samples/prob-newdata.tex b/macros/latex/contrib/probsoln/samples/prob-newdata.tex
new file mode 100644
index 0000000000..946f0e1124
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/prob-newdata.tex
@@ -0,0 +1,27 @@
+ % This file is public domain
+\begin{defproblem}{sample}
+\begin{onlyproblem}
+Differentiate $y=\sin x$
+\end{onlyproblem}
+\begin{onlysolution}
+$y'=\cos x$
+\end{onlysolution}
+\end{defproblem}
+
+\begin{defproblem}[1]{sample2}
+\begin{onlyproblem}
+Differentiate $y = \sin(#1x)$
+\end{onlyproblem}
+\begin{onlysolution}
+$y'=#1\cos #1x$
+\end{onlysolution}
+\end{defproblem}
+
+\begin{defproblem}{sample3}
+\begin{onlyproblem}
+Differentiate $y = x^2$.
+\end{onlyproblem}
+\begin{onlysolution}
+$y' = 2x$
+\end{onlysolution}
+\end{defproblem}
diff --git a/macros/latex/contrib/probsoln/samples/prob-nosoln.tex b/macros/latex/contrib/probsoln/samples/prob-nosoln.tex
new file mode 100644
index 0000000000..9909651b86
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/prob-nosoln.tex
@@ -0,0 +1,9 @@
+ % This file is public domain
+ %
+ % these problems don't have solutions
+
+\newproblem*{oop}{Describe what is meant by object-oriented
+programming.}
+
+\newproblem*{inheritance}{Describe what is meant by the term
+\emph{inheritance} in object-oriented programming. Use examples.}
diff --git a/macros/latex/contrib/probsoln/samples/prob-probspaces.tex b/macros/latex/contrib/probsoln/samples/prob-probspaces.tex
new file mode 100644
index 0000000000..4862e5caef
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/prob-probspaces.tex
@@ -0,0 +1,33 @@
+ % This file is public domain
+ %
+ % Finite probability spaces
+\newproblem{weightedcoin}{%
+A coin is weighted so that heads is four times as likely
+as tails. Find the probability that:
+\begin{textenum}
+\item tails appears,
+\item heads appears
+\end{textenum}}{%
+Let $p=P(T)$, then $P(H)=4p$. We require $P(H)+P(T)=1$,
+so $4p+p=1$, hence $p=\frac{1}{5}$. Therefore:
+\begin{textenum}
+\item $P(T)=\frac{1}{5}$,
+\item $P(H)=\frac{4}{5}$
+\end{textenum}}
+
+\newproblem*{validprobspaces}{%
+Under which of the following functions does
+$S=\{a_1,a_2\}$ become a probability space?
+\par
+\begin{textenum}
+\begin{tabular}{ll}
+\incorrectitem $P(a_1)=\frac{1}{3}$, $P(a_2)=\frac{1}{2}$
+&
+\correctitem $P(a_1)=\frac{3}{4}$, $P(a_2)=\frac{1}{4}$
+\\
+\correctitem $P(a_1)=1$, $P(a_2)=0$
+&
+\incorrectitem $P(a_1)=\frac{5}{4}$, $P(a_2)=-\frac{1}{4}$
+\end{tabular}
+\end{textenum}
+}
diff --git a/macros/latex/contrib/probsoln/samples/prob-probspaces2.tex b/macros/latex/contrib/probsoln/samples/prob-probspaces2.tex
new file mode 100644
index 0000000000..dacddb510c
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/prob-probspaces2.tex
@@ -0,0 +1,43 @@
+ % This file is public domain
+ %
+ % Finite probability spaces
+\begin{defproblem}{weightedcoin}
+\begin{onlyproblem}%
+A coin is weighted so that heads is four times as likely
+as tails. Find the probability that:
+\begin{textenum}
+\item tails appears,
+\item heads appears
+\end{textenum}
+\end{onlyproblem}
+\begin{onlysolution}%
+Let $p=P(T)$, then $P(H)=4p$. We require $P(H)+P(T)=1$,
+so $4p+p=1$, hence $p=\frac{1}{5}$. Therefore:
+\begin{textenum}
+\item $P(T)=\frac{1}{5}$,
+\item $P(H)=\frac{4}{5}$
+\end{textenum}
+\end{onlysolution}
+\end{defproblem}
+
+\begin{defproblem}{validprobspaces}
+\begin{onlyproblem}%
+Under which of the following functions does
+$S=\{a_1,a_2\}$ become a probability space?
+\par
+\begin{textenum}
+\begin{tabular}{ll}
+\item $P(a_1)=\frac{1}{3}$, $P(a_2)=\frac{1}{2}$
+&
+\item\label{validprobspacescorrect1} $P(a_1)=\frac{3}{4}$, $P(a_2)=\frac{1}{4}$
+\\
+\item\label{validprobspacescorrect2} $P(a_1)=1$, $P(a_2)=0$
+&
+\item $P(a_1)=\frac{5}{4}$, $P(a_2)=-\frac{1}{4}$
+\end{tabular}
+\end{textenum}
+\end{onlyproblem}%
+\begin{onlysolution}%
+\ref{validprobspacescorrect1} and \ref{validprobspacescorrect2}%
+\end{onlysolution}
+\end{defproblem}
diff --git a/macros/latex/contrib/probsoln/samples/prob-tabmchoice.tex b/macros/latex/contrib/probsoln/samples/prob-tabmchoice.tex
new file mode 100644
index 0000000000..9555b97dd3
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/prob-tabmchoice.tex
@@ -0,0 +1,18 @@
+ % This file is public domain
+ %
+ % These problems are designed to be placed in a
+ % tabular environment
+ %
+\newproblem{tab:1}{%
+What is $(3+2)\times5$? &
+25 \ifshowanswers\selected\else\notselected\fi &
+13 \notselected &
+10 \notselected &
+}{Brackets come first}%
+
+\newproblem{tab:2}{%
+What is $-1+2\times3$? &
+3 \notselected &
+-7 \notselected &
+5 \ifshowanswers\selected\else\notselected\fi &
+}{Multiplication comes first}%
diff --git a/macros/latex/contrib/probsoln/samples/prob-verb.tex b/macros/latex/contrib/probsoln/samples/prob-verb.tex
new file mode 100644
index 0000000000..07e0f83513
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/prob-verb.tex
@@ -0,0 +1,28 @@
+\begin{defproblem}{code-helloworld}
+This problem has a code fragment.
+\begin{onlyproblem}
+\lstset{language=Java}
+\begin{lstlisting}
+public class HelloWorld
+{
+ public static void main(String[] args)
+ {
+ System.out.println("Hello World!");
+ }
+}
+\end{lstlisting}
+\end{onlyproblem}
+\begin{onlysolution}
+\lstset{language=Java}
+\begin{lstlisting}
+public class HelloWorld
+{
+ public static void main(String[] args)
+ {
+ System.out.println("Hello "
+ + (args.length==0 ? "anon" : args[0])+"!");
+ }
+}
+\end{lstlisting}
+\end{onlysolution}
+\end{defproblem}
diff --git a/macros/latex/contrib/probsoln/samples/sample-exclude.pdf b/macros/latex/contrib/probsoln/samples/sample-exclude.pdf
new file mode 100644
index 0000000000..a0e6571cac
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/sample-exclude.pdf
Binary files differ
diff --git a/macros/latex/contrib/probsoln/samples/sample-exclude.tex b/macros/latex/contrib/probsoln/samples/sample-exclude.tex
new file mode 100644
index 0000000000..0120d310ed
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/sample-exclude.tex
@@ -0,0 +1,79 @@
+ % This file is public domain
+\documentclass[a4paper]{article}
+
+\usepackage{probsoln}
+ %uncomment the following line to display the answers
+ %\showanswers
+
+ % Set the academic year to be 2011/12 (if omitted assume current
+ % academic year):
+ \SetStartYear{2011}
+
+ % Set the seed for the random number generator:
+ \PSNrandseed{\GetStartYear}
+
+ % Exclude problems that have been used this year or the previous
+ % two academic years. (Creates a file called 'excluded.tex' to
+ % store labels of used problems. Also creates a file called
+ % \jobname.prb that stores labels of problems used in this
+ % document, so they don't get excluded on subsequent runs.)
+ \ExcludePreviousFile[3]{excluded}
+
+ % To clear the used problems file (\jobname.prb) of the labels
+ % generated in the previous run, comment the above and uncomment
+ % below:
+ % \ClearUsedFile{excluded}
+
+ % Load 1 problem randomly selected from the given file
+ % and store in database 'firstprinciples':
+\loadrandomproblems[firstprinciples]{1}{prob-1stprncp}
+
+ % Load 5 problems randomly selected from the given file
+ % and store in database 'easy':
+\loadrandomproblems[easy]{5}{prob-easy}
+
+ % Load 2 problems randomly selected from the given file
+ % and store in database 'implicit':
+\loadrandomproblems[implicit]{2}{prob-implicit}
+
+ % Load 2 problems randomly selected from the given file
+ % and store in database 'probspaces':
+\loadrandomproblems[probspaces]{2}{prob-probspaces}
+
+ % Load 1 problem randomly selected from the given file
+ % and store in database 'mchoice':
+\loadrandomproblems[mchoice]{1}{prob-mchoice}
+
+ % Load 1 problem randomly selected from the given file
+ % and store in database 'nosoln':
+\loadrandomproblems[nosoln]{1}{prob-nosoln}
+
+
+\begin{document}
+\title{Sample Problem Sheet}
+\author{Nicola Talbot}
+\maketitle
+
+\begin{enumerate}
+ % Differentiation from first principles
+ \foreachproblem[firstprinciples]{\item \thisproblem}
+
+\item Differentiate the following functions:
+\begin{enumerate}
+ \foreachproblem[easy]{\item \thisproblem}
+\end{enumerate}
+
+ % Implicit differentiation
+\foreachproblem[implicit]{\item \thisproblem}
+
+ % Finite probability spaces
+\foreachproblem[probspaces]{\item \thisproblem}
+
+ % Multiple choice question
+\foreachproblem[mchoice]{\item \thisproblem}
+
+ % select one essay style question that doesn't come with a solution
+
+\foreachproblem[nosoln]{\item \thisproblem}
+\end{enumerate}
+\end{document}
diff --git a/macros/latex/contrib/probsoln/samples/sample.pdf b/macros/latex/contrib/probsoln/samples/sample.pdf
new file mode 100644
index 0000000000..3a44bed21a
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/sample.pdf
Binary files differ
diff --git a/macros/latex/contrib/probsoln/samples/sample.tex b/macros/latex/contrib/probsoln/samples/sample.tex
new file mode 100644
index 0000000000..b6bd665825
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/sample.tex
@@ -0,0 +1,64 @@
+ % This file is public domain
+\documentclass[a4paper]{article}
+
+\usepackage{probsoln}
+ % uncomment the following line to display the answers
+ % \showanswers
+
+ % The following will generate a different set of
+ % problems each year
+ %\PSNrandseed{\year}
+
+ % Load 1 problem randomly selected from the given file
+ % and store in database 'firstprinciples':
+\loadrandomproblems[firstprinciples]{1}{prob-1stprncp}
+
+ % Load 5 problems randomly selected from the given file
+ % and store in database 'easy':
+\loadrandomproblems[easy]{5}{prob-easy}
+
+ % Load 2 problems randomly selected from the given file
+ % and store in database 'implicit':
+\loadrandomproblems[implicit]{2}{prob-implicit}
+
+ % Load 2 problems randomly selected from the given file
+ % and store in database 'probspaces':
+\loadrandomproblems[probspaces]{2}{prob-probspaces}
+
+ % Load 1 problem randomly selected from the given file
+ % and store in database 'mchoice':
+\loadrandomproblems[mchoice]{1}{prob-mchoice}
+
+ % Load 1 problem randomly selected from the given file
+ % and store in database 'nosoln':
+\loadrandomproblems[nosoln]{1}{prob-nosoln}
+
+
+\begin{document}
+\title{Sample Problem Sheet}
+\author{Nicola Talbot}
+\maketitle
+
+\begin{enumerate}
+ % Differentiation from first principles
+ \foreachproblem[firstprinciples]{\item \thisproblem}
+
+\item Differentiate the following functions:
+\begin{enumerate}
+ \foreachproblem[easy]{\item \thisproblem}
+\end{enumerate}
+
+ % Implicit differentiation
+\foreachproblem[implicit]{\item \thisproblem}
+
+ % Finite probability spaces
+\foreachproblem[probspaces]{\item \thisproblem}
+
+ % Multiple choice question
+\foreachproblem[mchoice]{\item \thisproblem}
+
+ % select one essay style question that doesn't come with a solution
+
+\foreachproblem[nosoln]{\item \thisproblem}
+\end{enumerate}
+\end{document}
diff --git a/macros/latex/contrib/probsoln/samples/sample2.pdf b/macros/latex/contrib/probsoln/samples/sample2.pdf
new file mode 100644
index 0000000000..007f6d906b
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/sample2.pdf
Binary files differ
diff --git a/macros/latex/contrib/probsoln/samples/sample2.tex b/macros/latex/contrib/probsoln/samples/sample2.tex
new file mode 100644
index 0000000000..cd13c89f30
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/sample2.tex
@@ -0,0 +1,48 @@
+ % This file is public domain
+\documentclass[a4paper]{article}
+
+\usepackage{probsoln}
+ %uncomment the following line to display the answers
+\showanswers
+
+ % The following will generate a different set of
+ % problems in subsequent years
+ %\PSNrandseed{\year}
+
+ % The following will generate a different set of
+ % problems on every run (where each run is at
+ % least a minute apart from the previous one)
+\PSNrandseed{\time}
+
+\begin{document}
+\title{Sample Problem Sheet}
+\author{Nicola Talbot}
+\maketitle
+
+\begin{enumerate}
+
+\newcounter{numproblems}
+ % store a random number from 1 to 3 in the counter numproblems
+\random{numproblems}{1}{3}
+
+ % selects 1,2 or 3 problems from 1 of the given files:
+\doforrandN{1}{\file}{prob-1stprncp,prob-implicit}{\selectrandomly{\file}{\value{numproblems}}}
+
+\item Differentiate the following functions:
+\input{prob-args}% load database
+\begin{enumerate}
+\newcounter{A}
+\newcounter{B}
+\newcounter{C}
+\random{A}{-4}{5}
+\random{B}{-3}{3}
+\random{C}{-1}{10}
+\item \useproblem{diff:quad}{\arabic{A}}{\arabic{B}}{\arabic{C}}
+
+\random{A}{-5}{5}
+ % make sure its not 0
+\whiledo{\value{A}=0}{\random{A}{-5}{5}}
+\item \useproblem{diff:sin}{\arabic{A}}
+\end{enumerate}
+\end{enumerate}
+\end{document}
diff --git a/macros/latex/contrib/probsoln/samples/sample3.pdf b/macros/latex/contrib/probsoln/samples/sample3.pdf
new file mode 100644
index 0000000000..d6f6ff4909
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/sample3.pdf
Binary files differ
diff --git a/macros/latex/contrib/probsoln/samples/sample3.tex b/macros/latex/contrib/probsoln/samples/sample3.tex
new file mode 100644
index 0000000000..6922f9538e
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/sample3.tex
@@ -0,0 +1,25 @@
+ % This file is public domain
+\documentclass[a4paper]{article}
+
+\usepackage{longtable}
+\usepackage{probsoln}
+
+ %\showanswers
+
+\newcounter{problem}
+\renewcommand{\PSNitem}{\refstepcounter{problem}%
+\theproblem. }
+\renewcommand{\endPSNitem}{\\}
+
+\renewenvironment{solution}{}{}
+
+\newcommand{\selected}{\fbox{$\times$}}
+\newcommand{\notselected}{\fbox{\phantom{$\times$}}}
+
+\begin{document}
+\begin{longtable}{lrrrl}
+\bfseries Question & \bfseries A & \bfseries B &
+\bfseries C & \ifshowanswers \bfseries Reason\fi\\
+\selectrandomly{prob-tabmchoice}{2}
+\end{longtable}
+\end{document}
diff --git a/macros/latex/contrib/probsoln/samples/sample4.pdf b/macros/latex/contrib/probsoln/samples/sample4.pdf
new file mode 100644
index 0000000000..7aadf56ca1
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/sample4.pdf
Binary files differ
diff --git a/macros/latex/contrib/probsoln/samples/sample4.tex b/macros/latex/contrib/probsoln/samples/sample4.tex
new file mode 100644
index 0000000000..b432182d01
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/sample4.tex
@@ -0,0 +1,21 @@
+ % This file is public domain
+\documentclass[a4paper]{article}
+
+\usepackage{probsoln}
+
+ % Sample file illustrating use of \loadallproblems
+ % All problems defined in specified file will be used
+ % in order of definition
+
+ \loadallproblems{prob-easy}
+ %\loadselectedproblems{diffeasy:gpowh,diffeasy:arccos}{prob-easy}
+ %\loadexceptproblems{diffeasy:gpowh,diffeasy:arccos}{prob-easy}
+
+ \showanswers
+
+\begin{document}
+Differentiate the following functions:
+\begin{enumerate}
+ \foreachproblem{\item \thisproblem}
+\end{enumerate}
+\end{document}
diff --git a/macros/latex/contrib/probsoln/samples/sample5.pdf b/macros/latex/contrib/probsoln/samples/sample5.pdf
new file mode 100644
index 0000000000..f4ac8c7fdc
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/sample5.pdf
Binary files differ
diff --git a/macros/latex/contrib/probsoln/samples/sample5.tex b/macros/latex/contrib/probsoln/samples/sample5.tex
new file mode 100644
index 0000000000..ac294c11ca
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/sample5.tex
@@ -0,0 +1,34 @@
+ % This file is public domain
+\documentclass[a4paper]{report}
+
+\usepackage{probsoln}
+
+\begin{document}
+\hideanswers
+
+\chapter{Easy Problems}
+\loadrandomproblems[easyproblems]{5}{prob-easy2}
+
+\renewcommand{\theenumi}{\thechapter.\arabic{enumi}}
+\begin{enumerate}
+\foreachproblem[easyproblems]{\item\label{prob:\thisproblemlabel}\thisproblem}
+\end{enumerate}
+
+\chapter{Probability Spaces}
+\loadrandomproblems[probspaces]{2}{prob-probspaces2}
+
+\renewcommand{\theenumi}{\thechapter.\arabic{enumi}}
+\begin{enumerate}
+\foreachproblem[probspaces]{\item\label{prob:\thisproblemlabel}\thisproblem}
+\end{enumerate}
+
+\appendix
+\chapter{Solutions}
+\showanswers
+\begin{enumerate}
+\foreachdataset{\thisdataset}{%
+\foreachproblem[\thisdataset]{\item[\ref{prob:\thisproblemlabel}]\thisproblem}
+}
+\end{enumerate}
+
+\end{document}
diff --git a/macros/latex/contrib/probsoln/samples/sample6.pdf b/macros/latex/contrib/probsoln/samples/sample6.pdf
new file mode 100644
index 0000000000..2a8be97bbc
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/sample6.pdf
Binary files differ
diff --git a/macros/latex/contrib/probsoln/samples/sample6.tex b/macros/latex/contrib/probsoln/samples/sample6.tex
new file mode 100644
index 0000000000..65769d3c97
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/sample6.tex
@@ -0,0 +1,11 @@
+\documentclass{article}
+
+\usepackage[usedefaultargs]{probsoln}
+
+\loadallproblems{prob-args}
+
+\begin{document}
+\begin{enumerate}
+\foreachproblem{\item \thisproblem}
+\end{enumerate}
+\end{document}
diff --git a/macros/latex/contrib/probsoln/samples/sample7.pdf b/macros/latex/contrib/probsoln/samples/sample7.pdf
new file mode 100644
index 0000000000..12b0da7dad
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/sample7.pdf
Binary files differ
diff --git a/macros/latex/contrib/probsoln/samples/sample7.tex b/macros/latex/contrib/probsoln/samples/sample7.tex
new file mode 100644
index 0000000000..00ccf637d4
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/sample7.tex
@@ -0,0 +1,20 @@
+\documentclass{article}
+
+\usepackage{tikz}
+\usepackage{probsoln}
+
+\loadallproblems{prob-mixed}
+
+\begin{document}
+\section{Exercises}
+\begin{enumerate}
+ \foreachproblem{\item\label{q-\thisproblemlabel} \thisproblem}
+\end{enumerate}
+
+\section{Solutions}
+\showanswers
+
+\begin{enumerate}
+ \foreachsolution{\item[\ref{q-\thisproblemlabel}] \thisproblem}
+\end{enumerate}
+\end{document}
diff --git a/macros/latex/contrib/probsoln/samples/sample8.pdf b/macros/latex/contrib/probsoln/samples/sample8.pdf
new file mode 100644
index 0000000000..f931368efa
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/sample8.pdf
Binary files differ
diff --git a/macros/latex/contrib/probsoln/samples/sample8.tex b/macros/latex/contrib/probsoln/samples/sample8.tex
new file mode 100644
index 0000000000..e68954daf2
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/sample8.tex
@@ -0,0 +1,15 @@
+\documentclass{article}
+
+\usepackage{listings}
+\usepackage{probsoln}
+
+\setkeys{probsoln}{fragile}
+
+\loadallproblems{prob-verb}
+
+\showanswers
+\begin{document}
+\begin{enumerate}
+ \foreachproblem{\item \thisproblem}
+\end{enumerate}
+\end{document}
diff --git a/macros/latex/contrib/probsoln/samples/sample9.pdf b/macros/latex/contrib/probsoln/samples/sample9.pdf
new file mode 100644
index 0000000000..9632dc35df
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/sample9.pdf
Binary files differ
diff --git a/macros/latex/contrib/probsoln/samples/sample9.tex b/macros/latex/contrib/probsoln/samples/sample9.tex
new file mode 100644
index 0000000000..79ac7c5f5e
--- /dev/null
+++ b/macros/latex/contrib/probsoln/samples/sample9.tex
@@ -0,0 +1,19 @@
+ % This file is public domain
+\documentclass[a4paper]{article}
+
+\usepackage{probsoln}
+ % uncomment the following line to display the answers
+ % \showanswers
+
+ % Load 10 problems randomly selected from the given files
+\loadrandomproblems{10}{prob-1stprncp,prob-easy,prob-implicit,prob-probspaces}
+
+\begin{document}
+\title{Sample Problem Sheet}
+\author{Nicola Talbot}
+\maketitle
+
+\begin{enumerate}
+ \foreachproblem{\item \thisproblem}
+\end{enumerate}
+\end{document}