Annotation of doc/homework/homework5.html, revision 1.18

1.1       albertel    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: 
1.5       ng          7:   <body bgcolor="white">
1.1       albertel    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>
1.2       albertel   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>
1.16      albertel   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>
1.1       albertel   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>
1.8       albertel   70: 	      <li><i>answer</i> required, specifies the correct answer, may be either a perl list or scalar</li>
1.1       albertel   71: 	      <li><i>units</i> optional, specifies unit of correct answer, CAPA style</li>
                     72: 	    </ul>
                     73: 	  </li>
                     74: 	  <li>
1.8       albertel   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>
1.1       albertel   90: 	    <b>&lt;essayresponse&gt;</b> implements a ungraded large
1.17      albertel   91: 	    text response, it need an internal <b>&lt;textfield&gt;</b>
1.1       albertel   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>
1.10      albertel  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>
1.15      albertel  150: 	  </li>
1.10      albertel  151: 	  <li>
1.15      albertel  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>
1.1       albertel  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>
1.17      albertel  263: 	    <b>&lt;textfield&gt;</b> creates a Large text input box, If
1.1       albertel  264: 	    data appears between the start and end tags, the data will
1.17      albertel  265: 	    appear in the textfield if the student has not yet made a
1.1       albertel  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>
1.15      albertel  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>
1.1       albertel  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>
1.12      albertel  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>
1.15      albertel  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>
1.1       albertel  415: 	</ul>
                    416:       </li>
                    417:       <li>
                    418: 	Scripting
1.15      albertel  419:       <p>
                    420: 	These tags allow the document to behave programatically
                    421:       </p>
                    422:       <ul>
                    423: 	<li>
1.1       albertel  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
1.13      albertel  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>.
1.1       albertel  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>
1.18    ! albertel  510: 	  <li>
        !           511: 	    <b>&lt;comment&gt;</b> Allows one to comment out sections
        !           512: 	    of code in a balanced manner, or to provide a comment
        !           513: 	    description of how a problem works. Only shows up for the
        !           514: 	    edit target, stripped out for all other targets.
        !           515: 	  </li>
1.1       albertel  516: 	</ul>
                    517:       </li>
                    518:     </ul>
                    519:     <h2>&lt;script&gt; Functions</h2>
                    520:     <p> 
                    521:       A list of functions that have been written that are available in 
1.5       ng        522:       the Safe space scripting environment inside a problem. 
1.1       albertel  523:     </p>
                    524:     <ul>
1.3       ng        525:       <li>sin(x), cos(x), tan(x)</li>
                    526:       <li>asin(x), acos(x), atan(x), atan2(y,x)</li>
                    527:       <li>log(x), log10(x)</li>
                    528:       <li>exp(), pow(x,y), sqrt(x)</li>
                    529:       <li>abs(x), sgn(x)</li>
                    530:       <li>erf(x), erfc(x)</li>
                    531:       <li>ceil(x), floor(x)</li>
                    532:       <li>min(...), max(...)</li>
                    533:       <li>factorial(n)</li>
                    534:       <li>N%M</li>
                    535:       <li>sinh(x), cosh(x), tanh(x)</li>
                    536:       <li>asinh(x), acosh(x), atanh(x)</li>
                    537:       <li>roundto(x,n)</li>
                    538:       <li>web("a","b","c") or web(a,b,c)</li>
                    539:       <li>html("a") or html(a)</li>
                    540:       <li>j0(x), j1(x), jn(n,x), jv(y,x)</li>
                    541:       <li>y0(x), y1(x), yn(n,x), yv(y,x)</li>
1.1       albertel  542:       <li>random</li>
                    543:       <li>choose</li>
1.3       ng        544:       <li>tex("a","b") or tex(a,b)</li>
                    545:       <li>var_in_tex(a)</li>
                    546:       <li>to_string(x), to_string(x,y)</li>
                    547:       <li>class(), section()</li>
                    548:       <li>name(), student_number()</li>
                    549:       <li>open_date(), due_date(), answer_date()</li>
                    550:       <li>sub_string()</li>
                    551:       <li>array_moments(array)</li>
1.15      albertel  552:       <li>format(x,y),prettyprint(x,y)</li>
1.3       ng        553:       <li>map(...)</li>
1.1       albertel  554:       <li>caparesponse_check</li>
                    555:       <li>caparesponse_check_list</li>
                    556:     </ul>
1.5       ng        557: <!-- Table inserted by H. K. Ng 
                    558:     06/01/2001
                    559:     06/12/2001
                    560: -->
                    561:     <p> 
                    562:       Detailed descriptions of each function and comparison with CAPA.
                    563:     </p>
