_OMIT

>   

MCtools/latextools (April 11, 2009)   Open Execute Close  

>   

>   

>   

>    makeheader([[format("Testing dual purpose answer formats and ragit and addpic",Size="LARGE"),format(addlink("local:addpicandragit.pdf","Worksheet in latex")),format(addlink("local:worksheet1.html","Worksheet in html"))],
[format(cat("Get the most recent MClatools at the ",addlink("http://www.msc.uky.edu/carl/communicating_math/MCtools_page.htm","MCtools Page"))),addlink("local:test.pdf","Hardcopy problems")]]);

>   

H_[1;;1;;0]

SKIP_

T_

 lt_b gt_ lt_font color="blue" size="5" gt_ Testing dual purpose answer formats and ragit and addpic lt_/font gt_ lt_/b gt_ 

 lt_b gt_ lt_font color="blue" size="3" gt_ lt_a href="local:addpicandragit.pdf" target="_blank" gt_ Worksheet in latex lt_/a gt_ lt_/font gt_ lt_/b gt_ 

 lt_b gt_ lt_font color="blue" size="3" gt_ lt_a href="local:worksheet1.html" target="_blank" gt_ Worksheet in html lt_/a gt_ lt_/font gt_ lt_/b gt_ 

SKIP_

QN_[.05]

AH_[0]

 lt_b gt_ lt_font color="blue" size="3" gt_ Get the most recent MClatools at the lt_a href="http://www.msc.uky.edu/carl/communicating_math/MCtools_page.htm" target="_blank"  gt_ MCtools Page lt_/a gt_ lt_/font gt_ lt_/b gt_ 

lt_a href="local:test.pdf" target="_blank" gt_ Hardcopy problems lt_/a gt_

SKIP_

_TIMO

ragit, the dual purpose problem word.

The MCtools word ragit takes as input strings, expressions, dual answer formats, etc and outputs problems in latex if LATEX_=yes, and html otherwise.  It is meant to replace the old MCtools word tagit.

>   

Dual purpose answer formats

WHS has a set of answer formats which cover a large portion of the types of answers you might expect of students in an automated grading system.  We introduce here a set of answer fomats which  can be used to produce mathclass homeworks and tests  or to produce latex homeworks and tests.  They fall into two groups: the  multiple choice formats  as_ and arq_, and the answer box formats ac_, an_,  af_, ai_, ae_, and acef_

>   

multiple choice formats as_, arq_, ar_ and aq_

as_

as_   is the  standard selection box in WHS unless LATEX_=yes.  The latex version is shows all alternatives in a table.  Don't get too fancy with this format because the WHS format is not fancy.  Use only strings or symbols.  No asciimath or other backquoted symbols.  The alternatives are given in a list.  The correct answer is indicated by enclosing it in square brackets or by use of the option Rightone=.   You can also Shuffle the alternatives as described in the Help for as_ (see below)

>    ragit("All triangles are scalene.",as_(["True",["False"]]));

QM_[.05;False]

AH_[0]

All triangles are scalene.

AS_[True;False]

SKIP_

To create a latex version of the question, you can make a copy of it, then prepend and append assignment lines for LATEX_.

>    LATEX_:=yes:
ragit("All triangles are scalene.",as_(["True",["False"]]));
LATEX_:=no:

_LATEX

\item \ 

All triangles are scalene.

\begin{tabular}[t]{ll}

\ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ True & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ False\\

 &\\

\end{tabular}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm} $2$ \\

\end{tabular}

_YEK

Here is the Help message from as_

>    as_(Help);

as_(l)  returns a list from which to circle

 the correct answer (listed first or enclosed in square brackets)if LATEX_=yes, else it returns an AS format for tagit, taking the same arguments (randomize and rightanswers)  the tagit format does. 

Options: 

Shuffle=no, or =yes or =[3,2,1] to reverse the order of 3 alternatives

Rightone=1  Change if the correct answer is not the first answer.

arq_, ar_, and aq_

arq_  provides an array of radio buttons or checkboxes (no mix).  You can select radio buttons by using ar_ and checkboxes by using aq_.

And here is the Help message from arq_.

>    arq_(Help);

arq_(lst::listlist) constructs an array of radio buttons (default) or checkboxes  

 alternatives with the same identifier (Id below).

 The first alternative is assumed the correct one, unless modified appropriately

 with the Rightone= option.

 Options:

 Help=no

 Button="radio"  change to Button="checkbox" for an array of checkbox alternatives

              Note: Use ar_ for radiobuttons and aq_ for checkboxes.

 Rightone=1   For Button="radio" change to the correct alternative as needed.

              For Button="checkbox" change to a list of correct alternatives

 Numcols=1   Change to the number of columns you want.

 Shuffle=no   Insert a permutation of the number of alternatives (eg, Shuffle=[3,1,2]) to shuffle the positions

              For problem maintainance purposes, in a problem generator, if is recommended that you

              generate the permutation of the alternatives using getparams

              or change no to yes to get a random permutation.

 Id = -rand(1..10000)()   If you want a particular identifier, use a positive

  integer if you want WHS to shuffle it, otherwise use a negative integer

 Labels=""  Replace by Labels=1 to get ["A) ","B) ", etc] or Labels=2 to get red letter labels in html.

              or Labels=[any list of strings]

 Tableopts=""  replace with 

an appropriate format string

 Cellopts=""   replace with a format string for all cells or a list of

 pairs [n,string], where n is the cell number to be formatted with string.

>   

>   

>    ragit("Check each number which is a multiple of three.",brak(),
aq_([3,5,7,9],Rightone=[1,4],Numcols=4));

QM_[.05;;;3;4]

AH_[0]

Check each number which is a multiple of three.

_brk_

lt_table  gt_

lt_tr gt_

lt_td gt_

AQ_[-7010;1]

`7`

lt_/td gt_

lt_td gt_

AQ_[-7010;1]

`5`

lt_/td gt_

lt_td gt_

AQ_[-7010;1]

`9`

lt_/td gt_

lt_td gt_

AQ_[-7010;1]

`3`

lt_/td gt_

lt_/tr gt_

lt_/table gt_

SKIP_

>   

>    LATEX_:=yes:ragit("Check each number which is a multiple of three.",brak(),
aq_([3,5,7,9],Rightone=[1,4],Numcols=4));LATEX_:=no:

_LATEX

\item \ 

Check each number which is a multiple of three.

\par

\begin{tabular}[t]{llll}

\ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $3$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $5$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $7$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $9$\\

 & & &\\

\end{tabular}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm};1;;;4\\

\end{tabular}

_YEK

>    mat:=LinearAlgebra[RandomMatrix](3,4);

mat := Matrix(%id = 49114908)

>    for i from 1 to 3 do for j from 1 to 4 do
  if mat[i,j]<0 then mat[i,j]:=[mat[i,j]] else mat[i,j]:=mat[i,j] fi od od:

>   

>   

>    ragit("Check each number which is negative.",brak(),
aq_(mat));
LATEX_:=yes:
ragit("Check each number which is negative.",brak(),
aq_(mat));LATEX_:=no:

QM_[.05;;;;;;;7;;;10;;12]

AH_[0]

Check each number which is negative.

_brk_

lt_table  gt_

lt_tr gt_

lt_td gt_

AQ_[-596;1]

`81`

lt_/td gt_

lt_td gt_

AQ_[-596;1]

`20`

lt_/td gt_

lt_td gt_

AQ_[-596;1]

`26`

lt_/td gt_

lt_td gt_

AQ_[-596;1]

`32`

lt_/td gt_

lt_/tr gt_

lt_tr gt_

lt_td gt_

AQ_[-596;1]

`35`

lt_/td gt_

lt_td gt_

AQ_[-596;1]

`39`

lt_/td gt_

lt_td gt_

AQ_[-596;1]

`-74`

lt_/td gt_

lt_td gt_

AQ_[-596;1]

`48`

lt_/td gt_

lt_/tr gt_

lt_tr gt_

lt_td gt_

AQ_[-596;1]

`80`

lt_/td gt_

lt_td gt_

AQ_[-596;1]

`-35`

lt_/td gt_

lt_td gt_

AQ_[-596;1]

`13`

lt_/td gt_

lt_td gt_

AQ_[-596;1]

`-60`

lt_/td gt_

lt_/tr gt_

lt_/table gt_

SKIP_

_LATEX

\item \ 

Check each number which is negative.

\par

\begin{tabular}{llll}

\ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $81$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $20$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $26$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $32$\\

 & & &\\

\ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $35$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $39$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $-74$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $48$\\

 & & &\\

\ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $80$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $-35$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $13$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $-60$\\

 & & &\\

\end{tabular}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm};;;;;;;7;;;10;;12\\

\end{tabular}

_YEK

>   

answer box formats: ac_, an_, aw_, af_, ai_, ae_, and acew_

ac_

The ac_ format works like _AC in tagit for html and as expected in latex

>    i:='i':ragit("Compute: ",Sum(i,i=1..25),".  Answer:",ac_(sum(i,i=1..25)));

QM_[.05;325]

AH_[0]

Compute: ` sum_(i = 1)^(25)i`.  Answer:

AC_[15]

SKIP_

>    LATEX_:=yes:
ragit("Compute: ",(Sum(i,i=1..25)),".  Answer:",ac_(sum(i,i=1..25)));
LATEX_:=no:

_LATEX

\item \ 

Compute: $\displaystyle\sum_{i = 1}^{25}i$.  Answer:

\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm}$325$\\

\end{tabular}

_YEK

The Help message for ac_ is:

>    ac_(Help);

ac_(a)  returns answer box if LATEX_=yes else it returns an ac format for tagit, taking the same arguments that the tagit format.

Options: ansbox=[Height=.4,Width=1,Fill="",Placement="c"]  change to a list of arguments to ansbox (see ansbox(Help=yes) for options)

>   

an_

an_ works like AN_.  aw_ works like AW_

>    ragit("\"A three sided figure.\" defines what geometrical term?  Answer: ",aw_("triangle#Triangle"));

QM_[.05;triangle#Triangle]

AH_[0]

"A three sided figure." defines what geometrical term?  Answer: 

AC_[20]

SKIP_

>    LATEX_:=yes:
ragit("\"A three sided figure.\" defines what geometrical term?  Answer: ",aw_("triangle#Triangle"));
LATEX_:=no:

_LATEX

\item \ 

"A three sided figure." defines what geometrical term?  Answer: 

\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm}triangle, Triangle\\

\end{tabular}

_YEK

>    an_(Help);

acts like AN in html and ac in latex.

aw_

