summaryrefslogtreecommitdiff
path: root/texmf-dist/doc/latex/rangen/rangen_tst.tex
blob: c89a5964ce7783dc8d05e83baf53bf8c91d7ea61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
\documentclass{article}
\usepackage[fleqn]{amsmath}
\usepackage[tight,designiii,usesf]{web}
\usepackage{exerquiz}
\usepackage[equations,ImplMulti,indefIntegral,limitArith,nodec]{dljslib}
\usepackage[quiet,testmode]{rangen}

\title{Experiments in Creating Random Problems}
\author{D. P. Story}
\subject{Test file for the rangen Package}
\keywords{LaTeX, rangen, quizzes, random}

\university{NORTHWEST FLORIDA STATE COLLEGE\\
   Department of Mathematics}
\email{dpstory@acrotex.net}
\version{1.0}

%\nocopyright
\norevisionLabel
\makeatletter
\def\eq@textFont{/TiRo}
\makeatother

\everyTextField{\BG{1 1 1}}
\everyCheckBox{\BG{1 1 1}}
\everyRespBoxMath{\rectW{1.9in}\textSize{0}}
\everyRespBoxTxt{\rectW{1.9in}\textSize{0}}

\newcommand{\cs}[1]{\texttt{\char`\\#1}}

\renewcommand\nodecAlertMsg{%
    "A decimal answer is not acceptable here.
     Please express your answer using a fraction."}
\newenvironment{eqComments}[1][\strut]{\smallskip\leftskip-\labelwidth
\item[]\textbf{\textcolor{blue}{#1}}}{\par\smallskip}

\begin{document}

\maketitle

\begin{shortquiz}*[sq] Answer each of the following. Passing is 100\%.

\begin{questions}

\begin{eqComments}[Arithmetic]\end{eqComments}

%% addition
\RandomQ{\a}[9]{1/8}{6/7}\RandomQ{\b}[8]{1/16}{15/16}

\item  $\displaystyle \ds\a +  \ds\b =
       \RespBoxMath{ (\nOf\a * \dOf\b + \nOf\b * \dOf\a )/( \dOf\a * \dOf\b ) }{2}{.0001}{[0,2]}[{priorParse: \Array(nodec,NoAddOrSub)}]$\hfill
       \CorrAnsButton{rFrac( rEval( \nOf\a * \dOf\b + \nOf\b * \dOf\a )/rEval( \dOf\a * \dOf\b ))}*{rngCorrAnsButton}\kern1bp\sqTallyBox

% subtraction
\RandomQ{\a}[16]{1/16}{15/16}\RandomQ[ne=\a]{\b}[16]{1/8}{15/16}

\item  $\displaystyle  \ds\a - \ds\b =
       \RespBoxMath{ (\nOf\a * \dOf\b - \nOf\b * \dOf\a )/( \dOf\a * \dOf\b ) }{2}{.0001}{[0,2]}[{priorParse: \Array(nodec,NoAddOrSub)}]$\hfill
       \CorrAnsButton{rFrac( rEval( \nOf\a * \dOf\b - \nOf\b * \dOf\a )/rEval( \dOf\a * \dOf\b ) )}*{rngCorrAnsButton}\kern1bp\sqTallyBox

% subtraction
\RandomQ{\a}[16]{1/8}{15/16}\RandomQ[ne=\a]{\b}[16]{1/8}{15/16}

\item  $\displaystyle \ds\a - \ds\b =
       \RespBoxMath{ (\nOf\a * \dOf\b - \nOf\b * \dOf\a )/( \dOf\a * \dOf\b ) }{2}{.0001}{[0,2]}[{priorParse: \Array(nodec,NoAddOrSub)}]$\hfill
       \CorrAnsButton{rFrac( rEval( \nOf\a * \dOf\b - \nOf\b * \dOf\a )/rEval( \dOf\a * \dOf\b ) )}*{rngCorrAnsButton}\kern1bp\sqTallyBox

\begin{eqComments}
This next problem illustrates the use of \cs{RandomL} and \cs{RansomAS}. The summands are
determined from a list of rational numbers. Addition or subtraction of the summands is determined
by \cs{RandomAS}.
\end{eqComments}

%% Random add/subtr using RandomL and RandomAS
\RandomL{\a}{1/2,2/3,5/3,2/5,6/5}\RandomL{\b}{4/3,3/4,8/7,3/2}\RandomS{\as}

\item $\displaystyle \ds\a \as  \ds\b =
       \RespBoxMath{ (\nOf\a * \dOf\b \as \nOf\b * \dOf\a )/( \dOf\a * \dOf\b ) }{2}{.0001}{[0,2]}[{priorParse: \Array(nodec,NoAddOrSub)}]$\hfill
       \CorrAnsButton{rFrac( rEval( \nOf\a * \dOf\b \as \nOf\b * \dOf\a )/rEval( \dOf\a * \dOf\b ) )}*{rngCorrAnsButton}\kern1bp\sqTallyBox


\begin{eqComments}
This next example illustrates how you can create a solution to a problem. This is a simple
addition problem using the built-in command \cs{qAdd}. Solutions to more advanced problems
might be obtained using the \textsf{fp} package.
\end{eqComments}

\begin{writeRVsTo}{quizzes}
\RandomQ{\a}[9]{1/8}{6/7}\RandomQ{\b}[7]{1/16}{15/16}
\end{writeRVsTo}

%% addition
\item $\displaystyle \ds\a +  \ds\b =
       \RespBoxMath{ (\nOf\a * \dOf\b + \nOf\b * \dOf\a )/( \dOf\a * \dOf\b ) }*{2}{.0001}{[0,2]}[{priorParse: \Array(nodec,NoAddOrSub)}]$\hfill
       \CorrAnsButton{rFrac( rEval( \nOf\a * \dOf\b + \nOf\b * \dOf\a )/rEval( \dOf\a * \dOf\b ) )}*{rngCorrAnsButton}\kern1bp\sqTallyBox

\begin{solution}\relax\RNGadd\a\b\defineQ{\ans}{\rfNumer}{\rfDenom}%
The solution to this problem is
\begin{equation*}
        \boxed{\ds\a +  \ds\b = \ds\ans}
\end{equation*}
\end{solution}


\newpage
\begin{eqComments}[Definite Integrals]\end{eqComments}

\RandomQ{\a}[8]{1/4}{7/6}
\RandomZ{\b}{1}{3}
\RandomQ{\n}[8]{1/2}{3/2}
\RandomZ[ne=0]{\c}{-3}{3}

\item   $\displaystyle\int_{\a}^{\b} \cfmt\c x^{\efmt\n}\,dx =
        \RespBoxMath{\c((\b)^(\n+1)-(\a)^(\n+1))/(\n+1)}{3}{.0001}{[0,2]}$\hfill
        \CorrAnsButton{rEval(\c((\b)^(\n+1)-(\a)^(\n+1))/(\n+1))}*{rngCorrAnsButton}\kern1bp\sqTallyBox


\RandomQ{\a}{1/6}{2/9}
\RandomZ{\b}{1}{10}
\RandomQ[ne={0,-1}]{\n}[5]{-1}{1}
\RandomZ[ne=0]{\c}{-3}{3}

\item   $\displaystyle\int_{\a}^{\b} \cfmt\c x^{\efmt\n}\,dx =
        \RespBoxMath{\c((\b)^(\n+1)-(\a)^(\n+1))/(\n+1)}{3}{.0001}{[0,2]}$\hfill
        \CorrAnsButton{rEval(\c((\b)^(\n+1)-(\a)^(\n+1))/(\n+1))}*{rngCorrAnsButton}\kern1bp\sqTallyBox

\RandomZ{\a}{1}{6}
\RandomZ{\b}{\a*}{8}
\RandomZ{\n}{1}{5}
\RandomZ[ne=0]{\c}{-3}{3}

\item   $\displaystyle\int_{\a}^{\b} \cfmt\c x^{\efmt\n}\,dx =
        \RespBoxMath{\c((\b)^(\n+1)-(\a)^(\n+1))/(\n+1)}{3}{.0001}{[0,2]}$\hfill
        \CorrAnsButton{rFrac(rEval(\c ( (\b)^(\n+1)-(\a)^(\n+1)))/rEval(\n+1))}*{rngCorrAnsButton}\kern1bp\sqTallyBox

\RandomZ{\a}{1}{5}
\RandomZ{\b}{\a*}{10}
\RandomQ[ne={0,-1}]{\n}{-3}{2/3}
\RandomZ[ne=0]{\c}{-3}{3}

\item   $\displaystyle\int_{\a}^{\b} \cfmt\c x^{\efmt\n}\,dx =
        \RespBoxMath{\c((\b)^(\n+1)-(\a)^(\n+1))/(\n+1)}{3}{.0001}{[0,2]}$\hfill
        \CorrAnsButton{rEval(\c((\b)^(\n+1)-(\a)^(\n+1))/(\n+1))}*{rngCorrAnsButton}\kern1bp\sqTallyBox

\RandomQ{\a}{1/4}{2/3}
\RandomQ{\b}{\a*}{7/6}
\RandomQ[ne={0,-1}]{\n}{-3}{2/3}
\RandomZ[ne=0]{\c}{-3}{3}

\item   $\displaystyle\int_{\a}^{\b} \cfmt\c x^{\efmt\n}\,dx =
        \RespBoxMath{\c((\b)^(\n+1)-(\a)^(\n+1))/(\n+1)}{3}{.0001}{[0,2]}$\hfill
        \CorrAnsButton{rEval(\c((\b)^(\n+1)-(\a)^(\n+1))/(\n+1))}*{rngCorrAnsButton}\kern1bp\sqTallyBox

\begin{eqComments}
This next problem was created from random lists of values using \cs{RandomL}.
\end{eqComments}

\RandomL{\c}{1/6,1/4,1/6,1/2}
\RandomL{\a}{1,2,3,4,5,6}
\ifnum\a=1
    \def\strAns{sin(PI/\dOf\c)}
\else
    \def\strAns{(1/\a)(sin(\a*PI/\dOf\c))}
\fi

\item $\displaystyle\int_0^{\pi/\dOf\c} \cos(\cfmt\a x) \,dx =
        \RespBoxMath{(1/\a)(sin(\a*PI/\dOf\c))}{3}{.0001}{[0,2]}$\hfill
        \CorrAnsButton{rEval(\strAns)}*{rngCorrAnsButton\RNGprintf{\%.4f}}\kern1bp\sqTallyBox


\newpage
\begin{eqComments}[Indefinite Integration]\end{eqComments}

\RandomQ{\a}{1/6}{3/2}
\RandomQ{\b}{1/6}{3/2}
\RandomZ{\c}{1}{3}

\item   $\displaystyle\int \cds\a x^2 + \ds\b x + \c\,dx =
        \RespBoxMath{(\a/3)x^3+(\b/2) x^2 + \c x}{3}{.0001}{[0,2]}$\hfill
        \CorrAnsButton{(rFrac(rEval(\nOf\a)/rEval(3*\dOf\a))) x^3
            + (rFrac(rEval(\nOf\b)/rEval(2*\dOf\b))) x^2
            + \c x + C}*{rngCorrAnsButton}\kern1bp\sqTallyBox

\RandomQ{\a}{1/3}{3}
\RandomQ{\b}{1/6}{3/2}
\RandomZ{\c}{1}{3}

\item   $\displaystyle\int \cds\a x^2 + \ds\b x + \c\,dx =
        \RespBoxMath{(\a/3)x^3+(\b/2) x^2 + \c x}{3}{.0001}{[0,2]}$\hfill
        \CorrAnsButton{(rFrac(rEval(\nOf\a)/rEval(3*\dOf\a))) x^3
            + (rFrac(rEval(\nOf\b)/rEval(2*\dOf\b))) x^2
            + \c x + C}*{rngCorrAnsButton}\kern1bp\sqTallyBox

\newpage
\begin{eqComments}[Differentiation]\end{eqComments}

\RandomQ[ne=0]{\c}[4]{-2}{2}
\RandomQ[ne=0]{\n}[1]{-3}{2}

\item   $\displaystyle \frac{d}{dx} \cds\c x^{\efmt\n} =
        \ifnum\nOf\n=\dOf\n
            \RespBoxMath{\c}{3}{.0001}{[0,2]}$\hfill
            \CorrAnsButton{rFrac(\nOf\c/\dOf\c)}*{rngCorrAnsButton}%
        \else
            \RespBoxMath{\c*\n*x^(\n-1)}{3}{.0001}{[0,2]}$\hfill
            \CorrAnsButton{rFrac(rEval(\nOf\c*\nOf\n)/rEval(\dOf\c*\dOf\n))
                x^(rFrac(rEval(\nOf\n-\dOf\n)/\dOf\n))}*{rngCorrAnsButton}%
        \fi
        \kern1bp\sqTallyBox

\begin{eqComments}
This next problem uses a random sign, defined by \cs{RandomS}.
\end{eqComments}

\RandomQ{\c}[4]{2}{3}\RandomS{\s}
\RandomQ[ne=0]{\n}[2]{-3}{2}

\item   $\displaystyle \frac{d}{dx} \cfmt\s\ds\c x^{\efmt\n} =
        \ifnum\nOf\n=\dOf\n
            \RespBoxMath{\s\c}{3}{.0001}{[0,2]}$\hfill
            \CorrAnsButton{\s\nOf\c/\dOf\c}*{rngCorrAnsButton}%
        \else
            \RespBoxMath{\s\c*\n*x^(\n-1)}{3}{.0001}{[0,2]}$\hfill
            \CorrAnsButton{rFrac(rEval(\s\nOf\c*\nOf\n)/rEval(\dOf\c*\dOf\n))
                x^(rFrac(rEval(\nOf\n-\dOf\n)/\dOf\n))}*{rngCorrAnsButton}%
        \fi
        \kern1bp\sqTallyBox


\RandomQ[ne=0]{\c}[4]{-2}{5}
\RandomQ{\n}[4]{2}{5}

\item   $\displaystyle \frac{d}{dx} \ds\c x^{\efmt\n} =
        \ifnum\nOf\n=\dOf\n
            \RespBoxMath{\c}{3}{.0001}{[0,2]}$\hfill
            \CorrAnsButton{\nOf\c/\dOf\c}*{rngCorrAnsButton}%
        \else
            \RespBoxMath{\c*\n*x^(\n-1)}{3}{.0001}{[0,2]}$\hfill
            \CorrAnsButton{rFrac(rEval(\nOf\c*\nOf\n)/rEval(\dOf\c*\dOf\n))
                x^(rFrac(rEval(\nOf\n-\dOf\n)/\dOf\n))}*{rngCorrAnsButton}%
        \fi
        \kern1bp\sqTallyBox

\newpage

\begin{eqComments}[Analytic Geometry]\end{eqComments}

\RandomZ{\a}{-10}{9}
\RandomZ{\b}{-10}{9}
\RandomZ{\c}{\a*}{10}
\RandomZ{\d}{\b*}{10}
\defineDepQJS{\m}{\d - \b}{\c - \a}{rFrac(rEval(\nOf\m)/rEval(\dOf\m))}
\defineDepQJS{\yIntercept}{\b - \a*\m}{1}{rFrac((rEval( \b * \dOf\m - \a*\nOf\m ))/(rEval(\dOf\m)))}


\item   Let $P(\,\a, \b\,)$ be a point and $Q(\,\c, \d\,)$ be a point. Find the equation of the line that
        passes through $P$ and $Q$.\par\kern3pt
        \RespBoxMath{y = \m*x + \yIntercept }(xy){3}{.0001}{[0,2]x[0,2]}*{ProcRespEq}\hfill
        \CorrAnsButton{y = \js\m\space x + \js\yIntercept}*{rngCorrAnsButton}%
        \kern1bp\sqTallyBox

\RandomZ{\a}{-10}{9}
\RandomZ{\b}{-10}{9}
\RandomZ{\c}{\a*}{10}
\RandomZ{\d}{\b*}{10}
\defineDepQJS{\m}{\d - \b}{\c - \a}{rFrac(rEval(\nOf\m)/rEval(\dOf\m))}
\defineDepQJS{\yIntercept}{\b - \a*\m}{1}{rFrac((rEval( \b * \dOf\m - \a*\nOf\m ))/(rEval(\dOf\m)))}

\item  Let $P(\,\a, \b\,)$ be a point and $Q(\,\c, \d\,)$ be a point. Find the equation of the line that
        passes through $P$ and $Q$.\par\kern3pt
        \RespBoxMath{y = \m*x + (\b - \a*\m) }(xy){3}{.0001}{[0,2]x[0,2]}*{ProcRespEq}\hfill
        \CorrAnsButton{y = \js\m\space x + \js\yIntercept}*{rngCorrAnsButton}%
        \kern1bp\sqTallyBox

\end{questions}
\end{shortquiz}
\begin{flushright}
\sqClearButton\kern1bp\sqTallyTotal
\end{flushright}
\end{document}