1.4       ng        564: 
                    565:   <table border=1>
                    566:       <tr>
                    567:             <td valign="top"><b>CAPA Functions</b</td>
                    568:             <td valign="top"><b>LON-CAPA</b</td>
                    569:             <td valign="top"><b>Descriptions</b</td>
                    570:             <td valign="top"><b>Differences (if any)</b</td>
                    571:      </tr>
                    572: 
                    573:     <tr>
                    574:              <td valign="top">sin(x), cos(x), tan(x)</td>
                    575:              <td valign="top">&amp;sin($x), &amp;cos($x), &amp;tan($x)</td>
                    576:              <td valign="top">Trigonometric functions where x is in radians. $x
                    577:          can be a pure number, i.e., you can call &amp;sin(3.1415)</td>
                    578:               <td valign="top">&nbsp</td>
                    579:     </tr>
                    580: 
                    581:     <tr>
                    582:              <td valign="top">asin(x), acos(x), atan(x), atan2(y,x)</td>
                    583:              <td valign="top">&amp;asin($x), &amp;acos($x), &amp;atan($x), &amp;atan2($y,$x)</td>
                    584:              <td valign="top">Inverse trigonometric functions. Return value is
                    585:                  in radians. For asin and acos the value of x must be between -1 and 1.
                    586:                  The atan2 returns a value between -pi and pi the sign of which is determined
                    587:                  by y. $x and $y can be pure numbers</td>
                    588:              <td valign="top">&nbsp;</td>
                    589:     </tr>
                    590: 
                    591:     <tr>
                    592:              <td valign="top">log(x), log10(x)</td>
                    593:              <td valign="top">&amp;log($x), &amp;log10($x)</td>
                    594:              <td valign="top">Natural and base-10 logarithm. $x can be a pure number</td>
                    595:              <td valign="top">&nbsp;</td>
                    596:     </tr>
                    597: 
                    598:     <tr>
                    599:              <td valign="top">exp(x), pow(x,y), sqrt(x)</td>
                    600:              <td valign="top">&amp;exp($x), &amp;pow($x,$y), &amp;sqrt($x)</td>
                    601:              <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>
                    602: 
                    603:              <td valign="top">&nbsp;</td>
                    604:     </tr>
                    605: 
                    606:     <tr>
                    607:              <td valign="top">abs(x), sgn(x)</td>
                    608:              <td valign="top">&amp;abs($x), &amp;sgn($x)</td>
                    609:              <td valign="top">Abs takes the absolute value of x while sgn(x) returns
                    610:                  1, 0 or -1 depending on the value of x. For x>0, sgn(x) = 1, for x=0, sgn(x)
                    611:                  = 0 and for x&lt;0, sgn(x) = -1. $x can be a pure number</td>
                    612:              <td valign="top">&nbsp;</td>
                    613:     </tr>
                    614: 
                    615:     <tr>
                    616:              <td valign="top">erf(x), erfc(x)</td>
                    617:              <td valign="top">&amp;erf($x), &amp;erfc($x)</td>
                    618:              <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>
                    619:              <td valign="top">&nbsp;</td>
                    620:     </tr>
                    621: 
                    622:     <tr>
                    623:              <td valign="top">ceil(x), floor(x)</td>
                    624:              <td valign="top">&amp;ceil($x), &amp;floor($x)</td>
                    625:              <td valign="top">Ceil function returns an integer rounded up whereas
                    626:                  floor function returns and integer rounded down. If x is an integer than
                    627:                  it returns the value of the integer. $x can be a pure number</td>
                    628:              <td valign="top">&nbsp;</td>
                    629:     </tr>
                    630: 
                    631:     <tr>
                    632:              <td valign="top">min(...), max(...)</td>
                    633:              <td valign="top">&amp;min(...), &amp;max(...)</td>
                    634:              <td valign="top">Returns the minimum/ maximum value of a list of
                    635:                  arguments if the arguments are numbers. If the arguments are strings then
                    636:                  it returns a string sorted according to the ASCII codes</td>
                    637:              <td valign="top">&nbsp;</td>
                    638:     </tr>
                    639: 
                    640:     <tr>
                    641:              <td valign="top">factorial(n)</td>
                    642:              <td valign="top">&amp;factorial($n)</td>
                    643:              <td valign="top">Argument (n) must be an integer else it will round
                    644:                  down. The largest value for n is 170. $n can be a pure number</td>
                    645:              <td valign="top">&nbsp;</td>
                    646:     </tr>
                    647: 
                    648:     <tr>
                    649:              <td valign="top">N%M</td>
                    650:              <td valign="top">$N%$M</td>
                    651: 
                    652:              <td valign="top">N and M are integers and returns the remainder (in
                    653:                  integer) of N/M. $N and $M can be pure numbers</td>
                    654:              <td valign="top">&nbsp;</td>
                    655:     </tr>
                    656: 
                    657:     <tr>
                    658:              <td valign="top">sinh(x), cosh(x), tanh(x)</td>
                    659:              <td valign="top">&amp;sinh($x), &amp;cosh($x), &amp;tanh($x)</td>
                    660:              <td valign="top">Hyperbolic functions. $x can be a pure number</td>
                    661:              <td valign="top">&nbsp;</td>
                    662:     </tr>
                    663: 
                    664:     <tr>
                    665:              <td valign="top">asinh(x), acosh(x), atanh(x)</td>
                    666:              <td valign="top">&amp;asinh($x), &amp;acosh($x), &amp;atanh($x)</td>
                    667:              <td valign="top">Inverse hyperbolic functions. $x can be a pure number</td>
                    668:              <td valign="top">&nbsp;</td>
                    669:     </tr>
                    670: 
                    671:     <tr>