The aw_ answer format takes either a list or a string of # separated words or phrases, each of which is accepted as the correct answer to the question.

>    aw_(Help);

aw_(w)  returns an answer box if LATEX_=yes else it returns an aw format for tagit, taking the same arguments that the tagit format.

Options: ansbox=[Height=.4,Width=1,Fill="",Placement="c"]  change to a list of arguments to ansbox (see ansbox(Help=yes) for options)

         txtboxsize=20

>    ragit("What is the English name for a large african or indian mammal with floppy ears and and a long nasal trunk? ",aw_(["Elephant",elephant]));

QM_[.05;Elephant#elephant]

AH_[0]

What is the English name for a large african or indian mammal with floppy ears and and a long nasal trunk? 

AC_[20]

SKIP_

>    LATEX_:=yes:
ragit("What is the English name for a large african or indian mammal with floppy ears and and a long nasal trunk? ",aw_(["Elephant",elephant]));
LATEX_:=no:

_LATEX

\item \ 

What is the English name for a large african or indian mammal with floppy ears and and a long nasal trunk? 

\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm}Elephant, elephant\\

\end{tabular}

_YEK

af_, the function answer

af_ works like AF_ in html and as expected in latex.  The answer is expected to be an algebraic expression with at most one variable.  

>    ragit("Compute the derivative of ",f(x)=x^3+4*x-2,".  Answer:",af_(diff(x^3+4*x-2,x)));

QM_[.05;3*x^2+4]

AH_[0]

Compute the derivative of `f(x) = x^(3) + 4\ x - 2`.  Answer:

AF_[15;x;6;.1;1]

SKIP_

>    LATEX_:=yes:
ragit("Compute the derivative of ",f(x)=x^3+4*x-2,".  Answer:",af_(diff(x^3+4*x-2,x)));
LATEX_:=no:

_LATEX

\item \ 

Compute the derivative of $f \left( x \right)  = x^{3} + 4\,x - 2$.  Answer:

\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm}$3\,x^{2} + 4$\\

\end{tabular}

_YEK

ae_ (using Pdiff)

Use ae_ if your function has more than 1 variable. Note the use of Pdiff to display a partial derivative.  Pdiff is one of several special functions that can be called in a ragit line.    

>    ae_(Help);

aef_(f)  returns an answer box if LATEX_=yes else it returns an ae or af format for tagit (depending on the number of variables), taking as options txtboxsize (the length of the entry box for the answer in mathclass), precision (the absolute error allowed in the evaluation of the correct function and the student answer), and checkints (a list giving the intervals (one for each variable) that the function is evaluated in).

Options: 

   txtboxsize=15

   precision= the default 

   ansbox=[Height=.4,Width=1,Fill="",Placement="c"]  change to a list of arguments to ansbox (see ansbox(Help=yes) for options)

>    ragit("Compute the partial derivative of ",Pdiff(f(x,y),y)," if ", f(x,y)=x^3+4*x-2*sin(y*x),".  Answer:",ae_(diff(x^3+4*x-2*sin(y*x),y),chkints=[3,4,5,6]));

QM_[.05;-2*cos(y*x)*x]

AH_[0]

Compute the partial derivative of `\frac{ del }{ del y}\ f(x,y)` if `f(x,y) = x^(3) + 4\ x - 2\ text(sin)(y\ x)`.  Answer:

AE_[15;x;y;2;36;3;4;5;6]

SKIP_

>    LATEX_:=yes:
ragit("Compute the partial derivative of ",Pdiff(f(x,y),y)," if ", f(x,y)=x^3+4*x-2*sin(y*x),".  Answer:",af_(diff(x^3+4*x-2*sin(y*x),y)));
LATEX_:=no:

_LATEX

\item \ 

Compute the partial derivative of $\frac{\partial}{\partial y}\ f \left( x,y \right) $ if $f \left( x,y \right)  = x^{3} + 4\,x - 2\,\sin(y\,x)$.  Answer:

\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm}$-2\,\cos(y\,x)\,x$\\

\end{tabular}

_YEK

ai_

This works list

>    ragit("Compute the definite integral: ",Int(f(x),x=1..3)," if ",f(x)=x^3+4*x-2,".  Answer:",ai_(int(x^3+4*x-2,x=1..3)));
LATEX_:=yes:
ragit("Compute the definite integral: ",Int(f(x),x=1..3)," if ",f(x)=x^3+4*x-2,".  Answer:",ai_(int(x^3+4*x-2,x=1..3)));
LATEX_:=no:

QM_[.05;32]

AH_[0]

Compute the definite integral: ` int_(1)^(3)f(x)\ d x` if `f(x) = x^(3) + 4\ x - 2`.  Answer:

AF_[15;x;6;.1;1]

SKIP_

_LATEX

\item \ 

Compute the definite integral: $\displaystyle\int_{1}^{3}f \left( x \right) \,d x$ if $f \left( x \right)  = x^{3} + 4\,x - 2$.  Answer:

\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm}$32$\\

\end{tabular}

_YEK

>   

acew_  is an array of ac_, ae_, af_, aw_, ai_ formats similar to ATcross in html, but it has a latex mirror also (unlike ATcross)

>   

>   

>    g:= F->[F,ac_(subs(x=2,F)),ac_(int(F,x=0..1)),af_(diff(F,x))];

g := F -> [F, MCtools:-ac_(subs(x = 2,F)), MCtools:-ac_(int(F,x = 0 .. 1)), MCtools:-af_(diff(F,x))]

>    g(sin(x));

[sin(x), _AC(sin(2)), _AC(1-cos(1)), _AF(cos(x))]

>    acew_(Help);

acew_(lst::listlist) constructs an array of strings, expressions, and answer formats ac_,an_,af_,ae_,ai_,aw_   

 Options:

 Help=no acew_(Help) will retrieve this help

 Numcols=1  increase as needed

 Tableopts=""  replace with an appropriate format string

 Cellopts=""   replace with a format such as "color=\"yellow\"" for all cells or a list of

>    ragit("Complete the table:",acew_([[f(x),f(2),Int(f(x),x=0..1),Diff(f(x),x)],g(sin(x)),g(x^2+3),g(exp(x))]));

QM_[.05;sin(2);1-cos(1);cos(x);7;10/3;2*x;exp(2);-1+exp(1);exp(x)]

AH_[0]

Complete the table:

lt_table  gt_

lt_tr gt_

lt_td  gt_

`f(x)`

lt_/td gt_

lt_td  gt_

`f(2)`

lt_/td gt_

lt_td  gt_

` int_(0)^(1)f(x)\ d x`

lt_/td gt_

lt_td  gt_

`d/(d x)\ f(x)`

lt_/td gt_

lt_/tr gt_

lt_tr gt_

lt_td  gt_

`text(sin)(x)`

lt_/td gt_

lt_td  gt_

AC_[15]

AH_[0]

lt_/td gt_

lt_td  gt_

AC_[15]

AH_[0]

lt_/td gt_

lt_td  gt_

AF_[15;x;6;.1;1]

AH_[0]

lt_/td gt_

lt_/tr gt_

lt_tr gt_

lt_td  gt_

`x^(2) + 3`

lt_/td gt_

lt_td  gt_

AC_[15]

AH_[0]

lt_/td gt_

lt_td  gt_

AC_[15]

AH_[0]

lt_/td gt_

lt_td  gt_

AF_[15;x;6;.1;1]

AH_[0]

lt_/td gt_

lt_/tr gt_

lt_tr gt_

lt_td  gt_

`text(exp)(x)`

lt_/td gt_

lt_td  gt_

AC_[15]

AH_[0]

lt_/td gt_

lt_td  gt_

AC_[15]

AH_[0]

lt_/td gt_

lt_td  gt_

AF_[15;x;6;.1;1]

lt_/td gt_

lt_/tr gt_

lt_/table gt_

SKIP_

>    LATEX_:=yes:
ragit("Complete the table:",acew_([[f(x),f(2),Int(f(x),x=0..1),Diff(f(x),x)],
g(sin(x)),g(x^2+3),g(exp(x))],Numcols=4));
LATEX_:=no:

_LATEX

\item \ 

Complete the table:\begin{tabular}{llll}

$f \left( x \right) $ & $f \left( 2 \right) $ & $\displaystyle\int_{0}^{1}f \left( x \right) \,d x$ & $\frac{d}{d x}\ f \left( x \right) $\\

 & & &\\

$\sin(x)$ & $\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}$ & $\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}$ & $\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}$\\

 & & &\\

$x^{2} + 3$ & $\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}$ & $\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}$ & $\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}$\\

 & & &\\

$\exp(x)$ & $\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}$ & $\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}$ & $\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}$\\

 & & &\\

\end{tabular}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm}$\sin(2)$\\

$\diamond$\hspace{2mm}$1 - \cos(1)$\\

$\diamond$\hspace{2mm}$\cos(x)$\\

$\diamond$\hspace{2mm}$7$\\

$\diamond$\hspace{2mm}$\frac{10}{3}$\\

$\diamond$\hspace{2mm}$2\,x$\\

$\diamond$\hspace{2mm}$\exp(2)$\\

$\diamond$\hspace{2mm}$-1 + \exp(1)$\\

$\diamond$\hspace{2mm}$\exp(x)$\\

\end{tabular}

_YEK

>   

>   

>   

>   

>   

Inserting graphics into homework problems and other documents.

A diagram, drawing or picture  is sometimes needed to help explain a concept or motivate a problem, and the MCtools and latextools package has words to make this relatively easy to do.   You can use addpic  from the MCtools package  to add your drawings to documents.  Maple has two packages of drawing words you can use:   plots  and plottools .    The  Visual Problem Solving Handbook has lots of sample work to show how  to draw diagrams.    We will concentrate here on giving examples of homework problems which have problems.  First, we will load the four packages we may need words from.

>    with(MCtools);with(latextools):

