--- doc/homework/homework5.html 2001/06/01 14:17:04 1.4 +++ doc/homework/homework5.html 2002/03/28 22:55:35 1.13 @@ -4,7 +4,7 @@
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 +493,13 @@|||
/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. | +|
roundto(x,n) | &roundto($x,$n) | Rounds a real number to n decimal points. $x and @@ -485,7 +531,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 +711,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. |