1.9       ng        672:              <td valign="top">/DIS($x,"nn")</td>
                    673:              <td valign="top">&amp;format($x,"nn")</td>
                    674:              <td valign="top">Display or format $x as nn where nn is nF or nE and n is an integer.</td>
                    675:              <td valign="top">&nbsp;The difference is obvious.</td>
                    676:     </tr>
                    677: 
                    678:     <tr>
1.15      albertel  679:              <td valign="top">Not in CAPA</td>
                    680:              <td valign="top">&amp;prettyprint($x,"nn")</td>
                    681:              <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>
                    682:              <td valign="top">&nbsp;</td>
                    683:     </tr>
                    684: 
                    685:     <tr>
1.4       ng        686:              <td valign="top">roundto(x,n)</td>
                    687:              <td valign="top">&amp;roundto($x,$n)</td>
                    688:              <td valign="top">Rounds a real number to n decimal points. $x and
                    689:                  $n can be pure numbers</td>
                    690:              <td valign="top">&nbsp;</td>
                    691:     </tr>
                    692: 
                    693:     <tr>
                    694:              <td valign="top">web("a","b","c") or web(a,b,c)</td>
                    695:              <td valign="top">&amp;web("a","b","c") or &amp;web($a,$b,$c)</td>
                    696:              <td valign="top">Returns either a, b or c depending on the output
                    697:                  medium. a is for plain ASCII, b for tex output and c for html output</td>
                    698:              <td valign="top">&nbsp</td>
                    699:     </tr>
                    700: 
                    701:     <tr>
                    702:              <td valign="top">html("a") or html(a)</td>
                    703:              <td valign="top">&amp;html("a") or &amp;html($a)</td>
                    704:              <td valign="top">Output only if the output mode chosen is in html
                    705:                  format</td>
                    706:              <td valign="top">&nbsp;</td>
                    707:     </tr>
                    708: 
                    709:     <tr>
                    710:              <td valign="top">jn(m,x)</td>
                    711:              <td valign="top">&amp;j0($x), &amp;j1($x), &amp;jn($m,$x), &amp;jv($y,$x)</td>
                    712:              <td valign="top">Bessel functions of the first kind with orders 0,
                    713:                  1 and m respectively. For jn(m,x), m must be an integer whereas for jv(y,x),
                    714:                  y is real. $x can be a pure number. $m must be an integer and can be a
                    715:                  pure integer number. $y can be a pure real number</td>
                    716:              <td valign="top">In CAPA, j0, j1 and jn are contained in one function,
1.5       ng        717:                  jn(m,x) where m takes the value of 0, 1 or 2. jv(y,x) is new to LON-CAPA.</td>
1.4       ng        718:     </tr>
                    719: 
                    720:     <tr>
                    721:              <td valign="top">yn(m,x)</td>
                    722:              <td valign="top">&amp;y0($x), &amp;y1($x), &amp;yn($m,$x), &amp;yv($y,$x)</td>
                    723:              <td valign="top">Bessel functions of the second kind with orders
                    724:                  0, 1 and m respectively. For yn(m,x), m must be an integer whereas for
                    725:                  yv(y,x), y is real. $x can be a pure number. $m must be an integer and
                    726:                  can be a pure integer number. $y can be a pure real number</td>
                    727:              <td valign="top">In CAPA, y0, y1 and yn are contained in one function,
1.5       ng        728:                  yn(m,x) where m takes the value of 0, 1 or 2. yv(y,x) is new to LON-CAPA.</td>
1.4       ng        729:     </tr>
                    730: 
                    731:     <tr>
                    732:              <td valign="top">random(l,u,d)</td>
                    733:              <td valign="top">&amp;random($l,$u,$d)</td>
                    734:              <td valign="top">Returns a uniformly distributed random number between
                    735:                  the lower bound, l and upper bound, u in steps of d. $l, $u and $d can
                    736:                  be pure numbers</td>
                    737:              <td valign="top">In CAPA, all the 3 arguments must be of the same
                    738:                  type. However, now you can mix the type</td>
                    739:     </tr>
                    740: 
                    741:     <tr>
                    742:              <td valign="top">choose(i,...)</td>
                    743:              <td valign="top">&amp;choose($i,...)</td>
                    744:              <td valign="top">Choose the ith item from the argument list. i must
                    745:                  be an integer greater than 0 and the value of i should not exceed the number
                    746:                  of items. $i can be a pure integer</td>
                    747:              <td valign="top">&nbsp;</td>
                    748:     </tr>
                    749: 
                    750:     <tr>