[`&=`, `&==`, AKhint, ARRW, Autoline, Axes, CARR, DL, DV, GP, GP2, GP3, Header, Line, MCdefaults, MM, PA, PARAMS, PC, PCWSE, PP, PT, RANDANS, ac_, addimg, addlink, addpic, addsectionhint, addvlink, aef...
[`&=`, `&==`, AKhint, ARRW, Autoline, Axes, CARR, DL, DV, GP, GP2, GP3, Header, Line, MCdefaults, MM, PA, PARAMS, PC, PCWSE, PP, PT, RANDANS, ac_, addimg, addlink, addpic, addsectionhint, addvlink, aef...
[`&=`, `&==`, AKhint, ARRW, Autoline, Axes, CARR, DL, DV, GP, GP2, GP3, Header, Line, MCdefaults, MM, PA, PARAMS, PC, PCWSE, PP, PT, RANDANS, ac_, addimg, addlink, addpic, addsectionhint, addvlink, aef...

>    with(plots):with(plottools):

Addpic is the principal word for inserting a diagram into a document.  Here is the help for it.

>   

>   

>    addpic(Help);

addpic(pic,name)  saves a plotstucture pic to name.gif in the

current directory and writes an img src into the source worksheet, unless

LATEX_=yes or Latex=yes. In that case, pic is saved to name.eps and an 

includegraphics is written into the source worksheet.

addpic(name) writes an img src or includegraphics into the source worksheet,

 and checks to see if name.Format exists in the current directory.

Options:

Latex = no Change to yes for a latex file.

Format=gif Change to eps,jpg,bmp,pcx as desired.  If Latex or LATEX_ = yes,

 jpeg and jpg is automatically converted to eps by jpeg2ps by Thomas Mertz, if you have it.

 and have set Convertjpg=yes

Height=120 units are points 

Width=160  units are points

Write=yes  Change to no to reuse a previously stored file

Hfill=no Change to before, after, both to put an hfill in those locations

Center=no Change to yes to center the picture

Plotoptions="" Change this only if you must. This replaces the string used by plotsetup which is constructed

by addpic.

To show how addpic works in mathclass homework, make a header for a sample homework, so we can post it later.

>   

>   

>    currentdir("c:/tmp/addpicandragit");

>    currentdir();

>   

So let us make a diagram of a triangle using textplot from plots and polygon from plottools.

>    pic:=display(textplot([0,-.5,10]),textplot([-2.6,3,6]),
textplot([2.6,3,6]),polygon([[-5,0],[5,0],[0,5]],color=yellow),
axes=none,scaling=constrained):pic;

[Maple Plot]

When we export this worksheet to html, the above image is saved to a numbered gif file.   The simplest way to insert a diagram into a homework problem is to just include the name of the structure (in this case 'pic') in the tagit line.  We can refer to this as the visual method . For example,

>    ragit("Classify the triangle shown below.",brak(),pic,as_(["isosceles","right","equiangular"]));

QM_[.05;isosceles]

AH_[0]

Classify the triangle shown below.

_brk_

[Maple Plot]

AS_[isosceles;right;equiangular]

SKIP_

The latex version of this would look like this:

>    LATEX_:=yes:
ragit("Classify the triangle shown below.",brak(),pic,as_(["isosceles","right","equiangular"]));
LATEX_:=no:

_LATEX

\item \ 

Classify the triangle shown below.

\par

[Maple Plot]

$\!$

\begin{tabular}{lll}

\ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ isosceles & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ right & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ equiangular\\

 & &\\

\end{tabular}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm} $1$ \\

\end{tabular}

_YEK

Pros and cons of the visual method.  

One disadvantage of the visual method of inserting diagrams into problems is that you have to resize (usually shrink) the graphic after it is generated in the problem the first time.  If you re-execute the tagit line, the worksheet remembers the dimensions you set.  Resizing by hand involves grabbing a corner of the graphic with your cursor and then pushing in to make the dimensions smaller.  With practice, this works very well generally.  

A big advantage of the method is that it is easier to keep track of the graphic.  Another advantage is that each time you export the worksheet to html or latex the grahic is exported also.

Using addpic.

The procedure addpic will save your graphic to the worksheet directory and put an html or latex instruction into the worksheet for including the graphic either in a mathclass homework or a latex homework. It is a little harder to keep track of the graphic if you use the addpic method rather than the visual method.  First, you have to make sure you are in the homework directory before you execute the tagit line.   addpic will warn you if the target directory is the default Maple directory, but otherwise you are on your own to monitor this.        

>    currentdir("c:/tmp/addpicandragit");

>    ragit("Classify the triangle shown below.",as_(["isosceles","right","equiangular"],randomize=yes),addpic(pic,"isosceles"));

QM_[.05;isosceles]

AH_[0]

Classify the triangle shown below.

AS_[equiangular;isosceles;right]

lt_img src="isosceles.gif" alt="MaplePlot" /gt_

SKIP_

>   

Here is the same problem in latex.

>   

>    LATEX_:=yes:
ragit("Classify the triangle shown below.",brak(),
as_(["isosceles","right","equiangular"],randomize=yes),addpic(pic,"isosceles"));
LATEX_:=no:

_LATEX

\item \ 

Classify the triangle shown below.

\par

\begin{tabular}{lll}

\ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ isosceles & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ equiangular & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ right\\

 & &\\

\end{tabular}

\includegraphics[width=160pt,height=120pt]{isosceles.eps}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm} $1$ \\

\end{tabular}

_YEK

Here is an example of a problem which has an external jpg you want to add to a problem.  In order for this to work right you must have the jpg in

the current directory.

>    ragit("Estimate the age of the person in the picture below.",as_(["40-49","50-59",["60-69"],"70-79","80-89","90-99"]),
brak(),addpic("carl3",Format=jpg));

QM_[.05;60-69]

AH_[0]

Estimate the age of the person in the picture below.

AS_[40-49;50-59;60-69;70-79;80-89;90-99]

_brk_

lt_img src="carl3.jpg" alt="MaplePlot" /gt_

SKIP_

To use the jpg

>    LATEX_:=yes:
ragit("Estimate the age of the person in the picture below.",brak(),as_(["40-49","50-59",["60-69"],"70-79","80-89","90-99"]),brak(),
addpic("carl3",Format=jpg,Height=120,Width=125));
LATEX_:=no:

_LATEX

\item \ 

Estimate the age of the person in the picture below.

\par

\begin{tabular}{llllll}

\ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ 40-49 & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ 50-59 & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ 60-69 & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ 70-79 & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ 80-89 & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ 90-99\\

 & & & & &\\

\end{tabular}

\par

\includegraphics[width=125pt,height=120pt]{carl3.eps}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm} $3$ \\

\end{tabular}

_YEK

>   

>   

>    ragit("Find the area of the isosceles triangle shown below. Answer:",
ac_(evalf(5*sqrt(11),5)),addpic(pic,"atriangle"));

QM_[.05;16.583]

AH_[0]

Find the area of the isosceles triangle shown below. Answer:

AC_[15]

lt_img src="atriangle.gif" alt="MaplePlot" /gt_

SKIP_

>    LATEX_:=yes:
ragit("Find the area of the isosceles triangle shown below. Answer:",
ac_(evalf(5*sqrt(11),5)),brak(),addpic(pic,"atriangle"));
LATEX_:=no:

_LATEX

\item \ 

Find the area of the isosceles triangle shown below. Answer:

\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}

\par

\includegraphics[width=160pt,height=120pt]{atriangle.eps}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm}$ 16.583$\\

\end{tabular}

_YEK

>   

Let's make up a calculus problem.  Find the area between the curves   y = x^2/4  and y = x .    Let's draw a picture for the problem.

>    pic2:=display(GP(llcorner=[-1,-1],wide=6,height=6,font=[TIMES,ROMAN,4]),plot({1/4*x^2,x},x=-1..5,thickness=3),view=[-1..5,-1..5],axesfont=[TIMES,ROMAN,10]): pic2;

[Maple Plot]

>   

>   

>   

>    ragit(precision=`.01`,"Find the area between the graphs of ",y=1/4*x^2," and ",y=x,", for ",ltlt(0,leq,x,leq,4),
" shown below.",brak()," Answer:",ac_(int(x-1/4*x^2,x=0..4)), addpic(pic2,"twofuns"));

QM_[.01;8/3]

AH_[0]

Find the area between the graphs of `y = (1)/(4)\ x^(2)` and `y = x`, for `0 <= x <= 4` shown below.

_brk_

 Answer:

AC_[15]

lt_img src="twofuns.gif" alt="MaplePlot" /gt_

SKIP_

>   

Here is the problem in latex

>    LATEX_:=yes:
ragit("Find the area between the graphs of ",y=1/4*x^2," and ",y=x,", for ",ltlt(0,leq,x,leq,4),
" shown below.",brak()," Answer:",ac_(int(x-1/4*x^2,x=0..4)), addpic(pic2,"twofuns"));
LATEX_:=no:

_LATEX

\item \ 

Find the area between the graphs of $y = \frac{1}{4}\,x^{2}$ and $y = x$, for 

$0\leq x\leq 4$ shown below.

\par

 Answer:

\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}

\includegraphics[width=160pt,height=120pt]{twofuns.eps}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm}$\frac{8}{3}$\\

\end{tabular}

_YEK

>   

>   

>   

>   

more use of addpic

>    #print(rlprint);rlprint(Help);

>    geo := proc(m,n,r,clrs)
  local bord,nails;
  bord:=plottools[polygon]([[0,0],[n,0],[n,m],[0,m]],color=clrs[1]):
  nails := plots[display]( seq(seq(plottools[disk]([i,j],r,color=clrs[2]),i=0..n),j=0..m)):
plots[display](nails,bord,scaling=constrained,axes=none);
  end:

>    #geo(5,6,.05,[yellow,red]);

>    band := proc(lst,clr)
  plot(lst,color=clr) end:

>    pic:=(n,m)->plots[display](geo(n,m,.05,[turquoise,red])):

>    #pic(2,4);

>    acew_(Help);

acew_(lst::listlist) constructs an array of strings, expressions, and answer formats ac_,an_,af_,ae_,ai_,aw_   

 Options:

 Help=no acew_(Help) will retrieve this help

 Numcols=1  increase as needed

 Tableopts=""  replace with an appropriate format string

 Cellopts=""   replace with a format such as "color=\"yellow\"" for all cells or a list of

>   

>   

>    ragit("For each rectangle below, count the number B of boundary nails, the number I of interior nails, and also compute the area of the rectangle, assuming that adjacent horizontal or vertical pairs of nails are 1 unit apart.",brak(),
acew_([["`B= `",ac_(12),"`I= `",ac_(3),"`Area = `",ac_(8),(addpic(pic(2,4),"pic1"))],
["`B= `",ac_(14),"`I= `",ac_(6),"`Area = `",ac_(12),(addpic(pic(3,4),"pic2"))],
["`B= `",ac_(18),"`I= `",ac_(10),"`Area = `",ac_(18),(addpic(pic(3,6),"pic3"))]]),brak());
LATEX_:=yes:
ab:=op([ansbox=[Height=.2,Width=.3,Fill="",Placement="c"]]):

