--- doc/homework/homework5.html 2001/06/01 14:17:04 1.4 +++ doc/homework/homework5.html 2002/06/06 08:24:55 1.16 @@ -4,7 +4,7 @@
+ <externalresponse> implements the ability to have
+ an external program grade a response, expects either a
+ <textline> or <textfield> inside the tag.
+
+ The response of the remote server needs to be in XML as follows. +
++<loncapagrade> + <awardetail> +CORRECT + </awardetail> + <message> +A message to be shown to the students + </message> +</loncapagrade> ++
+ <randomlabel bgimg="URL" width="12" height="45" texwidth="50"> + <labelgroup name="GroupOne" type="image"> + <location x="123" y="456" value="10" /> + <location x="321" y="654" value="20" /> + <location x="213" y="546" value="13" /> + <label description="TEXT-1">IMG-URL</label> + <label description="TEXT-2">IMG-URL</label> + <label description="TEXT-3">IMG-URL</label> + </labelgroup> + <labelgroup name="GroupTwo" type="text"> + <location x="12" y="45" /> + <location x="32" y="65" /> + <location x="21" y="54" /> + <label>TEXT-1</label> + <label>TEXT-2</label> + <label>TEXT-3</label> + </labelgroup> + </randomlabel> ++ Arguments: +
- These tags allow the document to behave programatically -
-+ These tags allow the document to behave programatically +
+A list of functions that have been written that are available in - the Safe space scripting environment inside a problem. The eventual - goal is to provide all of the functions available in CAPA. Detailed - descriptions of each function and comparison with CAPA is given in - CAPA to LON-CAPA Functions. + the Safe space scripting environment inside a problem.
+ Detailed descriptions of each function and comparison with CAPA. +
Differences (if any) | ||||
sin(x), cos(x), tan(x) | -&sin($x), &cos($x), &tan($x) | -Trigonometric functions where x is in radians. $x - can be a pure number, i.e., you can call &sin(3.1415) | -  | -|
sin(x), cos(x), tan(x) | &sin($x), &cos($x), &tan($x) | @@ -454,6 +663,20 @@|||
/DIS($x,"nn") | +&format($x,"nn") | +Display or format $x as nn where nn is nF or nE and n is an integer. | +The difference is obvious. | +|
Not in CAPA | +&prettyprint($x,"nn") | +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 | ++ | |
roundto(x,n) | &roundto($x,$n) | Rounds a real number to n decimal points. $x and @@ -485,7 +708,7 @@ y is real. $x can be a pure number. $m must be an integer and can be a pure integer number. $y can be a pure real number | In CAPA, j0, j1 and jn are contained in one function, - jn(m,x) where m takes the value of 0, 1 or 2. jv(y,x) was not implemented | + jn(m,x) where m takes the value of 0, 1 or 2. jv(y,x) is new to LON-CAPA.|
In CAPA, y0, y1 and yn are contained in one function, - yn(m,x) where m takes the value of 0, 1 or 2. yv(y,x) was not implemented | + yn(m,x) where m takes the value of 0, 1 or 2. yv(y,x) is new to LON-CAPA.||||
/MAP(seed;w,x,y,z;a,b,c,d) | +Option 1 - &map($seed,[\$w,\$x,\$y,\$z],[$a,$b,$c,$d]) or + Option 2 - &map($seed,\@mappedArray,[$a,$b,$c,$d]) + Option 3 - @mappedArray = &map($seed,[$a,$b,$c,$d]) + Option 4 - ($w,$x,$y,$z) = &map($seed,\@a) + where $a='A' + $b='B' + $c='B' + $d='B' + $w, $x, $y, and $z are variables |
+ Assigns to the variables $w, $x, $y and $z the values of the + $a, $b, $c and $c (A, B, C and D). The precise value for $w .. depends + on the seed. (Option 1 of calling map). + In option 2, the values of $a, $b .. are mapped into the array, @mappedArray. The two + options illustrate the different grouping. Options 3 and 4 give a consistent + way (with other functions) of mapping the items. For each option, the group can + be passed as an array, for example, [$a,$b,$c,$d] => \@a. | +In CAPA, the arguments are divided into three groups separated + by a semicolon ;. In LON-CAPA, the separation is done by using [] brackets or + using an array @a. Note the backslash (\) before the arguments in the + second and third groups. | +|
rmap(seed;a,b,c,d;w,x,y,z) | +Option 1 - &rmap($seed,[\$w,\$x,\$y,\$z],[$a,$b,$c,$d]) or + Option 2 - &rmap($seed,\@rmappedArray,[$a,$b,$c,$d]) + Option 3 - @rmapped_array = &rmap($seed,[$a,$b,$c,$d]) + Option 4 - ($w,$x,$y,$z) = &rmap($seed,\@a) + where $a='A' + $b='B' + $c='B' + $d='B' + $w, $x, $y, and $z are variables |
+ The rmap functions does the reverse action of map if the same seed + is used in calling map and rmap. | +In CAPA, the arguments are divided into + three groups separated by a semicolon ;. In LON-CAPA, the + separation is done by using [] brackets (with create an + unamed vector reference) or using an array @a. Note the + backslash (\) before the arguments in the second and + third groups (Which cause Perl to send to variable + locations rather than the variable values, similar to a C + pointer). | +|
NOT IMPLEMENTED IN CAPA | +$a=&xmlparse($string) | +Runs the internal parser over the + argument parsing for display. Warning This will + result in different strings in different targets. Don't use + the results of this function as an answer. | +New to LON-CAPA | +|
tex(a,b), tex("a","b") | &tex($a,$b), &tex("a","b") | Returns a if the output mode is in tex otherwise @@ -607,7 +888,8 @@ result in array B[i] where i = 0 to 4. The contents of B are as follows: B[0] = number of elements, B[1] = mean, B[2] = variance, B[3] = skewness and B[4] = kurtosis. | -+ | In CAPA, the moments are passed as an array in the first argument whereas + in LON-CAPA, the array containing the moments are set equal to the function. |
To destroy the contents of an array, use | Use perl intrinsic undef function. | |||
random_norma(...), random_beta(...), random_gamma(...), - random_exponential(...), random_poisson(...), random_chi(...), random_noncentral(...) | -Not yet implemented. | -- | + | |
random_normal (return_array,item_cnt,seed,av,std_dev) | +@return_array=&random_normal ($item_cnt,$seed,$av,$std_dev) | +Generate $item_cnt deviates of normal distribution of average $av and + standard deviation $std_dev. The distribution is generated from seed $seed | +In CAPA the results are passed as the first argument whereas in LON-CAPA + the results are set equal to the function. |
Form elements used for homework editing/response
+the form is named lonhomework
+tagdepth referes to the current value of the xmlparsers tagdepth couter ($Apache::lonxml::currentdepth)
+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
+