1.11      albertel  751:              <td valign="top">/MAP(seed;w,x,y,z;a,b,c,d)</td>
1.7       ng        752:              <td valign="top">Option 1 - &amp;map($seed,[\$w,\$x,\$y,\$z],[$a,$b,$c,$d]) or <br> 
                    753:                   Option 2 - &amp;map($seed,\@mappedArray,[$a,$b,$c,$d]) <br>
                    754:                   Option 3 - @mappedArray = &amp;map($seed,[$a,$b,$c,$d]) <br>
                    755:                   Option 4 - ($w,$x,$y,$z) = &amp;map($seed,\@a) <br>
                    756:                   where $a='A'<br>
                    757:                         $b='B'<br>
                    758:                         $c='B'<br>
                    759:                         $d='B'<br>
                    760:                         $w, $x, $y, and $z are variables</td>
1.6       ng        761:              <td valign="top">Assigns to the variables $w, $x, $y and $z the values of the
1.7       ng        762:                   $a, $b, $c and $c (A, B, C and D). The precise value for $w .. depends
                    763:                   on the seed. (Option 1 of calling map). 
                    764:                   In option 2, the values of $a, $b .. are mapped into the array, @mappedArray. The two
                    765:                   options illustrate the different grouping. Options 3 and 4 give a consistent 
                    766:                   way (with other functions) of mapping the items. For each option, the group can
                    767:                   be passed as an array, for example, [$a,$b,$c,$d] => \@a.</td>
1.6       ng        768:              <td valign="top">In CAPA, the arguments are divided into three groups separated
                    769:                   by a semicolon ;. In LON-CAPA, the separation is done by using [] brackets or
                    770:                   using an array @a. Note the backslash (\) before the arguments in the
                    771:                   second and third groups.</td>
                    772:     </tr>
                    773: 
                    774: 
                    775:     <tr>
                    776:              <td valign="top">rmap(seed;a,b,c,d;w,x,y,z)</td>
1.7       ng        777:              <td valign="top">Option 1 - &amp;rmap($seed,[\$w,\$x,\$y,\$z],[$a,$b,$c,$d]) or <br> 
                    778:                   Option 2 - &amp;rmap($seed,\@rmappedArray,[$a,$b,$c,$d]) <br>
                    779:                   Option 3 - @rmapped_array = &amp;rmap($seed,[$a,$b,$c,$d]) <br>
                    780:                   Option 4 - ($w,$x,$y,$z) = &amp;rmap($seed,\@a) <br>
                    781:                   where $a='A'<br>
                    782:                         $b='B'<br>
                    783:                         $c='B'<br>
                    784:                         $d='B'<br>
                    785:                         $w, $x, $y, and $z are variables</td>
1.6       ng        786:              <td valign="top">The rmap functions does the reverse action of map if the same seed
                    787:                   is used in calling map and rmap. </td>
1.11      albertel  788:              <td valign="top">In CAPA, the arguments are divided into
                    789:              three groups separated by a semicolon ;. In LON-CAPA, the
                    790:              separation is done by using [] brackets (with create an
                    791:              unamed vector reference) or using an array @a. Note the
                    792:              backslash (\) before the arguments in the second and
                    793:              third groups (Which cause Perl to send to variable
                    794:              locations rather than the variable values, similar to a C
                    795:              pointer).</td>
1.6       ng        796:     </tr>
1.8       albertel  797:       
                    798:      <tr>
                    799:              <td valign="top">NOT IMPLEMENTED IN CAPA</td>
                    800:              <td valign="top">$a=&amp;xmlparse($string) </td>
                    801:              <td valign="top">Runs the internal parser over the
                    802: 	  argument parsing for display. <b>Warning</b> This will
                    803: 	  result in different strings in different targets. Don't use
                    804: 	  the results of this function as an answer.</td>
                    805:              <td valign="top">New to LON-CAPA</td>
                    806:     </tr>
1.6       ng        807: 
                    808:     <tr>