>    ragit("For each rectangle below, count the number B of boundary nails, the number I of interior nails, and also compute the area of the rectangle, assuming that adjacent horizontal or vertical pairs of nails are 1 unit apart.",brak(),
acew_([["$B= $",ac_(12,ansbox=[Height=.2,Width=.3,Fill="",Placement="c"]),"$I= $",ac_(3,ab),"$Area = $",ac_(8,ab),(addpic(pic(2,4),"pic1",Height=30,Width=40))],
["$B= $",ac_(14,ab),"$I= $",ac_(6,ab),"$Area = $",ac_(12,ab),(addpic(pic(3,4),"pic2",Height=30,Width=40))],
["$B= $",ac_(18,ab),"$I= $",ac_(10,ab),"$Area = $",ac_(18,ab),(addpic(pic(3,6),"pic3",Height=30,Width=40))]],Numcols=7));
LATEX_:=no:

QM_[.05;12;3;8;14;6;12;18;10;18]

AH_[0]

For each rectangle below, count the number B of boundary nails, the number I of interior nails, and also compute the area of the rectangle, assuming that adjacent horizontal or vertical pairs of nails are 1 unit apart.

_brk_

lt_table  gt_

lt_tr gt_

lt_td  gt_

`B= `

lt_/td gt_

lt_td  gt_

AC_[15]

AH_[0]

lt_/td gt_

lt_td  gt_

`I= `

lt_/td gt_

lt_td  gt_

AC_[15]

AH_[0]

lt_/td gt_

lt_td  gt_

`Area = `

lt_/td gt_

lt_td  gt_

AC_[15]

AH_[0]

lt_/td gt_

lt_td  gt_

lt_img src="pic1.gif" alt="MaplePlot" /gt_

lt_/td gt_

lt_/tr gt_

lt_tr gt_

lt_td  gt_

`B= `

lt_/td gt_

lt_td  gt_

AC_[15]

AH_[0]

lt_/td gt_

lt_td  gt_

`I= `

lt_/td gt_

lt_td  gt_

AC_[15]

AH_[0]

lt_/td gt_

lt_td  gt_

`Area = `

lt_/td gt_

lt_td  gt_

AC_[15]

AH_[0]

lt_/td gt_

lt_td  gt_

lt_img src="pic2.gif" alt="MaplePlot" /gt_

lt_/td gt_

lt_/tr gt_

lt_tr gt_

lt_td  gt_

`B= `

lt_/td gt_

lt_td  gt_

AC_[15]

AH_[0]

lt_/td gt_

lt_td  gt_

`I= `

lt_/td gt_

lt_td  gt_

AC_[15]

AH_[0]

lt_/td gt_

lt_td  gt_

`Area = `

lt_/td gt_

lt_td  gt_

AC_[15]

lt_/td gt_

lt_td  gt_

lt_img src="pic3.gif" alt="MaplePlot" /gt_

lt_/td gt_

lt_/tr gt_

lt_/table gt_

_brk_

SKIP_

_LATEX

\item \ 

For each rectangle below, count the number B of boundary nails, the number I of interior nails, and also compute the area of the rectangle, assuming that adjacent horizontal or vertical pairs of nails are 1 unit apart.

\par

\begin{tabular}{lllllll}

$B= $ & $\ \fbox{\parbox[c][.2in][c]{.3in}{\hfill}}$ & $I= $ & $\ \fbox{\parbox[c][.2in][c]{.3in}{\hfill}}$ & $Area = $ & $\ \fbox{\parbox[c][.2in][c]{.3in}{\hfill}}$ & \includegraphics[width=40pt,height=30pt]{pic1.eps}\\

 & & & & & &\\

$B= $ & $\ \fbox{\parbox[c][.2in][c]{.3in}{\hfill}}$ & $I= $ & $\ \fbox{\parbox[c][.2in][c]{.3in}{\hfill}}$ & $Area = $ & $\ \fbox{\parbox[c][.2in][c]{.3in}{\hfill}}$ & \includegraphics[width=40pt,height=30pt]{pic2.eps}\\

 & & & & & &\\

$B= $ & $\ \fbox{\parbox[c][.2in][c]{.3in}{\hfill}}$ & $I= $ & $\ \fbox{\parbox[c][.2in][c]{.3in}{\hfill}}$ & $Area = $ & $\ \fbox{\parbox[c][.2in][c]{.3in}{\hfill}}$ & \includegraphics[width=40pt,height=30pt]{pic3.eps}\\

 & & & & & &\\

\end{tabular}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm}$12$\\

$\diamond$\hspace{2mm}$3$\\

$\diamond$\hspace{2mm}$8$\\

$\diamond$\hspace{2mm}$14$\\

$\diamond$\hspace{2mm}$6$\\

$\diamond$\hspace{2mm}$12$\\

$\diamond$\hspace{2mm}$18$\\

$\diamond$\hspace{2mm}$10$\\

$\diamond$\hspace{2mm}$18$\\

\end{tabular}

_YEK

>   

>   

>   

problem generators

One of the main advantages of using Maple to format problems is that it gives you  the ability to create problem generators, that is, procedures which when executed will return problems which are essentially the same, except some numbers in the problem are different.

In order to create such a problem generator, you can start with any problem and parameterize it: Choose one or more things (usually numbers, but not always) in the problem which you want to allow to be different.  For example, take a problem using the ac_ format:

>    i:='i':ragit("Compute: ",Sum(i,i=1..25),".  Answer:",ac_(sum(i,i=1..25)));

QM_[.05;325]

AH_[0]

Compute: ` sum_(i = 1)^(25)i`.  Answer:

AC_[15]

SKIP_

One parameter in this problem is the number of terms, say n, that are being summed:  So a simple parameterization of this problem would be

>    prob:=proc(n)
   global LATEX_; # This is needed if you want the latex version of the problem.
   local i;
   ragit("Compute: ",Sum(i,i=1..n),".  Answer:",ac_(sum(i,i=1..n)));
   LATEX_:=yes: # ragit returns latex version when LATEX_ = yes
   ragit("Compute: ",Sum(i,i=1..n),".  Answer:",ac_(sum(i,i=1..n)));
   LATEX_:=no: # ragit returns html version when LATEX_ <> yes
   NULL:
   end:

Note we are making this generator spit out both an html and a latex version.  If you want a latex version version of your problem available, you always need to include the 3 lines which have LATEX_ in them.  If you only want an html version, omit those lines and make only one call to ragit in the generator.

>    prob(50);


QM_[.05;1275]

AH_[0]

Compute: ` sum_(i = 1)^(50)i`.  Answer:

AC_[15]

SKIP_

_LATEX

\item \ 

Compute: $\displaystyle\sum_{i = 1}^{50}i$.  Answer:

\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm}$1275$\\

\end{tabular}

_YEK

We can now create as many versions of this problem as we want, simply by executing the line prob(n); for as many values of n that we need.

We can put another parameter in this problem, namely the summand f(i)  (currently f(i)=i).   So, copy down the problem generator to a new input line and modify it.  For example, we could have f(i)=a*i+b, for various values of a and b.    

>    prob:=proc(n,a,b)
   global LATEX_;
   local i;
   ragit("Compute: ",Sum(a*i+b,i=1..n),".  Answer:",ac_(sum(a*i+b,i=1..n)));
   LATEX_:=yes:
   ragit("Compute: ",Sum(a*i+b,i=1..n),".  Answer:",ac_(sum(a*i+b,i=1..n)));
   LATEX_:=no:
   NULL:
   end:

>    prob(25,3,2);


QM_[.05;1025]

AH_[0]

Compute: ` sum_(i = 1)^(25)3\ i + 2`.  Answer:

AC_[15]

SKIP_

_LATEX

\item \ 

Compute: $\displaystyle\sum_{i = 1}^{25}3\,i + 2$.  Answer:

\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm}$1025$\\

\end{tabular}

_YEK

>   

Of course, the problems above can be solved by brute force. We could modify this problem to test the students knowledge of summing arithmetic sequences in general, simply by changing the answer format from ac_ to ae_.  Then they will need to type in an expression, using Maple syntax.  This is close to calculator syntax and you should make a description of it available to your students.

>    prob:=proc(n,a,b)
   global LATEX_;
   local i;
   ragit("Compute: ",Sum(a*i+b,i=1..n),".  Answer:",ae_(sum(a*i+b,i=1..n)));
   LATEX_:=yes:
   ragit("Compute: ",Sum(a*i+b,i=1..n),".  Answer:",ae_(sum(a*i+b,i=1..n)));
   LATEX_:=no:
   NULL:
   end:

>    prob(25,r,s);

QM_[.05;25*s+325*r]

AH_[0]

Compute: ` sum_(i = 1)^(25)r\ i + s`.  Answer:

AE_[15;2;r;s;25;.1;1;.1;1]

SKIP_

_LATEX

\item \ 

Compute: $\displaystyle\sum_{i = 1}^{25}r\,i + s$.  Answer:

\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm}$25\,s + 325\,r$\\

\end{tabular}

_YEK

>   

Paramvals

As it turns out, it is convenient to have a procedure that we can use in ragit to generate a set of values for our parameters in a problem.   This makes it easier to generate problems.  What you do is restrict each parameter to a small set of values and have the procedure then randomly select values from those ranges. The  procedure is called paramvals.  Here is it's help page.

>    paramvals(Help);

paramvals([args],ls1) where  args is the sequence of arguments to the problem generator, 

and ls1 is a list of lists of parameter names

and range specifications suitable for assignvals (See assignvals(Help=yes) below).

Note: this was written to be used in a problem generator.

Usually, you will call something like paramvals([args],[[a,{2,3,1}],...])

Then when the generator is called with just a version number, the list which is printed

can be pasted back into the call to get the same inputs in case maintainance is needed.

 Help for assignvals 

assignvals(exprseq)  takes a exprseq of ['X',range] or ['X',d,m..n] or ['X',perm,list]

 or ['X',mat,list] or ['X',struct,command],and assigns X a random value chosen thusly:

 1. for ['X',range] X is assigned a value in range, where range can be an integer range  m..n, 

or a set or list of values

 2. for ['X',d,m..n] d is a positive integer, m..n is an integer range and X is assigned a random floating  point with d significant digits between  m/10^d and n/10^d.

 3. for ['X',perm,list]  X is assigned a random permuation of the elements in the list.

 4. for ['X',list,listofvalues]  X is assigned the listofvalues

 5. for ['X',mat,list]  X is assigned a random list of lists using list as the argument to LinearAlgebra[RandomMatrix].   

