day3.mws
- MCtools: Aug 27, 2001
- MCtools: code with examples
- MCtools[mcprint](expression sequence)
(prints sequence with substitution)
mcprint: takes an expression sequence consisting of strings and expressions: converts each of the non-strings to a string, conactenates the result and prints it as a single string left justified: mcprint is used primarily to encapsulate the text of a problem as a procedure. mctools() returns a line with one space (" ")
- MCtools[PARAMS](Defaults,Args)
PARAMS is used in order to make arguments of procedures be a sequence of equations of the form "parameter1=value1,parameter2=value2, ..." It expects a list of default settings and compares these to the ones specified in Args and returns a list with values specified in Args replacing those in defaults.
- MCtools[PT](location,txt,fontsize=16,clr=black)
(places txt at [a,b] in given size and color) defaults as indicated in the argument string are used if not specified. "PT" is "put text"
- MCtools[colors] (showthem=`no`)
- MCtools[DL](A,B,thknss=2, styl=1,clr=blue,leftshrinkfactor=0,rightshrinkfactor=0,hashnum=3,hashlength=.3,hashspacing=.1,hashlocation=.5)
Draws line from A to B options thkness (thickness), styl (style), clr (color),leftshrinkfactor,rightshrinkfactor. - defaults are hknss=2, styl=1,clr=blue,leftshrinkfactor=0,rightshrinkfactor=0,hashnum=0,hashlength=.3,hashlocation=.5,hashspacing=.1
The shrinkfactors are a fraction,lsf and rsf, between 0 and 1, The line is plotted from lsf*A+(1-lsf)*B to rsf*B+(1-rsf)*A. This is useful, for instance is making portions of piecewise defined graphs terminate with circles or bullets into which the graph does not extend.
hshnum is the number of hashmarks, hashlength is the length of each, hashlocation is the relative location of the center of the hashmarks, hashspacing is the distance between individual hashmarks.
- MCtools[GP] llcorner=[-5,-5], width=10, height=10, resolution=2, tickmarkfont=12, axescolor=red)
Places graph paper with lower left corner at specified point of specified width, heght, res (= resolution or number of vertical or horizontal divisions of the unit square), tickmarkfont, and axes color. Defaults are as indicated. Omitted parameters will take default value.
- MCtools[PP](location,radius, clr=blue,scalefactor=1)
places a "point" at "location". Radius, color, and scalefactor are options. Adjust the scalefactor to produce circular points even when the plot is not constrained. Best done trial and error - declare scalefactor at top of diagram so its the same in all points.
- MCtools[ARRW](tail=[0,0],head=[1,2],headwidth=3,headlength=4,shaftthickness=.03,clr=green,arrowtype=`DH`,doublearrowtxt="texthere",fontsize=16,txtclr=black,dhgap=1/3):
- MCtools[PC](center, radius=.1, thknss=2, styl=1, clr=black,scalefactor=1)
- MCtools[PA](center=,radius=.1,theta1=0,theta2=Pi/2, thknss=3, styl=1, clr=black,scalefactor=1)
- MCtools[roundto](x,places=3)
converts floating point to "places" decimal places. Used primarily for specifying reasonable floating point estimates for multiple choice floating point answers.
- MCtools[hashang](A,B,C,radius=1,numhashes=3,hashspacing=.1,withhead=`NO`,headthickness=1,headlength=1,clr=black,reversehead=`NO`,otherway=`NO`,fliphead=`NO`)
makes arcs of an angle ABC at given radius from vertex B. Numhashes is number of arcs, hashspacing is fraction of a radius between successive arcs . If "withhead" is anything but `NO` then an arrowhead is constructed at the "C" end of the arc.
headthickness is a measure of the thickness of the arrowhead, headlength is a measure of its length.
withhead determines whether the result is a circular arrow. The default is one going from A to C.
headthickness is an integer proportional to the width of the arrowhead while headlength has the analogous relationship to the length of the head.
If otherway = `YES` the arc traverses the 2*Pi -complementary angle.
reversehead = `YES` puts the head at the other end and fliphead = `YES` re-orients the head.
- RANDANS(ANSWERS,rightans=1,choices=letters,answerstyle=mulchoice_labeled)
ANSWERS is a required list of the possible answers
choices is the list of lables for the answers. The default is letters=["A", ...,"M"]
rightans is the position of the last correct answer in the ANSWERS list. The routine assumes that the ANSWER[1] ... ANSWER[rightans] are all correct. This is for the AB answer format
ansform is the answer format which can be either of the single-answer, multiple choice formats "AL" or "AR", or the checkbox format "AB".
The default is AL format with the correct answer in the first position of the ANSWERS list and choices the inital segment of the letters list (up to 13).
answerstyle is the answer format. The current forms are:
mulchoice_labeled - this is the default. It expects a list of possible answers with the first the correct one and a list of choices (labels) to represent the answers. By default the labels will be an inital sublist of ["A", ...,"M"] of length the length of the ANSWERS list.
checkbox - expects a list of answers and a "rightans" value. The default rightans value is 1.
listbox - expects a list of answers with the first the one correct choice
RNDANS returns a list whose entries are strings:
The first list element is the correct argument to the "QM_[* ]" problem declaration for the given style (here * is the accuracy),
the second list element is the argument to the answer tag for the given style, and
the third (only in the case of the default, standard multiple choice) is the string relating choices (labels) with possible answers.
- MCtools[spreadsheetanswer](txtboxsize=4, answerstyle=AC,ansmat=matrix([[x,x^2],[1,1],[2,4],[10,100],[-3,9],[`.01`,`.0001`]]), incidmat=matrix([[1,1],[1,0],[1,0],[0,1],[0,1],[0,1]])
This procedure is to be used if you want to use a spreadsheet to generate a table to be completed as the answer to a question. spreadsheetanswer returns a list of two elements:
The parameters, all optional, are
problem: a list of expressions which can be fed to MCtools[mcprint]
answermatrix: A matrix which has complete table stored in it.
incidencematrix: A matrix of 0's and 1's the same size as ansmat The entries of ansmat are printed in the table if the corresponding entry in incidmat is 1, not printed if the entry in incidmat is 0.
NOTE: floating point numbers in ansmat and incidmat must be enclosed in backquotes.
txtboxsize: the number of characters in the answer box.
answerstyle: the answer format. Choices are AC (character), AF (function), AS (selection), and AI (integral)
spreadsheetans returns a list with two entries. The first entry is a matrix in which the elements of the answermatrix corresponding to ones in the incidencematric have been replaced by AC_[textboxsize] tags. The second entry is the answerstring corresponding which should be added to the argument string for the QM_tag (after the accuracy) in the position corresponding to the "AT-tag" among the answer tags for the problem.
The command MCtools[printspreadsheet] can be used to display the spreadsheet. See the examples below:
- mctools(X) returns syntax and defaults for tool "X". mctools() returns list of tools.
- To load MCtools version Aug 27, 2001, execute this section
- diagram and calculations
- diagram
- diagram
|