1.4       ng        809:              <td valign="top">tex(a,b), tex("a","b")</td>
                    810:              <td valign="top">&amp;tex($a,$b), &amp;tex("a","b")</td>
                    811:              <td valign="top">Returns a if the output mode is in tex otherwise
                    812:                   returns b</td>
                    813:              <td valign="top">&nbsp;</td>
                    814:     </tr>
                    815: 
                    816:     <tr>
                    817:              <td valign="top">var_in_tex(a)</td>
                    818:              <td valign="top">&amp;var_in_tex($a)</td>
                    819:              <td valign="top">Equivalent to tex("a","")</td>
                    820:              <td valign="top">&nbsp;</td>
                    821:     </tr>
                    822: 
                    823:     <tr>
                    824:              <td valign="top">to_string(x), to_string(x,y)</td>
                    825:              <td valign="top">&amp;to_string($x), &amp;to_string($x,$y)</td>
                    826:              <td valign="top">If x is an integer, returns a string. If x is real
                    827:                 than the output is a string with format given by y. For example, if x =
                    828:                 12.3456, &amp;to_string(x,".3F") = 12.345 and &amp;to_string(x,".3E") =
                    829:                 1.234E+01.</td>
                    830:              <td valign="top">&nbsp;</td>
                    831:     </tr>
                    832: 
                    833:     <tr>
                    834:              <td valign="top">capa_id(), class(), section(), set(), problem()</td>
                    835:              <td valign="top">&amp;class(), &amp;section()</td>
                    836:              <td valign="top">Returns null string, class descriptive name, section
                    837:                     number, set number and null string.</td>
                    838:              <td valign="top">capa_id(), set() and problem() are no longer used.
                    839:                     Currently, they return a null value.</td>
                    840:     </tr>
                    841: 
                    842:     <tr>
                    843:              <td valign="top">name(), student_number()</td>
                    844:              <td valign="top">&amp;name(), &amp;student_number()</td>
                    845:              <td valign="top">Return the full name in the following format: lastname,
                    846:                     firstname initial. Student_number returns the student 9-alphanumeric string.
                    847:                     If undefined, the functions return null.</td>
                    848:              <td valign="top">&nbsp;</td>
                    849:     </tr>
                    850: 
                    851:     <tr>
                    852:              <td valign="top">open_date(), due_date(), answer_date()</td>
                    853:              <td valign="top">&amp;open_date(), &amp;due_date(), &amp;answer_date()</td>
                    854:              <td valign="top">Problem open date, due date and answer date. The
                    855:                     time is also included in 24-hr format.</td>
                    856:              <td valign="top">Output format for time is changed slightly. If pass
                    857:                     noon, it displays ..pm else it displays ..am. So 23:59 is displayed as
                    858:                     11:59 pm.</td>
                    859:     </tr>
                    860: 
                    861:     <tr>
                    862:              <td valign="top">get_seed(), set_seed()</td>
                    863:              <td valign="top">Not implemented</td>
                    864:              <td valign="top">Get and set the random seed.</td>
                    865:              <td valign="top">&nbsp;</td>
                    866:     </tr>
                    867: 
                    868:     <tr>
                    869:              <td valign="top">sub_string(a,b,c)</td>
                    870:              <td valign="top">&amp;sub_string($a,$b,$c) <br>perl&nbsp; substr function. 
                    871:                  However, note the differences</td>
                    872:              <td valign="top">Retrieve a portion of string a starting from b and
                    873:                     length c. For example,&nbsp; $a = "Welcome to LON-CAPA"; 
                    874:                     $result=&amp;sub_string($a,4,4); then $result is "come"</td>
                    875:              <td valign="top">Perl intrinsic function, substr(string,b,c) starts
                    876:                     counting from 0 (as opposed to 1). In the example to the left, substr($a,4,4)
                    877:                     returns "ome ".</td>
                    878:     </tr>
                    879: 
                    880:     <tr>
                    881:              <td valign="top">array[xx]</td>
                    882:              <td valign="top">@arrayname <br>Array is intrinsic in perl. 
                    883:                  To access a specific element use $arrayname[$n] where $n 
                    884:                  is the $n+1 element since the array count starts from 0</td>
                    885:              <td valign="top">"xx" can be a variable or a calculation.</td>
                    886:              <td valign="top">In LON-CAPA, an array is defined by @arrayname.
                    887:                   It is not necessary to specify the dimension of the array.&nbsp;</td>
                    888:     </tr>
                    889: 
                    890:     <tr>
                    891:              <td valign="top">array_moments(B,A)</td>
                    892:              <td valign="top">@B=&amp;array_moments(@A)</td>
                    893:              <td valign="top">Evaluates the moments of an array A and place the
                    894:                   result in array B[i] where i = 0 to 4. The contents of B are as follows:
                    895:                   B[0] = number of elements, B[1] = mean, B[2] = variance, B[3] = skewness
                    896:                   and B[4] = kurtosis.</td>
1.5       ng        897:              <td valign="top">In CAPA, the moments are passed as an array in the first argument whereas
                    898:                   in LON-CAPA, the array containing the moments are set equal to the function.</td>
1.4       ng        899:     </tr>
                    900: 
                    901:     <tr>
                    902:              <td valign="top">array_max(Name), array_min(Name)</td>
                    903:              <td valign="top">&amp;min(@Name), &amp;max(@Name)</td>
                    904:              <td valign="top">In LON-CAPA to find the maximum value of an array, use
                    905:                    &amp;max(@arrayname)&nbsp; and to find the minimum value of an array, use
                    906:                    &amp;min(@arrayname)</td>
                    907:              <td valign="top">Combined with the min and max functions defined
                    908:                 earlier.</td>
                    909:     </tr>
                    910: 
                    911:     <tr>
                    912:              <td valign="top">init_array(Name)</td>
                    913:              <td valign="top">undef @name</td>
                    914:              <td valign="top">To destroy the contents of an array, use</td>
                    915:              <td valign="top">Use perl intrinsic undef function.</td>
                    916:     </tr>