Example: ['c',mat,[2,3,generator=rand(1..4),density=.8] assigns c a

   2 by 3 list of lists of 20% zeros, 80% random numbers between 1 and 4.

 6. for ['X',struct,command] X is assigned the output of the maple command. 

Example:  ['b',struct,plot(x^2,x=0..4)] assigns b the plot structure for the graph of x^2.

  

Note: no variable can depend on a variable assigned in that call to assignvals.  

 Example: 

 illegal  assignvals(['A',2..5],['B',{"t",b,c,1}],['C',[A,A,A,B]]);

 legal    assignvals(['A',2..5],['B',{"t",b,c,1}]): assignvals(['C',[A,A,A,B]]);

  

 Options:  

 Help=no  change to yes to get this message.

To illustrate, if we want to employ this method to generate numerical values for n, a, and b in example above, we would take the parameters out of the line proc(n,a,b) and make them local.  Then, we can invoke getparams to assign values to n, a and b.  Note that we have restricted the range considerably in the problem.  This tends to make the problems comparable in difficulty.  As it stands, there will be 3^3 = 27 different possible versions of this problem.  It is customary to have only 5 actual versions of a problem, one for the common version and 4 to choose from in the personal versions.  Generally speaking when generating problems in this 'random' manner it is a good idea to look at the problems as you generate them to see if they are suitable.  If they are, you can go ahead and past the current inputs into the problem line to fix the problem.  This is useful for homework maintenance.  Sometimes you need to make a change in a problem after you have posted the homework.  If this occurs you would like to be able to repost the problem with the same inputs.  

>    prob:=proc()
   global LATEX_;
   local i,n,a,b; #all parameter names should go in this line.
   paramvals([args],[[n,[25,30,35]],[a,[2,3,4]],[b,[10,15,20]]]);
   ragit("Compute: ",Sum(a*i+b,i=1..n),".  Answer:",ac_(sum(a*i+b,i=1..n)));
   LATEX_:=yes:
   ragit("Compute: ",Sum(a*i+b,i=1..n),".  Answer:",ac_(sum(a*i+b,i=1..n)));
   LATEX_:=no:
   NULL:
   end:

>    prob(1,[30,2,20]);

current inputs are  (1,[30,2,20])


QM_[.05;1530]

AH_[0]

Compute: ` sum_(i = 1)^(30)2\ i + 20`.  Answer:

AC_[15]

SKIP_

_LATEX

\item \ 

Compute: $\displaystyle\sum_{i = 1}^{30}2\,i + 20$.  Answer:

\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm}$1530$\\

\end{tabular}

_YEK

Now often you might have two parameters you want to come from the same range but you want them to have different values.  Use the perm assignment.  To illustrate, suppose we wanted to choose which of two numbers is larger.

>    prob:=proc()
   global LATEX_;
   local i,p; #p is to be a permutation of the numbers in.
   paramvals([args],[[p,perm,[293828,2281883,3030392,2292929,2200229]]]);
   ragit("Which of the numbers ",p[1]," and ",p[2]," is larger?  Answer:",ac_(max(p[1],p[2])));
   LATEX_:=yes:
   ragit("Which of the numbers ",p[1]," and ",p[2]," is larger?  Answer:",ac_(max(p[1],p[2])));
   LATEX_:=no:
   NULL:
   end:

>   

>    prob (1,[[2281883, 2200229, 3030392, 293828, 2292929]]);

current inputs are  (1,[[2281883, 2200229, 3030392, 293828, 2292929]])


QM_[.05;2281883]

AH_[0]

Which of the numbers `2281883` and `2200229` is larger?  Answer:

AC_[15]

SKIP_

_LATEX

\item \ 

Which of the numbers $2281883$ and $2200229$ is larger?  Answer:

\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm}$2281883$\\

\end{tabular}

_YEK

>   

Problem generators using paramvals

Here is an example of a problem generator which

>   

>   

>    prob1 := proc()
  global LATEX_:
  local a,b;
  paramvals([args],[[a,perm,[1,2,3,4,5]],[b,struct,LinearAlgebra[RandomMatrix](5,5)]]);
  ragit("What is the value of the cell in row ",a[1]," and column,",a[2]," of ",Mat(b),"? ",ac_(b[a[1],a[2]])):
 LATEX_:=yes:
ragit("What is the value of the cell in row ",a[1]," and column,",a[2]," of ",Mat(b),"? ",ac_(b[a[1],a[2]])):
LATEX_:=no: end:

>    prob1 (1,[[1, 3, 5, 2, 4],Matrix(5, 5, [[78,-2,33,-58,98],[-8,-69,-17,75,5],[-90,17,58,-31,-23],[-81,-87,-21,-30,19],[-43,37,15,-50,-93]])]);

current inputs are  (1,[[1, 3, 5, 2, 4],Matrix(5, 5, [[78,-2,33,-58,98],[-8,-69,-17,75,5],[-90,17,58,-31,-23],[-81,-87,-21,-30,19],[-43,37,15,-50,-93]])])

QM_[.05;33]

AH_[0]

What is the value of the cell in row `1` and column,`3` of `((78 , -2 , 33 , -58 , 98),(-8 , -69 , -17 , 75 , 5),(-90 , 17 , 58 , -31 , -23),(-81 , -87 , -21 , -30 , 19),(-43 , 37 , 15 , -50 , -93))`? 

AC_[15]

SKIP_

_LATEX

\item \ 

What is the value of the cell in row $1$ and column,$3$ of $\left(\begin{array}{ccccc} 78 & -2 & 33 & -58 & 98 \\-8 & -69 & -17 & 75 & 5 \\-90 & 17 & 58 & -31 & -23 \\-81 & -87 & -21 & -30 & 19 \\-43 & 37 & 15 & -50 & -93 \end{array}\right)$? 

\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm}$33$\\

\end{tabular}

_YEK

no

>   

>   

>   

>   

evaluate and make judgement

Here is another problem generator made using ragit and paramvals.

>    prob := proc()
 global LATEX_:
 local a,b,c,d,e,i,f,funcs1,dom1;
  paramvals([args],[[a,[seq(i,i=1..6)]],[b,[seq(i,i=1..6)]],[c,[seq(i,i=2..8)]],[d,[1,2,3]],[e,[1,2,3]]]);
  funcs1:=[f(x,y)=sqrt(a*x+b*exp(y)+c),f(x,y)=b*ln(x^2+c*y^2+c),f(x,y)=a/(b*x^2+exp(c*y))];
  dom1:=["increasing","neither","decreasing"];
  
ragit("Evaluate the function ",funcs1[d]," at ",Pnt([x,y]) = Pnt(1,1/2),ac_(subs({x=1,y=1/2},rhs(funcs1[d]))),brak(),
"Consider the function ",f(1,y)," of ",y,":  Decide if it is increasing, decreasing or neither over its natural domain.",as_(dom1,Rightone=d)  );
LATEX_:=yes:
ragit("Evaluate the function ",funcs1[d]," at ",Pnt([x,y]) = Pnt(1,1/2),ac_(subs({x=1,y=1/2},rhs(funcs1[d]))),brak(),
"Consider the function ",f(1,y)," of ",y,":  Decide if it is increasing, decreasing or neither over its natural domain.",as_(dom1,Rightone=d)  );
LATEX_:=no: NULL:  end:

>    prob(1,1,3,8,2,1);

current inputs are  (1,[1,3,8,2,1])

QM_[.05;3*ln(11);neither]

AH_[0]

Evaluate the function `f(x,y) = 3\ text(ln)(x^(2) + 8\ y^(2) + 8)` at `(x,y) = (1,(1)/(2))`

AC_[15]

AH_[0]

_brk_

Consider the function `f(1,y)` of `y`:  Decide if it is increasing, decreasing or neither over its natural domain.

AS_[increasing;neither;decreasing]

SKIP_

_LATEX

\item \ 

Evaluate the function $f \left( x,y \right)  = 3\,\ln(x^{2} + 8\,y^{2} + 8)$ at $(x, y) = (1, \frac{1}{2})$

\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}

\par

Consider the function $f \left( 1,y \right) $ of $y$:  Decide if it is increasing, decreasing or neither over its natural domain.

\begin{tabular}{lll}

\ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ increasing & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ neither & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ decreasing\\

 & &\\

\end{tabular}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm}$3\,\ln(11)$\\

$\diamond$\hspace{2mm} $2$ \\

\end{tabular}

_YEK

>    as_(Help);

as_(l)  returns a list from which to circle

 the correct answer (listed first or enclosed in square brackets)if LATEX_=yes, else it returns an AS format for tagit, taking the same arguments  the tagit format does. 

Options: 

Shuffle=no, or =yes or =[3,2,1] to reverse the order of 3 alternatives

Rightone=1  Change if the correct answer is not the first answer.)

>   

>    prob(2);

>    prob(3);

>    prob(4);

>    prob(5);

>   

>   

>   

prob12

Here is a trig problem generator using arq_.  (the old tbuttons)  It always generates the same problem, only the order of the answers changes.   We widened the table in html to 40% for readability.  

>    prob := proc()
 global LATEX_:
 local ans;
  ans:=[3/2*pi,0,pi/3,pi/2,pi,5/4*pi,"All reals","No solution"];
   ragit("Solve for ",theta,", ",theta," in  [0,",2*pi,"):  ", 2*sin(theta)^2 - sin(theta) = 3,
  arq_(ans,Numcols=4,Tableopts="width=\"40\%\""));
LATEX_:=yes:
ragit("Solve for ",theta,", ",theta," in  [0,",(2*pi),"):  ", 2*sin(theta)^2 - sin(theta) = 3,
  arq_(ans,Numcols=4));
LATEX_:=no:
NULL: end:

>    prob();

QM_[.05;1]

AH_[0]

Solve for `\theta`, `\theta` in  [0,`2\ \pi`):  `2\ (text(sin)(\theta))^(2) - text(sin)(\theta) = 3`

lt_table width="40%" gt_

lt_tr gt_

lt_td gt_

AR_[-2500;1]

`(3)/(2)\ \pi`

lt_/td gt_

lt_td gt_

AR_[-2500;1]

`0`

lt_/td gt_

lt_td gt_

AR_[-2500;1]

`(1)/(3)\ \pi`

lt_/td gt_

lt_td gt_

AR_[-2500;1]

`(1)/(2)\ \pi`

lt_/td gt_

lt_/tr gt_

lt_tr gt_

lt_td gt_

AR_[-2500;1]

`\pi`

lt_/td gt_

lt_td gt_

AR_[-2500;1]

`(5)/(4)\ \pi`

lt_/td gt_

lt_td gt_

AR_[-2500;1]

All reals

lt_/td gt_

lt_td gt_

AR_[-2500;1]

No solution

lt_/td gt_

lt_/tr gt_

lt_/table gt_

