File:  [LON-CAPA] / doc / homework / homework5.html
Revision 1.16: download - view: text, annotated - select for diffs
Thu Jun 6 08:24:55 2002 UTC (21 years, 10 months ago) by albertel
Branches: MAIN
CVS tags: HEAD
- forgot about <parameter>

    1: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    2: <html>
    3:   <head>
    4:     <title>LON-CAPA Homework System</title>
    5:   </head>
    6: 
    7:   <body bgcolor="white">
    8:     <h1>LON-CAPA Homework System</h1>
    9: 
   10:     <h2>Tags</h2>
   11:     <ul>
   12:       <li>
   13: 	Response tags
   14: 	<p>
   15: 	  Arguments for all response tags
   16: 	</p>
   17: 	<ul>
   18: 	  <li>
   19: 	    <i>ID</i>, if this isn't set it will be set during
   20: 	    the publication step. It is used to assign parameters names
   21: 	    in a way that can be tracked if an instructor modifies
   22: 	    things by hand.
   23: 	  </li>
   24: 	  <li>
   25: 	    <i>name</i> optional, if set, it will be used by the
   26: 	    resource assembly tool when one is modifying parameters.
   27: 	    </li>
   28: 	</ul>
   29: 	<p>
   30: 	  Implemented response tags
   31: 	</p>
   32: 	<ul>
   33: 	  <li>
   34: 	    <b>&lt;responseparam&gt;</b> if it appears it should be
   35: 	    inside of a &lt;*response&gt; tag, defines an externally
   36: 	    adjustable parameter for this question. Arguments:
   37: 	    <ul>
   38: 	      <li>
   39: 		<i>default</i> required, specifies a default value for
   40: 		the parameter
   41: 	      </li>
   42: 	      <li>
   43: 		<i>name</i> required, specifies an internal name for
   44: 		the parameter
   45: 	      </li>
   46: 	      <li>
   47: 		<i>type</i> required specifies the type of parameter,
   48: 		one of "tolerance", "int", "float", "string", "date"
   49: 		(configuration of paramters is handled by
   50: 		lonparmset.pm and parameter.html)
   51: 	      </li>
   52: 	      <li>
   53: 		<i>description</i> a string describing the parameter,
   54: 		this is what is used to talk about a parameter outside
   55: 		of a problem
   56: 	      </li>
   57: 	    </ul>
   58: 	  </li>
   59: 	  <li>
   60: 	    <b>&lt;parameter&gt;</b> exactly the same as
   61: 	    &lt;responseparam&gt; currently, but should not appear
   62: 	    inside of a &lt;*response&gt;
   63: 	  </li>
   64: 	  <li>
   65: 	    <b>&lt;numericalresponse&gt;</b> implements a numerical
   66: 	    answer, it needs an internal <b>&lt;textline&gt;</b> for
   67: 	    the response to go in. It checks all styles of numerical
   68: 	    supported in CAPA. Possible args are:
   69: 	    <ul>
   70: 	      <li><i>answer</i> required, specifies the correct answer, may be either a perl list or scalar</li>
   71: 	      <li><i>units</i> optional, specifies unit of correct answer, CAPA style</li>
   72: 	    </ul>
   73: 	  </li>
   74: 	  <li>
   75: 	    <b>&lt;stringresponse&gt;</b> implements a string answer,
   76: 	    it needs an internal <b>&lt;textline&gt;</b> for the
   77: 	    response to go in. It can check the string for either case
   78: 	    or order.
   79: 	    <ul>
   80: 	      <li><i>answer</i> required, specifies the correct answer, may be either a perl list or scalar</li>
   81: 	      <li><i>type</i> optional, CAPA style str args, cs/ci/mc
   82: 		<ul>
   83: 		  <li>cs - case senesitive, order important</li>
   84: 		  <li>ci - case insenesitive, order important</li>
   85: 		  <li>mc - case insenesitive, order unimportant</li>
   86: 		</ul>
   87: 	      </li>
   88: 	    </ul>
   89: 	  <li>
   90: 	    <b>&lt;essayresponse&gt;</b> implements a ungraded large
   91: 	    text response, it need an internal <b>&lt;textarea&gt;</b>
   92: 	    for the response to go in.
   93: 	  </li>
   94: 	  <li>
   95: 	    <b>&lt;imageresponse&gt;</b> implements a image click
   96: 	    style image submission, uses the foil structure tags <a
   97: 	    href="#foil">below</a>. Additional tags that should appear
   98: 	    in a &lt;foil&gt; are:
   99: 	    <ul>
  100: 	      <li><b>&lt;image&gt;</b> required, the contained text
  101: 	      specifies a published graphical resource that is the
  102: 	      image used, should only appear once per foil</li>
  103: 	      <li><b>&lt;rectangle&gt;</b> required, the contained text
  104: 	      specifies a rectangular area that is correct, should
  105: 	      look like (1,2)-(3,4), at least 1 required</li>
  106: 	      <li><b>&lt;text&gt;</b> required, the contained text is
  107: 	      printed on top of the image.</li>
  108: 	    </ul>
  109: 	  </li>
  110: 	  <li>
  111: 	    <b>&lt;optionresponse&gt;</b> implements a "select from
  112: 	    these choices" style question, the choices are specified
  113: 	    by the instructor, it uses the foil structure tags <a
  114: 	    href="#foil">below</a> with this additional args: 
  115: 	    <ul>
  116: 	      <li>
  117: 		<b>&lt;foilgroup&gt;</b> is required to have
  118: 		<i>options</i> which should be a perl list of possible
  119: 		options for the student.
  120: 	      </li>
  121: 	    </ul>
  122: 	  </li>
  123: 	  <li>
  124: 	    <b>&lt;radiobuttonresponse&gt;</b> implements a true / false
  125: 	    style question with 1 correct answer.it uses the foil
  126: 	    structure tags <a href="#foil">below</a> but the
  127: 	    <i>value</i> of a &lt;foil&gt;can only be "true" or
  128: 	    "false" or "unused"
  129: 	  </li>
  130: 	  <li>
  131: 	    <b>&lt;dataresponse&gt;</b> implements a straight data
  132: 	    storage entry idea, needs and interveing input tag like
  133: 	    &lt;textline&gt; to work correctly.<br>
  134: 	    Arguments:
  135: 	    <ul>
  136: 	      <li>
  137: 		<i>name</i> internal name for the value, it will have
  138: 		the part id and respose id added on to it
  139: 	      </li>
  140: 	      <li>
  141: 		<i>type</i> type of data stored in this response
  142: 		field, should be one of the types supported by
  143: 		parameter.html
  144: 	      </li> 
  145: 	      <li>
  146: 		<i>display</i> a string that will be used to describe
  147: 		the field when interfacing with humans
  148: 	      </li>
  149: 	    </ul>
  150: 	  </li>
  151: 	  <li>
  152: 	    <p>
  153: 	      <b>&lt;externalresponse&gt;</b> implements the ability to have
  154: 	      an external program grade a response, expects either a
  155: 	      &lt;textline&gt; or &lt;textfield&gt; inside the tag. <br />
  156: 	    </p>
  157: 	    Arguments:
  158: 	    <ul>
  159: 	      <li>
  160: 		<i>url</i> the url to submit the answer and form to,
  161: 		does not need to be a LON-CAPA machine.
  162: 	      </li>
  163: 	      <li>
  164: 		<i>answer</i> a string or scalar variable that can
  165: 		encode something that should encode the correct
  166: 		answer, in some cases this may be nothing.
  167: 	      </li>
  168: 	      <li>
  169: 		<i>form</i> a hash variable name that will be
  170: 		submitted to the remote site as a HTTP form.
  171: 	      </li>
  172: 	    </ul>
  173: 	    <p>
  174: 	      The response of the remote server needs to be in XML as follows.
  175: 	    </p>
  176: 	    <pre>
  177: &lt;loncapagrade&gt;
  178:     &lt;awardetail&gt;
  179: CORRECT
  180:     &lt;/awardetail&gt;
  181:     &lt;message&gt;
  182: A message to be shown to the students
  183:     &lt;/message&gt;
  184: &lt;/loncapagrade&gt;
  185: 	    </pre>
  186: 	    <ul>
  187: 	      <li>
  188: 		<b>&lt;loncapagrade&gt;</b> no arguments but must
  189: 		surround the response.
  190: 	      </li>
  191: 	      <li>
  192: 		<b>&lt;awardetail&gt;</b> required inner tag, the
  193: 		response inside must be one of the detailed responses
  194: 		that appears in the data storage documentation
  195: 		(CVS:loncapa/doce/homework/datastorage)
  196: 	      </li>
  197: 	      <li>
  198: 		<b>&lt;message&gt;</b> optional message to have shown
  199: 		to the student
  200: 	      </li>
  201: 	    </ul>
  202: 	  </li>
  203: 	</ul>
  204: 	<li>
  205: 	<a name="foil">Foil Structure Tags</a>
  206: 	<p>
  207: 	  All tags that implement a foil structure have an optional
  208: 	  arg of <i>max</i> that controls the maximum number of total
  209: 	  foils to show.
  210: 	</p>
  211: 	<ul>
  212: 	  <li>
  213: 	    <b>&lt;foilgroup&gt;</b> required, must be the tag that
  214: 	    surrounds all foil definitions	    
  215: 	  </li>
  216: 	  <li>
  217: 	    <b>&lt;foil&gt;</b> required, all data inside is a possible foil
  218: 	  </li>
  219: 	  <li>
  220: 	    <b>&lt;conceptgroup&gt;</b> optional, surrounds a
  221: 	    collection of &lt;foil&gt;, when a problem is displayed
  222: 	    only one of the contained &lt;foil&gt;is selected for
  223: 	    display. It receives one required argument
  224: 	    <i>concept</i>.
  225: 	  </li>
  226: 	</ul>
  227:       </li>
  228:       <li>
  229: 	Hint structure
  230: 	<p>
  231: 	  All of these tags must appear inside a <b>&lt;*response&gt;</b> tag.
  232: 	</p>
  233: 	<ul>
  234: 	  <li>
  235: 	    <b>&lt;hintgroup&gt;</b> Tag that surrounds all of a hint.
  236: 	  </li>
  237: 	  <li>
  238: 	    <b>&lt;hintpart&gt;</b> required, Tag to implement
  239: 	    conditional hints. It has a required argument
  240: 	    <i>on</i>. When a &lt;*hint&gt; tag named the same as the
  241: 	    value the </i>on</i> attribute evaluates to be correct the
  242: 	    &lt;hintpart&gt; will show. If no other &lt;hintpart&gt;
  243: 	    are to show then all hintparts with a <i>on</i> of
  244: 	    "default" will show
  245: 	  </li>
  246: 	  <li>
  247: 	    <b>&lt;numericalhint&gt;</b> has all the arguments that
  248: 	    &lt;numericalresponse&gt;, does and the required attribute
  249: 	    <i>name</i> which should be set to the value of which
  250: 	    &lt;hintpart&gt; will be shown. 
  251: 	  </li>
  252: 	</ul>
  253:       </li>
  254:       <li>
  255: 	Input Tags
  256: 	<p>
  257: 	  This group of tags implement a mechanism for getting data
  258: 	  for students, they will usually be used by a
  259: 	  &lt;*response&gt;.
  260: 	</p>
  261: 	<ul>
  262: 	  <li>
  263: 	    <b>&lt;textarea&gt;</b> creates a Large text input box, If
  264: 	    data appears between the start and end tags, the data will
  265: 	    appear i the textarea if the student has not yet made a
  266: 	    submission. Additionally it takes two arguments <i>rows</i>
  267: 	    and <i>cols</i> which control the height and width of the
  268: 	    area respectively. It defaults to 10 and 80.
  269: 	  </li>
  270: 	  <li>
  271: 	    <b>&lt;textline&gt;</b> creates a single line of input
  272: 	    element, it accepts 1 argument <i>size</i> which controls
  273: 	    the width on the textline, it defaults to 20.
  274: 	  </li>
  275: 	</ul>
  276:       </li>
  277:       <li>
  278: 	Output Tags
  279: 	<p>
  280: 	  This group of tags generate useful pieces of output.
  281: 	</p>
  282: 	<ul>
  283: 	  <li>
  284: 	    <b>&lt;standalone&gt;</b> everything in between the start
  285: 	    and end tag is shown only on the web, and only if the
  286: 	    resource is not part of a course.
  287: 	  </li>
  288: 	  <li>
  289: 	    <b>&lt;displayduedate&gt;</b> this will insert the current
  290: 	    duedate if one is set into the document. It is generated
  291: 	    to be inside a table of 1x1 elements
  292: 	  </li>
  293: 	  <li>
  294: 	    <b>&lt;displaytitle&gt;</b> this will insert the title of
  295: 	    the problem from the metadata of the problem
  296: 	  </li>
  297: 	  <li>
  298: 	    <b>&lt;window&gt;</b> the text in between is put in a
  299: 	    popup javascript window
  300: 	  </li>
  301: 	  <li>
  302: 	    <b>&lt;m&gt;</b> the inside text is LaTeX, and is
  303: 	    converted to HTML (or MathML) on the fly, if the argument
  304: 	    <i>eval</i> is set to "on" the intervening text will have
  305: 	    a perl var expansion done to it before being converted.
  306: 	  </li>
  307: 	  <li>
  308: 	    <b>&lt;randomlabel&gt;</b> shows a specified image with
  309: 	    images or text labels randomly assigned to a set of
  310: 	    specific locations, those locations may also have values
  311: 	    assigned to them. There is a hash generated conating the
  312: 	    mapping of labels to locations, labels to values, and
  313: 	    locations to values. Example:
  314: 	    <pre>
  315:  &lt;randomlabel bgimg=&quot;URL&quot; width=&quot;12&quot; height=&quot;45&quot; texwidth=&quot;50&quot;&gt;
  316:     &lt;labelgroup name=&quot;GroupOne&quot; type=&quot;image&quot;&gt;
  317:       &lt;location x=&quot;123&quot; y=&quot;456&quot; value=&quot;10&quot; /&gt;
  318:       &lt;location x=&quot;321&quot; y=&quot;654&quot; value=&quot;20&quot; /&gt;
  319:       &lt;location x=&quot;213&quot; y=&quot;546&quot; value=&quot;13&quot; /&gt;
  320:       &lt;label description=&quot;TEXT-1&quot;&gt;IMG-URL&lt;/label&gt;
  321:       &lt;label description=&quot;TEXT-2&quot;&gt;IMG-URL&lt;/label&gt;
  322:       &lt;label description=&quot;TEXT-3&quot;&gt;IMG-URL&lt;/label&gt;
  323:     &lt;/labelgroup&gt;
  324:     &lt;labelgroup name=&quot;GroupTwo&quot; type=&quot;text&quot;&gt;
  325:       &lt;location x=&quot;12&quot; y=&quot;45&quot; /&gt;
  326:       &lt;location x=&quot;32&quot; y=&quot;65&quot; /&gt;
  327:       &lt;location x=&quot;21&quot; y=&quot;54&quot; /&gt;
  328:       &lt;label&gt;TEXT-1&lt;/label&gt;
  329:       &lt;label&gt;TEXT-2&lt;/label&gt;
  330:       &lt;label&gt;TEXT-3&lt;/label&gt;
  331:     &lt;/labelgroup&gt;
  332:    &lt;/randomlabel&gt;
  333: 	    </pre>
  334: 	    Arguments:
  335: 	    <ul>
  336: 	      <li>
  337: 		<i>bgimg</i> either a fully qualified URL for an
  338: 		external image, or a loncapa resource, it supports
  339: 		relative references (../images/apicture.gif), the
  340: 		image must either be a GIF or JPEG
  341: 	      </li>
  342: 	      <li>
  343: 		<i>width</i> the width of the image in pixels
  344: 	      </li>
  345: 	      <li>
  346: 		<i>height</i> the height of the image in pixels
  347: 	      </li>
  348: 	      <li>
  349: 		<i>texwidth</i> the width of the image in millimeters
  350: 	      </li>
  351: 	    </ul>
  352: 	    Internal tags:
  353: 	    <ul>
  354: 	      <li>
  355: 		<b>&lt;labelgroup&gt;</b> 1 required, multiple
  356: 		allowed. Declares a group of locations and labels
  357: 		associated with them.  <br />Arguments:
  358: 		<ul>
  359: 		  <li>
  360: 		    <i>name</i> this is the name of the group, a hash
  361: 		    with this name will be generated holding the
  362: 		    mappings for later use in the problem. For each
  363: 		    location a value will be set for which label is
  364: 		    there, (EX. $hash{'1'}="TEXT-2"). For locations
  365: 		    with values the hash will contain 2 items, a
  366: 		    location to value mapping ($hash{'value_1'}=10),
  367: 		    and a label to value mapping
  368: 		    ($hash{'labelvalue_2'}=10). For all image style of
  369: 		    labels there will also be a label description to
  370: 		    label URL mapping ($hash{'image_2'}=IMG-URL). Also
  371: 		    the entry 'numlocations will be set to the total
  372: 		    number of locations that exist.
  373: 		    (Note that locations and labels start counting from 1.)
  374: 		  </li>
  375: 		  <li>
  376: 		    <i>type</i> the type of labels in this group,
  377: 		    either 'image' or 'text'
  378: 		  </li>
  379: 		</ul>
  380: 	      </li>
  381: 	      <li>
  382: 		<b>&lt;location&gt;</b> declares a location on the
  383: 		image that a label should appear at <br />Arguments:
  384: 		<ul>
  385: 		  <li>
  386: 		    <i>x</i> the x value of the location in pixels 
  387: 		  </li>
  388: 		  <li>
  389: 		    <i>y</i> the y value of the location in pixels 
  390: 		  </li>
  391: 		  <li>
  392: 		    <i>value</i> a scalar value to associate at this
  393: 		    location (optional)
  394: 		  </li>
  395: 		</ul>
  396: 	      </li>
  397: 	      <li>
  398: 		<b>&lt;label&gt;</b> declaration of a label, if this
  399: 		is a text type labelgroup the internal text should be
  400: 		the text of the label (HTML is not currently
  401: 		supported), if this is an image type of label the
  402: 		internal text must be a LON-CAPA resource
  403: 		specification, and the description filed must be set.
  404: 		<br />Arguments:
  405: 		<ul>
  406: 		  <li>
  407: 		    <i>description</i> a required field for image
  408: 		    labels, it will be used when setting values in the
  409: 		    hash.
  410: 		  </li>
  411: 		</ul>
  412: 	      </li>
  413: 	    </ul>
  414: 	  </li>
  415: 	</ul>
  416:       </li>
  417:       <li>
  418: 	Scripting
  419:       <p>
  420: 	These tags allow the document to behave programatically
  421:       </p>
  422:       <ul>
  423: 	<li>
  424: 	    <b>&lt;display&gt;</b> the intervening perl script is
  425: 	    evaluated in the safe space and the return value of the
  426: 	    script replaces the entire tag
  427: 	  </li>
  428: 	  <li>
  429: 	    <b>&lt;import&gt;</b> causes the parse to read in the file
  430: 	    named in the body of the tag and parse it as if the entire
  431: 	    text of the file had existed at location of the tag
  432: 	  </li>
  433: 	  <li>
  434: 	    <b>&lt;parserlib&gt;</b> the enclosed filename contains
  435: 	    definitions for new tags
  436: 	  </li>
  437: 	  <li>
  438: 	    <b>&lt;script&gt;</b> if the argument <i>type</i> is set
  439: 	    to "loncapa/perl" the enclosed data is a perl script which
  440: 	    is evaluated inside the perl Safe space. The return value
  441: 	    of the script is ignored.
  442: 	  </li>
  443: 	  <li>
  444: 	    <b>&lt;scriptlib&gt;</b> the enclosed filename contains
  445: 	    perl code to run in the safe space
  446: 	  </li>
  447: 	  <li>
  448: 	    <b>&lt;block&gt;</b> has a required argument
  449: 	    <i>condition</i> that is evaluated, it the condition is
  450: 	    true everything inside the tag is evaluated, if it is false
  451: 	    everything inside the block tag is skipped
  452: 	  </li>
  453: 	  <li>
  454: 	    <b>&lt;notsolved&gt;</b> everything inside the tag is
  455: 	    skipped if the problem is "solved"
  456: 	  </li>
  457: 	  <li>
  458: 	    <b>&lt;postanswerdate&gt;</b> everything inside the tag is
  459: 	    skipped if the problem is before the answer date
  460: 	  </li>
  461: 	  <li>
  462: 	    <b>&lt;preduedate&gt;</b> everything inside the tag is
  463: 	    skipped if the problem is after the due date
  464: 	  </li>
  465: 	  <li>
  466: 	    <b>&lt;randomlist&gt;</b> the enclosed tags are parsed in
  467: 	    a stable random order, optional argument <i>show</i>
  468: 	    restricts the number of tags indie that are actually
  469: 	    parsed the no more than <i>show</i>.
  470: 	  </li>
  471: 	  <li>
  472: 	    <b>&lt;solved&gt;</b> everything inside the tag is
  473: 	    skipped if the problem is "not solved"
  474: 	  </li>
  475: 	  <li>
  476: 	    <b>&lt;while&gt;</b> implements a while loop, required
  477: 	    argument <i>condition</i> is a perl scriptlet that when
  478: 	    evaluated results in a true or false value, on true the
  479: 	    entirety of the text between the whiles is parsed. The
  480: 	    condition is tested again, etc. If false it goes to the
  481: 	    next node in the parse.
  482: 	  </li>
  483: 	</ul>
  484:       </li>
  485:       <li>
  486: 	Structure Tags
  487: 	<p>
  488: 	  These tags give the problem a structure and take care of the
  489: 	  recording of data and giving the student messages.
  490: 	</p>
  491: 	<ul>
  492: 	  <li>
  493: 	    <b>&lt;problem&gt;</b> must be the first tag in the file,
  494: 	    this tag sets up the header of the webpage and generates
  495: 	    the submit buttons, it also handles due dates properly
  496: 	  </li>
  497: 	  <li>
  498: 	    <b>&lt;part&gt;</b> must be below &lt;problem&gt; if it is
  499: 	    going to be used. It does many of the same tasks as
  500: 	    &lt;problem&gt; but allows multiple separate problems to
  501: 	    exist in a single file.
  502: 	  </li>
  503: 	  <li>
  504: 	    <b>&lt;startouttext&gt;</b><b>&lt;endouttext&gt;</b> these
  505: 	    tags are somewhat special, they must have no internal text
  506: 	    and occur in pairs. Their use is to mark up the problem so
  507: 	    the web editor knows what sections should be edited in a
  508: 	    plain text block on the web.
  509: 	  </li>
  510: 	</ul>
  511:       </li>
  512:     </ul>
  513:     <h2>&lt;script&gt; Functions</h2>
  514:     <p> 
  515:       A list of functions that have been written that are available in 
  516:       the Safe space scripting environment inside a problem. 
  517:     </p>
  518:     <ul>
  519:       <li>sin(x), cos(x), tan(x)</li>
  520:       <li>asin(x), acos(x), atan(x), atan2(y,x)</li>
  521:       <li>log(x), log10(x)</li>
  522:       <li>exp(), pow(x,y), sqrt(x)</li>
  523:       <li>abs(x), sgn(x)</li>
  524:       <li>erf(x), erfc(x)</li>
  525:       <li>ceil(x), floor(x)</li>
  526:       <li>min(...), max(...)</li>
  527:       <li>factorial(n)</li>
  528:       <li>N%M</li>
  529:       <li>sinh(x), cosh(x), tanh(x)</li>
  530:       <li>asinh(x), acosh(x), atanh(x)</li>
  531:       <li>roundto(x,n)</li>
  532:       <li>web("a","b","c") or web(a,b,c)</li>
  533:       <li>html("a") or html(a)</li>
  534:       <li>j0(x), j1(x), jn(n,x), jv(y,x)</li>
  535:       <li>y0(x), y1(x), yn(n,x), yv(y,x)</li>
  536:       <li>random</li>
  537:       <li>choose</li>
  538:       <li>tex("a","b") or tex(a,b)</li>
  539:       <li>var_in_tex(a)</li>
  540:       <li>to_string(x), to_string(x,y)</li>
  541:       <li>class(), section()</li>
  542:       <li>name(), student_number()</li>
  543:       <li>open_date(), due_date(), answer_date()</li>
  544:       <li>sub_string()</li>
  545:       <li>array_moments(array)</li>
  546:       <li>format(x,y),prettyprint(x,y)</li>
  547:       <li>map(...)</li>
  548:       <li>caparesponse_check</li>
  549:       <li>caparesponse_check_list</li>
  550:     </ul>
  551: <!-- Table inserted by H. K. Ng 
  552:     06/01/2001
  553:     06/12/2001
  554: -->
  555:     <p> 
  556:       Detailed descriptions of each function and comparison with CAPA.
  557:     </p>
  558: 
  559:   <table border=1>
  560:       <tr>
  561:             <td valign="top"><b>CAPA Functions</b</td>
  562:             <td valign="top"><b>LON-CAPA</b</td>
  563:             <td valign="top"><b>Descriptions</b</td>
  564:             <td valign="top"><b>Differences (if any)</b</td>
  565:      </tr>
  566: 
  567:     <tr>
  568:              <td valign="top">sin(x), cos(x), tan(x)</td>
  569:              <td valign="top">&amp;sin($x), &amp;cos($x), &amp;tan($x)</td>
  570:              <td valign="top">Trigonometric functions where x is in radians. $x
  571:          can be a pure number, i.e., you can call &amp;sin(3.1415)</td>
  572:               <td valign="top">&nbsp</td>
  573:     </tr>
  574: 
  575:     <tr>
  576:              <td valign="top">asin(x), acos(x), atan(x), atan2(y,x)</td>
  577:              <td valign="top">&amp;asin($x), &amp;acos($x), &amp;atan($x), &amp;atan2($y,$x)</td>
  578:              <td valign="top">Inverse trigonometric functions. Return value is
  579:                  in radians. For asin and acos the value of x must be between -1 and 1.
  580:                  The atan2 returns a value between -pi and pi the sign of which is determined
  581:                  by y. $x and $y can be pure numbers</td>
  582:              <td valign="top">&nbsp;</td>
  583:     </tr>
  584: 
  585:     <tr>
  586:              <td valign="top">log(x), log10(x)</td>
  587:              <td valign="top">&amp;log($x), &amp;log10($x)</td>
  588:              <td valign="top">Natural and base-10 logarithm. $x can be a pure number</td>
  589:              <td valign="top">&nbsp;</td>
  590:     </tr>
  591: 
  592:     <tr>
  593:              <td valign="top">exp(x), pow(x,y), sqrt(x)</td>
  594:              <td valign="top">&amp;exp($x), &amp;pow($x,$y), &amp;sqrt($x)</td>
  595:              <td valign="top">Exponential, power and square root, i.e.,e<sup>x</sup>, x<sup>y</sup> and /x.                  $x and $y can be pure numbers</td>
  596: 
  597:              <td valign="top">&nbsp;</td>
  598:     </tr>
  599: 
  600:     <tr>
  601:              <td valign="top">abs(x), sgn(x)</td>
  602:              <td valign="top">&amp;abs($x), &amp;sgn($x)</td>
  603:              <td valign="top">Abs takes the absolute value of x while sgn(x) returns
  604:                  1, 0 or -1 depending on the value of x. For x>0, sgn(x) = 1, for x=0, sgn(x)
  605:                  = 0 and for x&lt;0, sgn(x) = -1. $x can be a pure number</td>
  606:              <td valign="top">&nbsp;</td>
  607:     </tr>
  608: 
  609:     <tr>
  610:              <td valign="top">erf(x), erfc(x)</td>
  611:              <td valign="top">&amp;erf($x), &amp;erfc($x)</td>
  612:              <td valign="top">Error function.&nbsp; erf = 2/sqrt(pi) integral (0,x) e<sup>t-sq</sup> and <i>                 erfx(x)</i> = 1.0 - <i>erf(x)</i>.&nbsp; $x can be a pure number</td>
  613:              <td valign="top">&nbsp;</td>
  614:     </tr>
  615: 
  616:     <tr>
  617:              <td valign="top">ceil(x), floor(x)</td>
  618:              <td valign="top">&amp;ceil($x), &amp;floor($x)</td>
  619:              <td valign="top">Ceil function returns an integer rounded up whereas
  620:                  floor function returns and integer rounded down. If x is an integer than
  621:                  it returns the value of the integer. $x can be a pure number</td>
  622:              <td valign="top">&nbsp;</td>
  623:     </tr>
  624: 
  625:     <tr>
  626:              <td valign="top">min(...), max(...)</td>
  627:              <td valign="top">&amp;min(...), &amp;max(...)</td>
  628:              <td valign="top">Returns the minimum/ maximum value of a list of
  629:                  arguments if the arguments are numbers. If the arguments are strings then
  630:                  it returns a string sorted according to the ASCII codes</td>
  631:              <td valign="top">&nbsp;</td>
  632:     </tr>
  633: 
  634:     <tr>
  635:              <td valign="top">factorial(n)</td>
  636:              <td valign="top">&amp;factorial($n)</td>
  637:              <td valign="top">Argument (n) must be an integer else it will round
  638:                  down. The largest value for n is 170. $n can be a pure number</td>
  639:              <td valign="top">&nbsp;</td>
  640:     </tr>
  641: 
  642:     <tr>
  643:              <td valign="top">N%M</td>
  644:              <td valign="top">$N%$M</td>
  645: 
  646:              <td valign="top">N and M are integers and returns the remainder (in
  647:                  integer) of N/M. $N and $M can be pure numbers</td>
  648:              <td valign="top">&nbsp;</td>
  649:     </tr>
  650: 
  651:     <tr>
  652:              <td valign="top">sinh(x), cosh(x), tanh(x)</td>
  653:              <td valign="top">&amp;sinh($x), &amp;cosh($x), &amp;tanh($x)</td>
  654:              <td valign="top">Hyperbolic functions. $x can be a pure number</td>
  655:              <td valign="top">&nbsp;</td>
  656:     </tr>
  657: 
  658:     <tr>
  659:              <td valign="top">asinh(x), acosh(x), atanh(x)</td>
  660:              <td valign="top">&amp;asinh($x), &amp;acosh($x), &amp;atanh($x)</td>
  661:              <td valign="top">Inverse hyperbolic functions. $x can be a pure number</td>
  662:              <td valign="top">&nbsp;</td>
  663:     </tr>
  664: 
  665:     <tr>
  666:              <td valign="top">/DIS($x,"nn")</td>
  667:              <td valign="top">&amp;format($x,"nn")</td>
  668:              <td valign="top">Display or format $x as nn where nn is nF or nE and n is an integer.</td>
  669:              <td valign="top">&nbsp;The difference is obvious.</td>
  670:     </tr>
  671: 
  672:     <tr>
  673:              <td valign="top">Not in CAPA</td>
  674:              <td valign="top">&amp;prettyprint($x,"nn")</td>
  675:              <td valign="top">Display or format $x as nn where nn is nF or nE and n is an integer. In E mode it will attempt to generate a pretty x10^3 rather than a E3 following the number</td>
  676:              <td valign="top">&nbsp;</td>
  677:     </tr>
  678: 
  679:     <tr>
  680:              <td valign="top">roundto(x,n)</td>
  681:              <td valign="top">&amp;roundto($x,$n)</td>
  682:              <td valign="top">Rounds a real number to n decimal points. $x and
  683:                  $n can be pure numbers</td>
  684:              <td valign="top">&nbsp;</td>
  685:     </tr>
  686: 
  687:     <tr>
  688:              <td valign="top">web("a","b","c") or web(a,b,c)</td>
  689:              <td valign="top">&amp;web("a","b","c") or &amp;web($a,$b,$c)</td>
  690:              <td valign="top">Returns either a, b or c depending on the output
  691:                  medium. a is for plain ASCII, b for tex output and c for html output</td>
  692:              <td valign="top">&nbsp</td>
  693:     </tr>
  694: 
  695:     <tr>
  696:              <td valign="top">html("a") or html(a)</td>
  697:              <td valign="top">&amp;html("a") or &amp;html($a)</td>
  698:              <td valign="top">Output only if the output mode chosen is in html
  699:                  format</td>
  700:              <td valign="top">&nbsp;</td>
  701:     </tr>
  702: 
  703:     <tr>
  704:              <td valign="top">jn(m,x)</td>
  705:              <td valign="top">&amp;j0($x), &amp;j1($x), &amp;jn($m,$x), &amp;jv($y,$x)</td>
  706:              <td valign="top">Bessel functions of the first kind with orders 0,
  707:                  1 and m respectively. For jn(m,x), m must be an integer whereas for jv(y,x),
  708:                  y is real. $x can be a pure number. $m must be an integer and can be a
  709:                  pure integer number. $y can be a pure real number</td>
  710:              <td valign="top">In CAPA, j0, j1 and jn are contained in one function,
  711:                  jn(m,x) where m takes the value of 0, 1 or 2. jv(y,x) is new to LON-CAPA.</td>
  712:     </tr>
  713: 
  714:     <tr>
  715:              <td valign="top">yn(m,x)</td>
  716:              <td valign="top">&amp;y0($x), &amp;y1($x), &amp;yn($m,$x), &amp;yv($y,$x)</td>
  717:              <td valign="top">Bessel functions of the second kind with orders
  718:                  0, 1 and m respectively. For yn(m,x), m must be an integer whereas for
  719:                  yv(y,x), y is real. $x can be a pure number. $m must be an integer and
  720:                  can be a pure integer number. $y can be a pure real number</td>
  721:              <td valign="top">In CAPA, y0, y1 and yn are contained in one function,
  722:                  yn(m,x) where m takes the value of 0, 1 or 2. yv(y,x) is new to LON-CAPA.</td>
  723:     </tr>
  724: 
  725:     <tr>
  726:              <td valign="top">random(l,u,d)</td>
  727:              <td valign="top">&amp;random($l,$u,$d)</td>
  728:              <td valign="top">Returns a uniformly distributed random number between
  729:                  the lower bound, l and upper bound, u in steps of d. $l, $u and $d can
  730:                  be pure numbers</td>
  731:              <td valign="top">In CAPA, all the 3 arguments must be of the same
  732:                  type. However, now you can mix the type</td>
  733:     </tr>
  734: 
  735:     <tr>
  736:              <td valign="top">choose(i,...)</td>
  737:              <td valign="top">&amp;choose($i,...)</td>
  738:              <td valign="top">Choose the ith item from the argument list. i must
  739:                  be an integer greater than 0 and the value of i should not exceed the number
  740:                  of items. $i can be a pure integer</td>
  741:              <td valign="top">&nbsp;</td>
  742:     </tr>
  743: 
  744:     <tr>
  745:              <td valign="top">/MAP(seed;w,x,y,z;a,b,c,d)</td>
  746:              <td valign="top">Option 1 - &amp;map($seed,[\$w,\$x,\$y,\$z],[$a,$b,$c,$d]) or <br> 
  747:                   Option 2 - &amp;map($seed,\@mappedArray,[$a,$b,$c,$d]) <br>
  748:                   Option 3 - @mappedArray = &amp;map($seed,[$a,$b,$c,$d]) <br>
  749:                   Option 4 - ($w,$x,$y,$z) = &amp;map($seed,\@a) <br>
  750:                   where $a='A'<br>
  751:                         $b='B'<br>
  752:                         $c='B'<br>
  753:                         $d='B'<br>
  754:                         $w, $x, $y, and $z are variables</td>
  755:              <td valign="top">Assigns to the variables $w, $x, $y and $z the values of the
  756:                   $a, $b, $c and $c (A, B, C and D). The precise value for $w .. depends
  757:                   on the seed. (Option 1 of calling map). 
  758:                   In option 2, the values of $a, $b .. are mapped into the array, @mappedArray. The two
  759:                   options illustrate the different grouping. Options 3 and 4 give a consistent 
  760:                   way (with other functions) of mapping the items. For each option, the group can
  761:                   be passed as an array, for example, [$a,$b,$c,$d] => \@a.</td>
  762:              <td valign="top">In CAPA, the arguments are divided into three groups separated
  763:                   by a semicolon ;. In LON-CAPA, the separation is done by using [] brackets or
  764:                   using an array @a. Note the backslash (\) before the arguments in the
  765:                   second and third groups.</td>
  766:     </tr>
  767: 
  768: 
  769:     <tr>
  770:              <td valign="top">rmap(seed;a,b,c,d;w,x,y,z)</td>
  771:              <td valign="top">Option 1 - &amp;rmap($seed,[\$w,\$x,\$y,\$z],[$a,$b,$c,$d]) or <br> 
  772:                   Option 2 - &amp;rmap($seed,\@rmappedArray,[$a,$b,$c,$d]) <br>
  773:                   Option 3 - @rmapped_array = &amp;rmap($seed,[$a,$b,$c,$d]) <br>
  774:                   Option 4 - ($w,$x,$y,$z) = &amp;rmap($seed,\@a) <br>
  775:                   where $a='A'<br>
  776:                         $b='B'<br>
  777:                         $c='B'<br>
  778:                         $d='B'<br>
  779:                         $w, $x, $y, and $z are variables</td>
  780:              <td valign="top">The rmap functions does the reverse action of map if the same seed
  781:                   is used in calling map and rmap. </td>
  782:              <td valign="top">In CAPA, the arguments are divided into
  783:              three groups separated by a semicolon ;. In LON-CAPA, the
  784:              separation is done by using [] brackets (with create an
  785:              unamed vector reference) or using an array @a. Note the
  786:              backslash (\) before the arguments in the second and
  787:              third groups (Which cause Perl to send to variable
  788:              locations rather than the variable values, similar to a C
  789:              pointer).</td>
  790:     </tr>
  791:       
  792:      <tr>
  793:              <td valign="top">NOT IMPLEMENTED IN CAPA</td>
  794:              <td valign="top">$a=&amp;xmlparse($string) </td>
  795:              <td valign="top">Runs the internal parser over the
  796: 	  argument parsing for display. <b>Warning</b> This will
  797: 	  result in different strings in different targets. Don't use
  798: 	  the results of this function as an answer.</td>
  799:              <td valign="top">New to LON-CAPA</td>
  800:     </tr>
  801: 
  802:     <tr>
  803:              <td valign="top">tex(a,b), tex("a","b")</td>
  804:              <td valign="top">&amp;tex($a,$b), &amp;tex("a","b")</td>
  805:              <td valign="top">Returns a if the output mode is in tex otherwise
  806:                   returns b</td>
  807:              <td valign="top">&nbsp;</td>
  808:     </tr>
  809: 
  810:     <tr>
  811:              <td valign="top">var_in_tex(a)</td>
  812:              <td valign="top">&amp;var_in_tex($a)</td>
  813:              <td valign="top">Equivalent to tex("a","")</td>
  814:              <td valign="top">&nbsp;</td>
  815:     </tr>
  816: 
  817:     <tr>
  818:              <td valign="top">to_string(x), to_string(x,y)</td>
  819:              <td valign="top">&amp;to_string($x), &amp;to_string($x,$y)</td>
  820:              <td valign="top">If x is an integer, returns a string. If x is real
  821:                 than the output is a string with format given by y. For example, if x =
  822:                 12.3456, &amp;to_string(x,".3F") = 12.345 and &amp;to_string(x,".3E") =
  823:                 1.234E+01.</td>
  824:              <td valign="top">&nbsp;</td>
  825:     </tr>
  826: 
  827:     <tr>
  828:              <td valign="top">capa_id(), class(), section(), set(), problem()</td>
  829:              <td valign="top">&amp;class(), &amp;section()</td>
  830:              <td valign="top">Returns null string, class descriptive name, section
  831:                     number, set number and null string.</td>
  832:              <td valign="top">capa_id(), set() and problem() are no longer used.
  833:                     Currently, they return a null value.</td>
  834:     </tr>
  835: 
  836:     <tr>
  837:              <td valign="top">name(), student_number()</td>
  838:              <td valign="top">&amp;name(), &amp;student_number()</td>
  839:              <td valign="top">Return the full name in the following format: lastname,
  840:                     firstname initial. Student_number returns the student 9-alphanumeric string.
  841:                     If undefined, the functions return null.</td>
  842:              <td valign="top">&nbsp;</td>
  843:     </tr>
  844: 
  845:     <tr>
  846:              <td valign="top">open_date(), due_date(), answer_date()</td>
  847:              <td valign="top">&amp;open_date(), &amp;due_date(), &amp;answer_date()</td>
  848:              <td valign="top">Problem open date, due date and answer date. The
  849:                     time is also included in 24-hr format.</td>
  850:              <td valign="top">Output format for time is changed slightly. If pass
  851:                     noon, it displays ..pm else it displays ..am. So 23:59 is displayed as
  852:                     11:59 pm.</td>
  853:     </tr>
  854: 
  855:     <tr>
  856:              <td valign="top">get_seed(), set_seed()</td>
  857:              <td valign="top">Not implemented</td>
  858:              <td valign="top">Get and set the random seed.</td>
  859:              <td valign="top">&nbsp;</td>
  860:     </tr>
  861: 
  862:     <tr>
  863:              <td valign="top">sub_string(a,b,c)</td>
  864:              <td valign="top">&amp;sub_string($a,$b,$c) <br>perl&nbsp; substr function. 
  865:                  However, note the differences</td>
  866:              <td valign="top">Retrieve a portion of string a starting from b and
  867:                     length c. For example,&nbsp; $a = "Welcome to LON-CAPA"; 
  868:                     $result=&amp;sub_string($a,4,4); then $result is "come"</td>
  869:              <td valign="top">Perl intrinsic function, substr(string,b,c) starts
  870:                     counting from 0 (as opposed to 1). In the example to the left, substr($a,4,4)
  871:                     returns "ome ".</td>
  872:     </tr>
  873: 
  874:     <tr>
  875:              <td valign="top">array[xx]</td>
  876:              <td valign="top">@arrayname <br>Array is intrinsic in perl. 
  877:                  To access a specific element use $arrayname[$n] where $n 
  878:                  is the $n+1 element since the array count starts from 0</td>
  879:              <td valign="top">"xx" can be a variable or a calculation.</td>
  880:              <td valign="top">In LON-CAPA, an array is defined by @arrayname.
  881:                   It is not necessary to specify the dimension of the array.&nbsp;</td>
  882:     </tr>
  883: 
  884:     <tr>
  885:              <td valign="top">array_moments(B,A)</td>
  886:              <td valign="top">@B=&amp;array_moments(@A)</td>
  887:              <td valign="top">Evaluates the moments of an array A and place the
  888:                   result in array B[i] where i = 0 to 4. The contents of B are as follows:
  889:                   B[0] = number of elements, B[1] = mean, B[2] = variance, B[3] = skewness
  890:                   and B[4] = kurtosis.</td>
  891:              <td valign="top">In CAPA, the moments are passed as an array in the first argument whereas
  892:                   in LON-CAPA, the array containing the moments are set equal to the function.</td>
  893:     </tr>
  894: 
  895:     <tr>
  896:              <td valign="top">array_max(Name), array_min(Name)</td>
  897:              <td valign="top">&amp;min(@Name), &amp;max(@Name)</td>
  898:              <td valign="top">In LON-CAPA to find the maximum value of an array, use
  899:                    &amp;max(@arrayname)&nbsp; and to find the minimum value of an array, use
  900:                    &amp;min(@arrayname)</td>
  901:              <td valign="top">Combined with the min and max functions defined
  902:                 earlier.</td>
  903:     </tr>
  904: 
  905:     <tr>
  906:              <td valign="top">init_array(Name)</td>
  907:              <td valign="top">undef @name</td>
  908:              <td valign="top">To destroy the contents of an array, use</td>
  909:              <td valign="top">Use perl intrinsic undef function.</td>
  910:     </tr>
  911:      <tr>
  912:              <td valign="top">random_normal (return_array,item_cnt,seed,av,std_dev)</td>
  913:              <td valign="top">@return_array=&random_normal ($item_cnt,$seed,$av,$std_dev)</td>
  914:              <td valign="top">Generate $item_cnt deviates of normal distribution of average $av and
  915:                         standard deviation $std_dev. The distribution is generated from seed $seed</td>
  916:              <td valign="top">In CAPA the results are passed as the first argument whereas in LON-CAPA 
  917:                         the results are set equal to the function.</td>
  918:     </tr>
  919:      <tr>
  920:              <td valign="top">random_beta (return_array,item_cnt,seed,aa,bb)</td>
  921:              <td valign="top">@return_array=&random_beta ($item_cnt,$seed,$aa,$bb) <br>
  922:                         NOTE: Both $aa and $bb MUST be greater than 1.0E-37.</td>
  923:              <td valign="top">Generate $item_cnt deviates of beta distribution. 
  924:                         The density of beta is:
  925:                         X^($aa-1) *(1-X)^($bb-1) /B($aa,$bb) for 0&lt;X&lt;1.</td>
  926:              <td valign="top">In CAPA the results are passed as the first argument whereas in LON-CAPA 
  927:                         the results are set equal to the function.</td>
  928:     </tr>
  929:      <tr>
  930:              <td valign="top">random_gamma (return_array,item_cnt,seed,a,r)</td>
  931:              <td valign="top">@return_array=&random_gamma ($item_cnt,$seed,$a,$r) <br>
  932:                         NOTE: Both $a and $r MUST be positive.</td>
  933:              <td valign="top">Generate $item_cnt deviates of gamma distribution. 
  934:                         The density of gamma is:
  935:                         ($a**$r)/gamma($r) * X**($r-1) * exp(-$a*X).</td>
  936:              <td valign="top">In CAPA the results are passed as the first argument whereas in LON-CAPA 
  937:                         the results are set equal to the function.</td>
  938:     </tr>
  939:      <tr>
  940:              <td valign="top">random_exponential (return_array,item_cnt,seed,av)</td>
  941:              <td valign="top">@return_array=&random_exponential ($item_cnt,$seed,$av) <br>
  942:                         NOTE: $av MUST be non-negative.</td>
  943:              <td valign="top">Generate $item_cnt deviates of exponential distribution. </td>
  944:              <td valign="top">In CAPA the results are passed as the first argument whereas in LON-CAPA 
  945:                         the results are set equal to the function.</td>
  946:     </tr>
  947:      <tr>
  948:              <td valign="top">random_poisson (return_array,item_cnt,seed,mu)</td>
  949:              <td valign="top">@return_array=&random_poisson ($item_cnt,$seed,$mu) <br>
  950:                         NOTE: $mu MUST be non-negative.</td>
  951:              <td valign="top">Generate $item_cnt deviates of poisson distribution. </td>
  952:              <td valign="top">In CAPA the results are passed as the first argument whereas in LON-CAPA 
  953:                         the results are set equal to the function.</td>
  954:     </tr>
  955:      <tr>
  956:              <td valign="top">random_chi (return_array,item_cnt,seed,df)</td>
  957:              <td valign="top">@return_array=&random_chi ($item_cnt,$seed,$df) <br>
  958:                         NOTE: $df MUST be positive.</td>
  959:              <td valign="top">Generate $item_cnt deviates of chi_square distribution with $df 
  960:                         degrees of freedom. </td>
  961:              <td valign="top">In CAPA the results are passed as the first argument whereas in LON-CAPA 
  962:                         the results are set equal to the function.</td>
  963:     </tr>
  964:      <tr>
  965:              <td valign="top">random_noncentral_chi (return_array,item_cnt,seed,df,nonc)</td>
  966:              <td valign="top">@return_array=&random_noncentral_chi ($item_cnt,$seed,$df,$nonc) <br>
  967:                         NOTE: $df MUST be at least 1 and $nonc MUST be non-negative.</td>
  968:              <td valign="top">Generate $item_cnt deviates of noncentral_chi_square 
  969:                         distribution with $df 
  970:                         degrees of freedom and noncentrality parameter $nonc. </td>
  971:              <td valign="top">In CAPA the results are passed as the first argument whereas in LON-CAPA 
  972:                         the results are set equal to the function.</td>
  973:     </tr>
  974:      <tr>
  975:              <td valign="top">NOT IMPLEMENTED IN CAPA</td>
  976:              <td valign="top">@return_array=&random_f ($item_cnt,$seed,$dfn,$dfd) <br>
  977:                         NOTE: Both $dfn and $dfd MUST be positive.</td>
  978:              <td valign="top">Generate $item_cnt deviates of F (variance ratio) distribution with  
  979:                         degrees of freedom $dfn (numerator) and $dfd (denominator). </td>
  980:              <td valign="top">New to LON-CAPA</td>
  981:     </tr>
  982:      <tr>
  983:              <td valign="top">NOT IMPLEMENTED IN CAPA</td>
  984:              <td valign="top">@return_array=&random_noncentral_f ($item_cnt,$seed,$dfn,$dfd,$nonc) <br>
  985:                         NOTE: $dfn must be at least 1, $dfd MUST be positive, and $nonc must
  986:                         be non-negative.</td>
  987:              <td valign="top">Generate $item_cnt deviates of noncentral F (variance ratio) 
  988:                         distribution with degrees of freedom $dfn (numerator) and $dfd (denominator).
  989:                         $nonc is the noncentrality parameter. </td>
  990:              <td valign="top">New to LON-CAPA</td>
  991:     </tr>
  992:      <tr>
  993:              <td valign="top">NOT DOCUMENTED IN CAPA</td>
  994:              <td valign="top">@return_array=&random_multivariate_normal ($item_cnt,$seed,\@mean,\@covar) <br>
  995:                         NOTE: @mean should be of length p array of real numbers. @covar should be a length
  996:                         p array of references to length p arrays of real numbers (i.e. a p by p matrix.</td>
  997:              <td valign="top">Generate $item_cnt deviates of multivariate_normal distribution with  
  998:                         mean vector @mean and variance-covariance matrix. </td>
  999:              <td valign="top">Note the backslash before the @mean and @covar arrays.</td>
 1000:     </tr>
 1001:      <tr>
 1002:              <td valign="top">NOT IMPLEMENTED IN CAPA</td>
 1003:              <td valign="top">@return_array=&random_multinomial ($item_cnt,$seed,@p) <br>
 1004:                         NOTE: $item_cnt is rounded with int() and the result must be non-negative. 
 1005:                         The number of elements in @p must be at least 2.</td>
 1006:              <td valign="top">Returns single observation from multinomial distribution with  
 1007:                         $item_cnt events classified into as many categories as the length of @p.
 1008:                         The probability of an event being classified into category i is given by 
 1009:                         ith element of @p. The observation is an array with length equal to @p, so
 1010:                         when called in a scalar context it returns the length of @p. The sum of the
 1011:                         elements of the obervation is equal to $item_cnt.</td>
 1012:              <td valign="top">New to LON-CAPA</td>
 1013:     </tr>
 1014:      <tr>
 1015:              <td valign="top">NOT IMPLEMENTED IN CAPA</td>
 1016:              <td valign="top">@return_array=&random_permutation ($item_cnt,@array) </td>
 1017:              <td valign="top">Returns @array randomly permuted.</td>
 1018:              <td valign="top">New to LON-CAPA</td>
 1019:     </tr>
 1020:      <tr>
 1021:              <td valign="top">NOT IMPLEMENTED IN CAPA</td>
 1022:              <td valign="top">@return_array=&random_uniform ($item_cnt,$seed,$low,$high) <br>
 1023:                         NOTE: $low must be less than or equal to $high.</td>
 1024:              <td valign="top">Generate $item_cnt deviates from a uniform distribution. </td>
 1025:              <td valign="top">New to LON-CAPA</td>
 1026:     </tr>
 1027:      <tr>
 1028:              <td valign="top">NOT IMPLEMENTED IN CAPA</td>
 1029:              <td valign="top">@return_array=&random_uniform_integer ($item_cnt,$seed,$low,$high) <br>
 1030:                         NOTE: $low and $high are both passed through int().
 1031:                               $low must be less than or equal to $high.</td>
 1032:              <td valign="top">Generate $item_cnt deviates from a uniform distribution in integers. </td>
 1033:              <td valign="top">New to LON-CAPA</td>
 1034:     </tr>
 1035:      <tr>
 1036:              <td valign="top">NOT IMPLEMENTED IN CAPA</td>
 1037:              <td valign="top">@return_array=&random_binomial ($item_cnt,$seed,$nt,$p) <br>
 1038:                         NOTE: $nt is rounded using int() and the result must be non-negative. 
 1039:                               $p must be between 0 and 1 inclusive.</td>
 1040:              <td valign="top">Generate $item_cnt deviates from the binomial distribution with
 1041:                         $nt trials and the probabilty of an event in each trial is $p. </td>
 1042:              <td valign="top">New to LON-CAPA</td>
 1043:     </tr>
 1044:      <tr>
 1045:              <td valign="top">NOT IMPLEMENTED IN CAPA</td>
 1046:              <td valign="top">@return_array=&random_negative_binomial ($item_cnt,$seed,$ne,$p) <br>
 1047:                         NOTE: $ne is rounded using int() and the result must be positive. 
 1048:                               $p must be between 0 and 1 exclusive.</td>
 1049:              <td valign="top">Generate an array of $item_cnt outcomes generated from 
 1050:                         negative binomial distribution with
 1051:                         $ne events and the probabilty of an event in each trial is $p. </td>
 1052:              <td valign="top">New to LON-CAPA</td>
 1053:     </tr>
 1054:  </table>
 1055: <!-- insertion ends -->
 1056: 
 1057:     <h2>&lt;script&gt; Variables</h2>
 1058:     <ul>
 1059:       <li>
 1060: 	$external::target - set to the current target the xml parser
 1061: 	is parsing for
 1062:       </li>
 1063:       <li>
 1064: 	$external::part - set to the <i>id</i> of the current problem
 1065: 	&lt;part&gt;; zero if there are no &lt;part&gt;
 1066:       </li>
 1067:       <li>
 1068: 	$external::gradestatus - set to the value of the current
 1069: 	resource.partid.solved value
 1070:       </li>
 1071:       <li>
 1072: 	$external::datestatus - set to the current status of the clock
 1073: 	either CLOSED, CAN_ANSWER, CANNOT_ANSWER, SHOW_ANSWER, or UNCHECKEDOUT
 1074:       </li>
 1075:       <li>
 1076: 	$external::randomseed - set to the number that was used to
 1077: 	seed the random number generator
 1078:       </li>
 1079:       <li>$pi - set to PI </li>
 1080:       <li>$rad2deg - converts radians to degrees </li>
 1081:       <li>$deg2rad - converts degrees to radians </li>
 1082:     </ul>
 1083: 
 1084:     <h2> Form internals </h2>
 1085:     <p> Form elements used for homework editing/response </p>
 1086:     <p> the form is named lonhomework </p>
 1087:     <h3> Viewing a problem (either CSTR or RES space)</h3>
 1088:     <ul>
 1089:       <li>
 1090: 	grade_target, grade_username, grade_domain, grade_symb - the
 1091: 	vaules take precedence over the the normal ENV settings of
 1092: 	these, use &Apache::lonxml::whichuser() to get back the
 1093: 	correct vaues of the items
 1094:       </li>
 1095:       <li>
 1096: 	HWVAL_response:number - the name of the input elements for each response. The response is the response's ID, and the :number part exists only for response with multiple foils, and is a unique number in order of the submission
 1097:       </li>
 1098:       <li>
 1099: 	changerandseed - the 'Change' button, only exists right after
 1100: 	the Change button is clicked
 1101:       </li>
 1102:       <li>
 1103: 	problemmode - in CSTR, it is either 'View','Edit','EditXML' or
 1104: 	'Analyze' depending on the desired view
 1105:       </li>
 1106:       <li>
 1107: 	rndseed - the currently requested random seed
 1108:       </li>
 1109:       <li>
 1110: 	showallfoils - if it exists, and we are in CSTR space, the
 1111: 	problem should ignore &lt;conceptgroup&gt; and the response's
 1112: 	max setting and show all possible foils
 1113:       </li>
 1114:       <li>
 1115: 	submit - the name of the Submit button
 1116:       </li>
 1117:       <li>
 1118: 	submitted - a hidden form parameter that can be used to tell
 1119: 	if the student has submitted answers or not, if it is set,
 1120: 	there should be answers to grade.
 1121:       </li>
 1122:     </ul>
 1123:     <h3> Editing a problem (Edit mode)</h3>
 1124:     <p> tagdepth referes to the current value of the xmlparsers tagdepth couter ($Apache::lonxml::currentdepth)</p>
 1125: <p> Note: the file edit.pm has many helper functions for creating the standard elements for editing a tag and it's attributes, all of those functions follow these conventions </p>
 1126:     <ul>
 1127:       <li>
 1128: 	tagdepth_argname - I.E. 1_3.max, a parameter editing value,
 1129: 	max is the name of the parameter and it is for the third tag
 1130: 	inside the first tag
 1131:       </li>
 1132:       <li>
 1133: 	delete_tagdepth - if set to yes, delete tag tagdepth and all
 1134: 	tags inside of it
 1135:       </li>
 1136:       <li>
 1137: 	homework_edit_tagdepth - used by both &Apache::edit::editline
 1138: 	and &Apache::edit::editfield for the &lt;textarea&gt; and
 1139: 	&lt;input&gt; form elements they create
 1140:       </li>
 1141:       <li>
 1142: 	insert_tagdepth - used to request an tag insert, it is set to
 1143: 	the id number of the requested tag in the
 1144: 	%Apache::lonxml::insertlist
 1145:     </ul>
 1146:     <hr>
 1147:     <address><a href="mailto:albertel@marvin.lite.msu.edu">Guy Albertelli</a></address>
 1148: <!-- Created: Thu May 17 15:05:35 EDT 2001 -->
 1149: <!-- hhmts start -->
 1150: Last modified: Thu Jun  6 04:28:33 EDT 2002
 1151: <!-- hhmts end -->
 1152:   </body>
 1153: </html>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>