1.5       ng        917:      <tr>
                    918:              <td valign="top">random_normal (return_array,item_cnt,seed,av,std_dev)</td>
                    919:              <td valign="top">@return_array=&random_normal ($item_cnt,$seed,$av,$std_dev)</td>
                    920:              <td valign="top">Generate $item_cnt deviates of normal distribution of average $av and
                    921:                         standard deviation $std_dev. The distribution is generated from seed $seed</td>
                    922:              <td valign="top">In CAPA the results are passed as the first argument whereas in LON-CAPA 
                    923:                         the results are set equal to the function.</td>
                    924:     </tr>
                    925:      <tr>
                    926:              <td valign="top">random_beta (return_array,item_cnt,seed,aa,bb)</td>
                    927:              <td valign="top">@return_array=&random_beta ($item_cnt,$seed,$aa,$bb) <br>
                    928:                         NOTE: Both $aa and $bb MUST be greater than 1.0E-37.</td>
                    929:              <td valign="top">Generate $item_cnt deviates of beta distribution. 
                    930:                         The density of beta is:
                    931:                         X^($aa-1) *(1-X)^($bb-1) /B($aa,$bb) for 0&lt;X&lt;1.</td>
                    932:              <td valign="top">In CAPA the results are passed as the first argument whereas in LON-CAPA 
                    933:                         the results are set equal to the function.</td>
                    934:     </tr>
                    935:      <tr>
                    936:              <td valign="top">random_gamma (return_array,item_cnt,seed,a,r)</td>
                    937:              <td valign="top">@return_array=&random_gamma ($item_cnt,$seed,$a,$r) <br>
                    938:                         NOTE: Both $a and $r MUST be positive.</td>
                    939:              <td valign="top">Generate $item_cnt deviates of gamma distribution. 
                    940:                         The density of gamma is:
                    941:                         ($a**$r)/gamma($r) * X**($r-1) * exp(-$a*X).</td>
                    942:              <td valign="top">In CAPA the results are passed as the first argument whereas in LON-CAPA 
                    943:                         the results are set equal to the function.</td>
                    944:     </tr>
                    945:      <tr>
                    946:              <td valign="top">random_exponential (return_array,item_cnt,seed,av)</td>
                    947:              <td valign="top">@return_array=&random_exponential ($item_cnt,$seed,$av) <br>
                    948:                         NOTE: $av MUST be non-negative.</td>
                    949:              <td valign="top">Generate $item_cnt deviates of exponential distribution. </td>
                    950:              <td valign="top">In CAPA the results are passed as the first argument whereas in LON-CAPA 
                    951:                         the results are set equal to the function.</td>
                    952:     </tr>
                    953:      <tr>
                    954:              <td valign="top">random_poisson (return_array,item_cnt,seed,mu)</td>
                    955:              <td valign="top">@return_array=&random_poisson ($item_cnt,$seed,$mu) <br>
                    956:                         NOTE: $mu MUST be non-negative.</td>
                    957:              <td valign="top">Generate $item_cnt deviates of poisson distribution. </td>
                    958:              <td valign="top">In CAPA the results are passed as the first argument whereas in LON-CAPA 
                    959:                         the results are set equal to the function.</td>
                    960:     </tr>
                    961:      <tr>
                    962:              <td valign="top">random_chi (return_array,item_cnt,seed,df)</td>
                    963:              <td valign="top">@return_array=&random_chi ($item_cnt,$seed,$df) <br>
                    964:                         NOTE: $df MUST be positive.</td>
                    965:              <td valign="top">Generate $item_cnt deviates of chi_square distribution with $df 
                    966:                         degrees of freedom. </td>
                    967:              <td valign="top">In CAPA the results are passed as the first argument whereas in LON-CAPA 
                    968:                         the results are set equal to the function.</td>
                    969:     </tr>
                    970:      <tr>
                    971:              <td valign="top">random_noncentral_chi (return_array,item_cnt,seed,df,nonc)</td>
                    972:              <td valign="top">@return_array=&random_noncentral_chi ($item_cnt,$seed,$df,$nonc) <br>
                    973:                         NOTE: $df MUST be at least 1 and $nonc MUST be non-negative.</td>
                    974:              <td valign="top">Generate $item_cnt deviates of noncentral_chi_square 
                    975:                         distribution with $df 
                    976:                         degrees of freedom and noncentrality parameter $nonc. </td>
                    977:              <td valign="top">In CAPA the results are passed as the first argument whereas in LON-CAPA 
                    978:                         the results are set equal to the function.</td>
                    979:     </tr>
                    980:      <tr>
                    981:              <td valign="top">NOT IMPLEMENTED IN CAPA</td>
                    982:              <td valign="top">@return_array=&random_f ($item_cnt,$seed,$dfn,$dfd) <br>
                    983:                         NOTE: Both $dfn and $dfd MUST be positive.</td>
                    984:              <td valign="top">Generate $item_cnt deviates of F (variance ratio) distribution with  
                    985:                         degrees of freedom $dfn (numerator) and $dfd (denominator). </td>
                    986:              <td valign="top">New to LON-CAPA</td>
                    987:     </tr>
                    988:      <tr>
                    989:              <td valign="top">NOT IMPLEMENTED IN CAPA</td>
                    990:              <td valign="top">@return_array=&random_noncentral_f ($item_cnt,$seed,$dfn,$dfd,$nonc) <br>
                    991:                         NOTE: $dfn must be at least 1, $dfd MUST be positive, and $nonc must
                    992:                         be non-negative.</td>
                    993:              <td valign="top">Generate $item_cnt deviates of noncentral F (variance ratio) 
                    994:                         distribution with degrees of freedom $dfn (numerator) and $dfd (denominator).
                    995:                         $nonc is the noncentrality parameter. </td>
                    996:              <td valign="top">New to LON-CAPA</td>
                    997:     </tr>
                    998:      <tr>