SKIP_

_LATEX

\item \ 

Solve for $\theta$, $\theta$ in  [0,$2\,\pi$):  $2\,{\sin(\theta)}^{2} - \sin(\theta) = 3$

\begin{tabular}{llll}

\ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $\frac{3}{2}\,\pi$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $0$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $\frac{1}{3}\,\pi$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $\frac{1}{2}\,\pi$\\

 & & &\\

\ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $\pi$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $\frac{5}{4}\,\pi$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ All reals & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ No solution\\

 & & &\\

\end{tabular}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm} $1$ \\

\end{tabular}

_YEK

Here is the same problem, only with labels stuck in and a permutation of the alternatives so that we can recover a particular permutation for problem maintenance.  Also, when using arq_ or acew_ in a homework which requires maintenance, you should make the identifier a parameter so you can use it again on re-execution.

>    2*sin(3*Pi/2)^2-sin(3*Pi/2);

3

>   

>    prob12 := proc()
 global LATEX_:
 local ans,labels,p,i,id;
 ans:=[[3/2*pi],[0],[pi/3],[pi/2],[pi],[5/4*pi],["All reals"],["No solution"]];
 paramvals([args],[[p,perm,[seq(i,i=1..nops(ans))]],[id,[seq(rand(10001..19999)(),i=1..1)]]]);
 ragit("Solve for ",theta,", ",theta," in  [0,",2*pi,"):  ", 2*sin(theta)^2 - sin(theta) = 3,
 arq_(ans,Numcols=4,Labels=2,Shuffle=p,Tableopts="width=\"50\%\"",Id=-id));
LATEX_:=yes:
ragit("Solve for ",theta,", ",theta," in  [0,",2*pi," ):  ", 2*sin(theta)^2 - sin(theta) = 3,
 arq_(ans,Numcols=4,Labels="",Shuffle=p,Tableopts="width=\"50\%\""));
LATEX_:=no:
   end:

>    prob12 (1,[[4, 8, 6, 5, 3, 1, 2, 7],15124]);

current inputs are  (1,[[4, 8, 6, 5, 3, 1, 2, 7],15124])

QM_[.05;6]

AH_[0]

Solve for `\theta`, `\theta` in  [0,`2\,\pi`):  `2\,{\sin(\theta)}^{2} - \sin(\theta) = 3`

lt_table width="50%" gt_

lt_tr gt_

lt_td gt_

AR_[-15124;1]

lt_font color="red" gt_lt_b gt_A) lt_/b gt_ lt_/font gt_ 

`\frac{1}{2}\,\pi`

lt_/td gt_

lt_td gt_

AR_[-15124;1]

lt_font color="red" gt_lt_b gt_B) lt_/b gt_ lt_/font gt_ 

No solution

lt_/td gt_

lt_td gt_

AR_[-15124;1]

lt_font color="red" gt_lt_b gt_C) lt_/b gt_ lt_/font gt_ 

`\frac{5}{4}\,\pi`

lt_/td gt_

lt_td gt_

AR_[-15124;1]

lt_font color="red" gt_lt_b gt_D) lt_/b gt_ lt_/font gt_ 

`\pi`

lt_/td gt_

lt_/tr gt_

lt_tr gt_

lt_td gt_

AR_[-15124;1]

lt_font color="red" gt_lt_b gt_E) lt_/b gt_ lt_/font gt_ 

`\frac{1}{3}\,\pi`

lt_/td gt_

lt_td gt_

AR_[-15124;1]

lt_font color="red" gt_lt_b gt_F) lt_/b gt_ lt_/font gt_ 

`\frac{3}{2}\,\pi`

lt_/td gt_

lt_td gt_

AR_[-15124;1]

lt_font color="red" gt_lt_b gt_G) lt_/b gt_ lt_/font gt_ 

`0`

lt_/td gt_

lt_td gt_

AR_[-15124;1]

lt_font color="red" gt_lt_b gt_H) lt_/b gt_ lt_/font gt_ 

All reals

lt_/td gt_

lt_/tr gt_

lt_/table gt_

SKIP_

_LATEX

\item \ 

Solve for $\theta$, $\theta$ in  [0,$2\,\pi$ ):  $2\,{\sin(\theta)}^{2} - \sin(\theta) = 3$

\begin{tabular}[t]{llll}

\ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $\frac{1}{2}\,\pi$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ No solution & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $\frac{5}{4}\,\pi$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $\pi$\\

 & & &\\

\ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $\frac{1}{3}\,\pi$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $\frac{3}{2}\,\pi$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $0$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ All reals\\

 & & &\\

\end{tabular}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm} $6$ \\

\end{tabular}

_YEK

no

>   

>   

 The multiple choice format  as_ :  selection box answers

This is a selection box multiple choice answer format, for simple unformatted choices.
 The format is as_(answers) where answers is a list of alternative answers with the correct answer first.  If the first alternative is not correct, put brackets around the correct one.   

>   

>    ragit("Bill can mow a yard in 3 hours. Jim can mow the same yard in 5 hours.  How many hours does it take Bill and Jim to mow the yard together, assuming they do not interfere with each other? Select the most nearly correct answer.",as_([1.875,2.125,4,"None of the others"]));
LATEX_:=yes:
ragit("Bill can mow a yard in 3 hours. Jim can mow the same yard in 5 hours.  How many hours does it take Bill and Jim to mow the yard together, assuming they do not interfere with each other? Select the most nearly correct answer.", as_([1.875,2.125,4,"None of the others"]));
LATEX_:=no:

QM_[.05;1.875]

AH_[0]

Bill can mow a yard in 3 hours. Jim can mow the same yard in 5 hours.  How many hours does it take Bill and Jim to mow the yard together, assuming they do not interfere with each other? Select the most nearly correct answer.

AS_[1.875;2.125;4;None of the others]

SKIP_

_LATEX

\item \ 

Bill can mow a yard in 3 hours. Jim can mow the same yard in 5 hours.  How many hours does it take Bill and Jim to mow the yard together, assuming they do not interfere with each other? Select the most nearly correct answer.

\begin{tabular}{llll}

\ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $ 1.875$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $ 2.125$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $4$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ None of the others\\

 & & &\\

\end{tabular}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm} $1$ \\

\end{tabular}

_YEK

By default the first alternative in the list of alternatives is assumed the right answer.  You can change this by setting the rightanswers option to the correct answer, or by enclosing the right answer in square brackets. You can also fix the order of the alternatives in the list to be the one given by setting the randomize=  option to no.

>    ragit("Bill can mow a yard in 3 hours. Jim can mow the same yard in 5 hours.  How many hours does it take Bill and Jim to mow the yard together, assuming they do not interfere with each other?",brak()," Select the most nearly correct answer.",brak(),as_([2.125,[1.875],4,"None of the others"],randomize=no));
LATEX_:=yes:
ragit("Bill can mow a yard in 3 hours. Jim can mow the same yard in 5 hours.  How many hours does it take Bill and Jim to mow the yard together, assuming they do not interfere with each other?",brak()," Select the most nearly correct answer.",brak(),as_([2.125,[1.875],4,"None of the others"],randomize=no));
LATEX_:=no:

QM_[.05;1.875]

AH_[0]

Bill can mow a yard in 3 hours. Jim can mow the same yard in 5 hours.  How many hours does it take Bill and Jim to mow the yard together, assuming they do not interfere with each other?

_brk_

 Select the most nearly correct answer.

_brk_

AS_[2.125;1.875;4;None of the others]

SKIP_

_LATEX

\item \ 

Bill can mow a yard in 3 hours. Jim can mow the same yard in 5 hours.  How many hours does it take Bill and Jim to mow the yard together, assuming they do not interfere with each other?

\par

 Select the most nearly correct answer.

\par

\begin{tabular}{llll}

\ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $ 2.125$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $ 1.875$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $4$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ None of the others\\

 & & &\\

\end{tabular}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm} $2$ \\

\end{tabular}

_YEK

>   

>   

>   

>     

tr and special symbols

There is a large vocabulary of special  math symbols in both latex and ascimath.  tr will process many of these as latex or html depending on whether LATEX_ = yes.  The vocabulary will be enlarged as time permits.

The help is

>    tr(Help);

tr(a1,a2,...) returns a  string formatted either with $ (if LATEX_=yes) or `.  The ai's can be regular expressions, strings, or the terms leq,lt,geq,gt,neq,xx,`-:`,cup,cap,sub,elt,`-=`,pm,int,oint,del,grad, infty,empty,aleph,angle,cdots,cdot,tri,perp.

Here are some sample problems:

>    prob:=proc()
global LATEX_:
 local a,b,alts,w;
  #w:="amp_8734":
  paramvals([args],[[a,[3,4,5]],[b,[-9,-11,-7]]]);
  alts:=[cat(w,"/-",w)," 0/0 ",cat(" 0^0 "),cat(" ",w,"^",w," ")];
alts:=[cat("1. ",tr(infty,"/-",infty)),cat("2. ",tr(0,"/",0)),cat("3. ",tr(0,"^",0)),cat("4. ",tr(infty,"^",infty))];
  ragit("Classify the indeterminancy type of the following limits:",brak(),
 "i) ",Lim((a*x+b)/(a+b*x),x=infinity),as_(alts),brak(),
 "ii) ",Lim((x^2-4)/(x-2),x=infinity),as_(alts,Rightone=2));
LATEX_:=yes:
alts:=[tr("\\frac{",infinity,"}{-",infinity,"}"),tr(0,"/",0),tr(0,"^",0),tr(infinity,"^",infinity)];
ragit("Classify the indeterminancy type of the following limits:",brak(),
 "i) ",Lim((a*x+b)/(a+b*x),x=infinity),as_(alts),brak(),
 "ii) ",Lim((x^2-4)/(x-2),x=infinity),as_(alts,Rightone=2));
LATEX_:=no:
NULL
 end:

>    prob(1);

current inputs are  (1,[4,-11])

QM_[.05;1. `\amp_#8734;/-\amp_#8734;`;2. `0/0`]

AH_[0]

Classify the indeterminancy type of the following limits:

_brk_

i) `lim_(x to \infty )\ (-4\ x + 11)/(-4 + 11\ x)`

AS_[1. `\amp_#8734;/-\amp_#8734;`;2. `0/0`;3. `0^0`;4. `\amp_#8734;^\amp_#8734;`]

AH_[0]

_brk_

ii) `lim_(x to \infty )\ (x^(2) - 4)/(x - 2)`

AS_[1. `\amp_#8734;/-\amp_#8734;`;2. `0/0`;3. `0^0`;4. `\amp_#8734;^\amp_#8734;`]

