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

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

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