1.9       ng        999:              <td valign="top">NOT DOCUMENTED IN CAPA</td>
                   1000:              <td valign="top">@return_array=&random_multivariate_normal ($item_cnt,$seed,\@mean,\@covar) <br>
                   1001:                         NOTE: @mean should be of length p array of real numbers. @covar should be a length
                   1002:                         p array of references to length p arrays of real numbers (i.e. a p by p matrix.</td>
1.5       ng       1003:              <td valign="top">Generate $item_cnt deviates of multivariate_normal distribution with  
                   1004:                         mean vector @mean and variance-covariance matrix. </td>
1.9       ng       1005:              <td valign="top">Note the backslash before the @mean and @covar arrays.</td>
1.5       ng       1006:     </tr>
                   1007:      <tr>
                   1008:              <td valign="top">NOT IMPLEMENTED IN CAPA</td>
                   1009:              <td valign="top">@return_array=&random_multinomial ($item_cnt,$seed,@p) <br>
                   1010:                         NOTE: $item_cnt is rounded with int() and the result must be non-negative. 
                   1011:                         The number of elements in @p must be at least 2.</td>
                   1012:              <td valign="top">Returns single observation from multinomial distribution with  
                   1013:                         $item_cnt events classified into as many categories as the length of @p.
                   1014:                         The probability of an event being classified into category i is given by 
                   1015:                         ith element of @p. The observation is an array with length equal to @p, so
                   1016:                         when called in a scalar context it returns the length of @p. The sum of the
                   1017:                         elements of the obervation is equal to $item_cnt.</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_permutation ($item_cnt,@array) </td>
                   1023:              <td valign="top">Returns @array randomly permuted.</td>
                   1024:              <td valign="top">New to LON-CAPA</td>
                   1025:     </tr>
                   1026:      <tr>
                   1027:              <td valign="top">NOT IMPLEMENTED IN CAPA</td>
                   1028:              <td valign="top">@return_array=&random_uniform ($item_cnt,$seed,$low,$high) <br>
                   1029:                         NOTE: $low must be less than or equal to $high.</td>
                   1030:              <td valign="top">Generate $item_cnt deviates from a uniform distribution. </td>
                   1031:              <td valign="top">New to LON-CAPA</td>
                   1032:     </tr>
                   1033:      <tr>
                   1034:              <td valign="top">NOT IMPLEMENTED IN CAPA</td>
                   1035:              <td valign="top">@return_array=&random_uniform_integer ($item_cnt,$seed,$low,$high) <br>
                   1036:                         NOTE: $low and $high are both passed through int().
                   1037:                               $low must be less than or equal to $high.</td>
                   1038:              <td valign="top">Generate $item_cnt deviates from a uniform distribution in integers. </td>
                   1039:              <td valign="top">New to LON-CAPA</td>
                   1040:     </tr>
                   1041:      <tr>
                   1042:              <td valign="top">NOT IMPLEMENTED IN CAPA</td>
                   1043:              <td valign="top">@return_array=&random_binomial ($item_cnt,$seed,$nt,$p) <br>
                   1044:                         NOTE: $nt is rounded using int() and the result must be non-negative. 
                   1045:                               $p must be between 0 and 1 inclusive.</td>
                   1046:              <td valign="top">Generate $item_cnt deviates from the binomial distribution with
                   1047:                         $nt trials and the probabilty of an event in each trial is $p. </td>
                   1048:              <td valign="top">New to LON-CAPA</td>
                   1049:     </tr>
                   1050:      <tr>
                   1051:              <td valign="top">NOT IMPLEMENTED IN CAPA</td>
                   1052:              <td valign="top">@return_array=&random_negative_binomial ($item_cnt,$seed,$ne,$p) <br>
                   1053:                         NOTE: $ne is rounded using int() and the result must be positive. 
                   1054:                               $p must be between 0 and 1 exclusive.</td>
                   1055:              <td valign="top">Generate an array of $item_cnt outcomes generated from 
                   1056:                         negative binomial distribution with
                   1057:                         $ne events and the probabilty of an event in each trial is $p. </td>
                   1058:              <td valign="top">New to LON-CAPA</td>
1.4       ng       1059:     </tr>
1.5       ng       1060:  </table>
                   1061: <!-- insertion ends -->
1.4       ng       1062: 
1.1       albertel 1063:     <h2>&lt;script&gt; Variables</h2>
                   1064:     <ul>
                   1065:       <li>
                   1066: 	$external::target - set to the current target the xml parser
                   1067: 	is parsing for
                   1068:       </li>
                   1069:       <li>
                   1070: 	$external::part - set to the <i>id</i> of the current problem
1.14      albertel 1071: 	&lt;part&gt;; zero if there are no &lt;part&gt;
1.1       albertel 1072:       </li>
                   1073:       <li>
                   1074: 	$external::gradestatus - set to the value of the current
                   1075: 	resource.partid.solved value
                   1076:       </li>
                   1077:       <li>
                   1078: 	$external::datestatus - set to the current status of the clock
1.14      albertel 1079: 	either CLOSED, CAN_ANSWER, CANNOT_ANSWER, SHOW_ANSWER, or UNCHECKEDOUT
1.1       albertel 1080:       </li>
                   1081:       <li>
                   1082: 	$external::randomseed - set to the number that was used to
                   1083: 	seed the random number generator
                   1084:       </li>
                   1085:       <li>$pi - set to PI </li>
1.3       ng       1086:       <li>$rad2deg - converts radians to degrees </li>
                   1087:       <li>$deg2rad - converts degrees to radians </li>
1.1       albertel 1088:     </ul>
1.14      albertel 1089: 
                   1090:     <h2> Form internals </h2>
                   1091:     <p> Form elements used for homework editing/response </p>
                   1092:     <p> the form is named lonhomework </p>
                   1093:     <h3> Viewing a problem (either CSTR or RES space)</h3>
                   1094:     <ul>
                   1095:       <li>
                   1096: 	grade_target, grade_username, grade_domain, grade_symb - the
                   1097: 	vaules take precedence over the the normal ENV settings of
                   1098: 	these, use &Apache::lonxml::whichuser() to get back the
                   1099: 	correct vaues of the items
                   1100:       </li>
                   1101:       <li>
                   1102: 	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
                   1103:       </li>
                   1104:       <li>
                   1105: 	changerandseed - the 'Change' button, only exists right after
                   1106: 	the Change button is clicked
                   1107:       </li>
                   1108:       <li>
                   1109: 	problemmode - in CSTR, it is either 'View','Edit','EditXML' or
                   1110: 	'Analyze' depending on the desired view
                   1111:       </li>
                   1112:       <li>
                   1113: 	rndseed - the currently requested random seed
                   1114:       </li>
                   1115:       <li>
                   1116: 	showallfoils - if it exists, and we are in CSTR space, the
                   1117: 	problem should ignore &lt;conceptgroup&gt; and the response's
                   1118: 	max setting and show all possible foils
                   1119:       </li>
                   1120:       <li>
                   1121: 	submit - the name of the Submit button
                   1122:       </li>
                   1123:       <li>
                   1124: 	submitted - a hidden form parameter that can be used to tell
                   1125: 	if the student has submitted answers or not, if it is set,
                   1126: 	there should be answers to grade.
                   1127:       </li>
                   1128:     </ul>
                   1129:     <h3> Editing a problem (Edit mode)</h3>
                   1130:     <p> tagdepth referes to the current value of the xmlparsers tagdepth couter ($Apache::lonxml::currentdepth)</p>
                   1131: <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>
                   1132:     <ul>
                   1133:       <li>
                   1134: 	tagdepth_argname - I.E. 1_3.max, a parameter editing value,
                   1135: 	max is the name of the parameter and it is for the third tag
                   1136: 	inside the first tag
                   1137:       </li>
                   1138:       <li>
                   1139: 	delete_tagdepth - if set to yes, delete tag tagdepth and all
                   1140: 	tags inside of it
                   1141:       </li>
                   1142:       <li>
                   1143: 	homework_edit_tagdepth - used by both &Apache::edit::editline
                   1144: 	and &Apache::edit::editfield for the &lt;textarea&gt; and
                   1145: 	&lt;input&gt; form elements they create
                   1146:       </li>
                   1147:       <li>
                   1148: 	insert_tagdepth - used to request an tag insert, it is set to
                   1149: 	the id number of the requested tag in the
                   1150: 	%Apache::lonxml::insertlist
                   1151:     </ul>
1.1       albertel 1152:     <hr>
                   1153:     <address><a href="mailto:albertel@marvin.lite.msu.edu">Guy Albertelli</a></address>
                   1154: <!-- Created: Thu May 17 15:05:35 EDT 2001 -->
                   1155: <!-- hhmts start -->
1.18    ! albertel 1156: Last modified: Fri Jul 12 18:59:29 EDT 2002
1.1       albertel 1157: <!-- hhmts end -->
                   1158:   </body>
                   1159: </html>

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