SKIP_

_LATEX

\item \ 

Classify the indeterminancy type of the following limits:

\par

i) $\displaystyle\lim_{x\rightarrow \infty }\,\frac{-4\,x + 11}{-4 + 11\,x}$

\begin{tabular}[t]{llll}

\ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $\frac{\infty }{-\infty }$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $0/0$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $0^0$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $\infty ^\infty $\\

 & & &\\

\end{tabular}

\par

ii) $\displaystyle\lim_{x\rightarrow \infty }\,\frac{x^{2} - 4}{x - 2}$

\begin{tabular}[t]{llll}

\ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $\frac{\infty }{-\infty }$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $0/0$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $0^0$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $\infty ^\infty $\\

 & & &\\

\end{tabular}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm} $1$ \\

$\diamond$\hspace{2mm} $2$ \\

\end{tabular}

_YEK

>    prob:=proc()
global LATEX_:
 local a,b,alts,w;
   paramvals([args],[[a,[3,4,5]],[b,[-9,-11,-7]]]);
  alts:=["1. `infty/-infty`","2. `0/0`","3. `0^0`","4. `infty^infty`","`infty/infty`"];
  ragit("Classify the indeterminancy type of the following limits:",brak(),
 "i) ",Lim((a*x+b)/(a+b*x),x=infinity),as_(alts),brak(),
 "ii) ",Lim((x^2-4)/(x-2),x=infinity),as_(alts,Rightone=2));
LATEX_:=yes:
alts:=[tr("\\frac{",infinity,"}{-",infinity,"}"),tr(0,"/",0),tr(0,"^",0),tr(infinity,"^",infinity),tr(infty,"/",infty)];
ragit("Classify the indeterminancy type of the following limits:",brak(),
 "i) ",Lim((a*x+b)/(a+b*x),x=infinity),as_(alts),brak(),
 "ii) ",Lim((x^2-4)/(x-2),x=infinity),as_(alts,Rightone=2));
LATEX_:=no:
NULL
 end:

>    prob(1);

current inputs are  (1,[3,-9])

QM_[.05;1. `infty/-infty`;2. `0/0`]

AH_[0]

Classify the indeterminancy type of the following limits:

_brk_

i) `lim_(x to \infty )\ (-1\ x + 3)/(-1 + 3\ x)`

AS_[1. `infty/-infty`;2. `0/0`;3. `0^0`;4. `infty^infty`;`infty/infty`]

AH_[0]

_brk_

ii) `lim_(x to \infty )\ (x^(2) - 4)/(x - 2)`

AS_[1. `infty/-infty`;2. `0/0`;3. `0^0`;4. `infty^infty`;`infty/infty`]

SKIP_

_LATEX

\item \ 

Classify the indeterminancy type of the following limits:

\par

i) $\displaystyle\lim_{x\rightarrow \infty }\,\frac{-1\,x + 3}{-1 + 3\,x}$

\begin{tabular}[t]{lllll}

\ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $\frac{\infty }{-\infty }$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $0/0$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $0^0$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $\infty ^\infty $ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $\infty /\infty $\\

 & & & &\\

\end{tabular}

\par

ii) $\displaystyle\lim_{x\rightarrow \infty }\,\frac{x^{2} - 4}{x - 2}$

\begin{tabular}[t]{lllll}

\ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $\frac{\infty }{-\infty }$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $0/0$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $0^0$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $\infty ^\infty $ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $\infty /\infty $\\

 & & & &\\

\end{tabular}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm} $1$ \\

$\diamond$\hspace{2mm} $2$ \\

\end{tabular}

_YEK

tr and special symbols

There is a large vocabulary of special  math symbols in both latex and ascimath.  tr will process many of these as latex or html depending on whether LATEX_ = yes.  The vocabulary will be enlarged as time permits.

The help is

>   

>   

>    prob:=proc()
global LATEX_:
 local a,b,alts;
  paramvals([args],[[a,[3,4,5]],[b,[-9,-11,-7]]]);
  alts:=[tr(infinity,"/-",infinity),tr(0,"/",0),tr(0,"^",0),tr(infinity,"^",infinity)];
alts:=[tr(infinity,"/-",infinity),tr(0,"/",0),tr(0,"^",0),tr(infinity,"^",infinity)];
  ragit("Classify the indeterminancy type of the following limits:",brak(),
 "i) ",Lim((a*x+b)/(a+b*x),x=infinity),as_(alts),brak(),
 "ii) ",Lim((x^2-4)/(x-2),x=infinity),as_(alts,Rightone=2));
LATEX_:=yes:
alts:=[tr("\\frac{",infinity,"}{-",infinity,"}"),tr(0,"/",0),tr(0,"^",0),tr(infinity,"^",infinity)];
ragit("Classify the indeterminancy type of the following limits:",brak(),
 "i) ",Lim((a*x+b)/(a+b*x),x=infinity),as_(alts),brak(),
 "ii) ",Lim((x^2-4)/(x-2),x=infinity),as_(alts,Rightone=2));
LATEX_:=no:
NULL
 end:

>    prob(1);

current inputs are  (1,[5,-7])

QM_[.05;`\infty /-\infty `;`0/0`]

AH_[0]

Classify the indeterminancy type of the following limits:

_brk_

i) `lim_(x to \infty )\ (-5\ x + 7)/(-5 + 7\ x)`

AS_[`\infty /-\infty `;`0/0`;`0^0`;`\infty ^\infty `]

AH_[0]

_brk_

ii) `lim_(x to \infty )\ (x^(2) - 4)/(x - 2)`

AS_[`\infty /-\infty `;`0/0`;`0^0`;`\infty ^\infty `]

SKIP_

_LATEX

\item \ 

Classify the indeterminancy type of the following limits:

\par

i) $\displaystyle\lim_{x\rightarrow \infty }\,\frac{-5\,x + 7}{-5 + 7\,x}$

\begin{tabular}[t]{llll}

\ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $\frac{\infty }{-\infty }$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $0/0$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $0^0$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $\infty ^\infty $\\

 & & &\\

\end{tabular}

\par

ii) $\displaystyle\lim_{x\rightarrow \infty }\,\frac{x^{2} - 4}{x - 2}$

\begin{tabular}[t]{llll}

\ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $\frac{\infty }{-\infty }$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $0/0$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $0^0$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ $\infty ^\infty $\\

 & & &\\

\end{tabular}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm} $1$ \\

$\diamond$\hspace{2mm} $2$ \\

\end{tabular}

_YEK

>   

>    tr(Help);

tr(a1,a2,...) returns a  string formatted either with $ (if LATEX_=yes) or `.  The ai's can be regular expressions, strings, or the terms leq,lt,geq,gt,neq,xx,`-:`,cup,cap,sub,elt,`-=`,pm,int,oint,del,grad, infty,empty,aleph,angle,cdots,cdot,tri,perp.

Here are some sample problems:

>    prob:=proc()
  global LATEX_;
  local a,b,c,ans,A,B;
  paramvals([args],[[a,[{1,2,3},{4,5,7},{1,4,9}]],[b,[{6,10,3},{14,5,17},{21,4,9}]],[c,[2,3,4]]]);
  ragit("Given ",A=a,", ",B=b,".",brak(),
"a)  How many members in ",tr(A, cup, B),"? Answer:",ac_(nops(a union b)),brak(),
"b)  How many members in ",tr(A, cap, B),"? Answer:",ac_(nops(a intersect b)),brak(),
"c)  How many members in ",tr(A, xx, B),"? Answer:",ac_(nops(a)*nops( b)));
LATEX_:=yes:
  ragit("Given ",A=a,", ",B=b,".",brak(),
"a)  How many members in ",tr(A, cup, B),"? Answer:",ac_(nops(a union b)),brak(),
"b)  How many members in ",tr(A, cap, B),"? Answer:",ac_(nops(a intersect b)),brak(),
"c)  How many members in ",tr(A, xx, B),"? Answer:",ac_(nops(a)*nops( b)));
LATEX_:=no:
 NULL:
  end:

>    prob(1);

current inputs are  (1,[{1, 2, 3},{5, 14, 17},4])

QM_[.05;6;0;9]

AH_[0]

Given `A = {1,2,3}`, `B = {5,14,17}`.

_brk_

a)  How many members in `A uu B`? Answer:

AC_[15]

AH_[0]

_brk_

b)  How many members in `A nn B`? Answer:

AC_[15]

AH_[0]

_brk_

c)  How many members in `A xx B`? Answer:

AC_[15]

SKIP_

_LATEX

\item \ 

Given $A = \{1,2,3\}$, $B = \{5,14,17\}$.

\par

a)  How many members in $A\cup B$? Answer:

\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}

\par

b)  How many members in $A\cap B$? Answer:

\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}

\par

c)  How many members in $A \times B$? Answer:

\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm}$6$\\

$\diamond$\hspace{2mm}$0$\\

$\diamond$\hspace{2mm}$9$\\

\end{tabular}

_YEK

>    prob:=proc()
  global LATEX_;
  local a,b,c,ans,A,B;
  paramvals([args],[[a,[{1,2,3,4},{4,5,7,11},{1,4,9,10}]],[b,[{6,10,3},{14,5,17},{21,4,9}]],[c,[2,3,4]]]);
  ragit("Given ",A=a,", ",B=b union a,".",brak(),
"a)  Is ",tr(A, sub, B),"? Answer:",as_([yes,no]),brak(),
"b)  Is ",tr(c,elt,A),"?  Answer:",as_([member(c,a),not member(c,a)]),brak(),
"c)  How many members in ",tr("(",A, xx, B,")",cup,"(",B, xx,A,")"),"? Answer:",ac_(2*nops(a)*nops( b)));
LATEX_:=yes:
  ragit("Given ",A=a,", ",B=b,".",brak(),
"a)  Is ",tr(A, sub, B),"? Answer:",as_([yes,no]),brak(),
"b)  Is ",tr(c,elt,A),"?  Answer:",as_([member(c,a),not member(c,a)]),brak(),
"c)  How many members in ",tr("(",A, xx, B,")",cup,"(",B, xx,A,")"),"? Answer:",ac_(2*nops(a)*nops( b)));
LATEX_:=no:
 NULL:
  end:

>   

>    prob(1);

current inputs are  (1,[{4, 5, 7, 11},{5, 14, 17},3])

QM_[.05;yes;false;24]

AH_[0]

Given `A = {4,5,7,11}`, `B = {4,5,7,11,14,17}`.

_brk_

a)  Is `A sub B`? Answer:

AS_[yes;no]

AH_[0]

_brk_

b)  Is `3 in A`?  Answer:

AS_[false;true]

AH_[0]

_brk_

c)  How many members in `(A xx B) uu (B xx A)`? Answer:

AC_[15]

SKIP_

_LATEX

\item \ 

Given $A = \{4,5,7,11\}$, $B = \{5,14,17\}$.

\par

a)  Is $A\subset B$? Answer:

\begin{tabular}{ll}

\ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ ${\it yes}$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ ${\it no}$\\

 &\\

\end{tabular}

\par

b)  Is $3\in A$?  Answer:

\begin{tabular}{ll}

\ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ ${\it false}$ & \ \fbox{\parbox[c][.1in][c]{.1in}{\hfill}}\ ${\it true}$\\

 &\\

\end{tabular}

\par

c)  How many members in $(A \times B)\cup (B \times A)$? Answer:

\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm} $1$ \\

$\diamond$\hspace{2mm} $1$ \\

$\diamond$\hspace{2mm}$24$\\

\end{tabular}

_YEK

>    prob:=proc()
  global LATEX_;
  local a,b,c,ans,A,B,x;
  paramvals([args],[[a,[12,14,16]],[b,[3,4,5]],[c,[2,3,4]]]);
  ragit("From the given information about the arithmetic sequence ",tr(x[1],",",x[2],",",x[3],cdots,x[n],cdots),", find its ",n^th," term.",brak(),
"a)  ",x[1]=a,", ",x[2]=a+b,".  ",tr(x[n]," = "),ae_(a+(n-1)*b),brak(),
"b)  ",x[4]=a,", ",x[6]=a+b,".  ",tr(x[n]," = "),ae_(a-3/2*b+(n-1)/2*b),brak(),
"c)  For some fixed positive integer ",A,", ",x[A]=a,", ",x[A+1]=a+b,".  ",tr(x[n]," = "),ae_(a-(A-1)*b+(n-1)*b)):
LATEX_:=yes:
 ragit("From the given information about the arithmetic sequence ",tr(x[1],",",x[2],",",x[3],cdots,x[n],cdots),", find its ",n^th," term.",brak(),
"a)  ",x[1]=a,", ",x[2]=a+b,".  ",tr(x[n]," = "),ae_(a+(n-1)*b),brak(),
"b)  ",x[4]=a,", ",x[6]=a+b,".  ",tr(x[n]," = "),ae_(a-3/2*b+(n-1)/2*b),brak(),
"c)  For some fixed positive integer ",A,", ",x[A]=a,", ",x[A+1]=a+b,".  ",tr(x[n]," = "),ae_(a-(A-1)*b+(n-1)*b)):
LATEX_:=no:
 NULL:
  end:

>    prob(1);

current inputs are  (1,[12,4,4])

QM_[.05;8+4*n;4+2*n;12-4*A+4*n]

AH_[0]

From the given information about the arithmetic sequence `x_(1),x_(2),x_(3) cdots x_(n) cdots `, find its `n^(th)` term.

_brk_

a)  `x_(1) = 12`, `x_(2) = 16`.  `x_(n) = `

AF_[15;n;6;.1;1]

AH_[0]

_brk_

b)  `x_(4) = 12`, `x_(6) = 16`.  `x_(n) = `

AF_[15;n;6;.1;1]

AH_[0]

_brk_

c)  For some fixed positive integer `A`, `x_(A) = 12`, `x_(A+1) = 16`.  `x_(n) = `

AE_[15;2;A;n;25;.1;1;.1;1]

SKIP_

_LATEX

\item \ 

From the given information about the arithmetic sequence $x_{1},x_{2},x_{3}\cdots x_{n}\cdots $, find its $n^{{\it th}}$ term.

\par

a)  $x_{1} = 12$, $x_{2} = 16$.  $x_{n} = $

\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}

\par

b)  $x_{4} = 12$, $x_{6} = 16$.  $x_{n} = $

\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}

\par

c)  For some fixed positive integer $A$, $x_{A} = 12$, $x_{A+1} = 16$.  $x_{n} = $

\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm}$8 + 4\,n$\\

$\diamond$\hspace{2mm}$4 + 2\,n$\\

$\diamond$\hspace{2mm}$12 - 4\,A + 4\,n$\\

\end{tabular}

_YEK

>    prob:=proc()
  global LATEX_;
  local a,b,c;
  paramvals([args],[[a,[seq(10*i,i=1..5)]],[b,[seq(10*i+rand(2..6)(),i=1..5)]],[c,[4,6,8,3,5]]]);
  ragit("Calculate:",tr("(",a,`-:`,b,")+(",c,`-:`,a,") = "),ac_(a/b+c/a)):
  LATEX_:=yes:
  ragit("Calculate:",tr("(",a,`-:`,b,")+(",c,`-:`,a,") = "),ac_(a/b+c/a)):
  LATEX_:=no:
  NULL:
  end:

>    prob(1);

current inputs are  (1,[40,35,6])

QM_[.05;181/140]

AH_[0]

Calculate:`(40 -: 35)+(6 -: 40) = `

AC_[15]

SKIP_

_LATEX

\item \ 

Calculate:$(40 \div 35)+(6 \div 40) = $

\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm}$\frac{181}{140}$\\

\end{tabular}

_YEK

>    prob:=proc()
  global LATEX_;
  local a,b,c,x,y;
  paramvals([args],[[a,[seq(10*i,i=1..5)]],[b,[seq(10*i+rand(2..6)(),i=1..5)]],[c,[4,6,8,3,5]]]);
  ragit("Calculate:",tr("(",a,cdot,b,")+(",c,`-:`,x,") = "),af_(a*b+c/x)):
  LATEX_:=yes:
  ragit("Calculate:",tr("(",a,cdot,b,")+(",c,`-:`,x,") = "),af_(a*b+c/x)):
  LATEX_:=no:
  NULL:
  end:

>    prob(1);

current inputs are  (1,[30,13,8])

QM_[.05;390+8/x]

AH_[0]

Calculate:`(30 * 13)+(8 -: x) = `

AF_[15;x;6;.1;1]

SKIP_

_LATEX

\item \ 

Calculate:$(30\cdot 13)+(8 \div x) = $

\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm}$\frac{390\,x + 8}{x}$\\

\end{tabular}

_YEK

>    prob:=proc()
  global LATEX_;
  local a,b,c,x,y;
  paramvals([args],[[a,[seq(10*i,i=1..5)]],[b,[seq(10*i+rand(2..6)(),i=1..5)]],[c,[4,6,8,3,5]]]);
  ragit("a) Calculate: ",Lim(x^2/b+c,x=a),ac_(a^2/b+c),brak(),
 "b) Calculate: ",Pdiff(x^3*sin(y*z)+y^4*x+ln(z),x^2,y)," Answer: ",ae_(diff(x^3*sin(y*z)+y^4*x+ln(z),x,x,y))):
  LATEX_:=yes:
  ragit("a) Calculate: ",Lim((1/b*x^2+c),x=a),ac_(a^2/b+c),brak(),
 "b) Calculate: ",Pdiff(x^3*sin(y*z)+y^4*x+ln(z),x^2,y)," Answer: ",ae_(diff(x^3*sin(y*z)+y^4*x+ln(z),x,x,y))):
  LATEX_:=no:
  NULL:
  end:

>    prob(1);

current inputs are  (1,[40,34,6])

QM_[.05;902/17;6*x*cos(y*z)*z]

AH_[0]

a) Calculate: `lim_(x to 40)\ (1)/(34)\ x^(2) + 6`

AC_[15]

AH_[0]

_brk_

b) Calculate: `\frac{del^(3)}{ del x^(2) del y}\ (x^(3)\ text(sin)(y\ z) + y^(4)\ x + text(ln)(z))` Answer: 

AE_[15;3;x;y;z;25;.1;1;.1;1;.1;1]

SKIP_

_LATEX

\item \ 

a) Calculate: $\displaystyle\lim_{x\rightarrow 40}\,\frac{1}{34}\,x^{2} + 6$

\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}

\par

b) Calculate: $\frac{\partial^{3}}{\partial x^{2}\partial y}\ (x^{3}\,\sin(y\,z) + y^{4}\,x + \ln(z))$ Answer: 

\ \fbox{\parbox[c][.4in][c]{1in}{\hfill}}

\vspace{12pt}

_XETAL

_KEY

\begin{tabular}[t]{l}

$\diamond$\hspace{2mm}$\frac{902}{17}$\\

$\diamond$\hspace{2mm}$6\,x\,\cos(y\,z)\,z$\\

\end{tabular}

_YEK

>   

>   

>   

>    currentdir();

After we get the problems  that we want, we will export to html and then create homework zipfile using the following zipit line.

>   

>    zipit("addpicandragit","c:/tmp/addpicandragit");

version 4/2/2009

Tue 04/07/2009 

10:23 PM

Have you saved the source worksheet lately?

Files in c:\tmp\addpicandragit will go in homework zipfile.

Have you saved the source worksheet lately?

You are using zipit with the option Mathml=yes.  You should put

   a note at the top of the homework that IE6 and the Mathplayer plugin 

   (or special fonts for Mozilla) are needed to view the homework.

A zipfile addpicandragitkde.zip has been created in c:/tmp. 

      Now install the homework via mathclass

>   

When we export the file to tex, we can use latexit to make a hardcopy mirror of the file, as shown below.

>    latexit("addpicandragit","c://tmp/addpicandragit");

index words duplicated

addpicandragitwhs.tex created

addpicandragitwhs.dvi created.

fixed eps files (removed their borders and recolored if Color=yes is set)

addpicandragitwhs.ps created sucessfully.

finished

But actually if we want a hardcopy version of the homework problems, we can use makexam as shown below.

>    currentdir();

>   

>   

>    makexam("addpicandragit","c:/tmp/addpicandragit",
Version=[[1],[seq(i,i=1..40)],[seq(i,i=1..40)]],
Cover=cat("\\textbf{\\Large Math Test with pictures}\\hfill Jan 31, 2009 \\hfill \\textbf{Name:}\\rule[-.01in]{1in}{.01in}\\\\\\bigskip"),
Spacing=[seq(vf,i=1..40)],
ExtraPreamble=cat("\\raggedright\n\\textheight=9.3in\\topmargin=-.5in"));;

 The addpicandragit eps files are already recolorized.

addpicandragitv1_la.tex created: 36 problems

index words duplicated

addpicandragitv1_lawhs.tex created

addpicandragitv1_lawhs.dvi created.

fixed eps files (removed their borders and recolored if Color=yes is set)

addpicandragitv1_lawhs.ps created sucessfully.

finished

>   

>   

>