File:  [LON-CAPA] / loncom / html / adm / help / tex / CAPA_LON-CAPA_function_diffs.tex
Revision 1.7: download - view: text, annotated - select for diffs
Fri Mar 21 00:10:34 2008 UTC (16 years, 3 months ago) by www
Branches: MAIN
CVS tags: version_2_9_X, version_2_9_99_0, version_2_9_1, version_2_9_0, version_2_8_X, version_2_8_99_1, version_2_8_99_0, version_2_8_2, version_2_8_1, version_2_8_0, version_2_7_X, version_2_7_99_1, version_2_7_99_0, version_2_7_1, version_2_7_0, version_2_6_X, version_2_6_99_1, version_2_6_99_0, version_2_6_3, version_2_10_0_RC2, version_2_10_0_RC1, version_2_10_0, bz6209-base, bz6209, bz5969, bz2851, PRINT_INCOMPLETE_base, PRINT_INCOMPLETE, HEAD, GCI_3, GCI_2, GCI_1, BZ5971-printing-apage, BZ5434-fox
LaTeX syntax

\label{CAPA_LON-CAPA_function_diffs}

\begin{longtable}{|p{5cm}|p{6.5cm}|p{5.5cm}|}
\hline 
\textbf{CAPA Functions }
 &\textbf{LON-CAPA }
 &\textbf{Differences (if any) }
 \endhead
 \hline 
sin(x), cos(x), tan(x)  & \&sin(\$x), \&cos(\$x), \&tan(\$x)  &   \\ 

 \hline 
asin(x), acos(x), atan(x), atan2(y,x)  & \&asin(\$x), \&acos(\$x), \&atan(\$x), \&atan2(\$y,\$x)  &   \\ 

 \hline 
log(x), log10(x)  & \&log(\$x), \&log10(\$x)  &   \\ 

 \hline 
exp(x), pow(x,y), sqrt(x)  & \&exp(\$x), \&pow(\$x,\$y), \&sqrt(\$x)  &   \\ 

 \hline 
abs(x), sgn(x)  & \&abs(\$x), \&sgn(\$x)  &   \\ 

 \hline 
erf(x), erfc(x)  & \&erf(\$x), \&erfc(\$x)  &   \\ 

 \hline 
ceil(x), floor(x)  & \&ceil(\$x), \&floor(\$x)  &   \\ 

 \hline 
min(...), max(...)  & \&min(...), \&max(...)  &   \\ 

 \hline 
factorial(n)  & \&factorial(\$n)  &   \\ 

 \hline 
N\%M  & \$N\%\$M  &   \\ 

 \hline 
sinh(x), cosh(x), tanh(x)  & \&sinh(\$x), \&cosh(\$x), \&tanh(\$x)  &   \\ 

 \hline 
asinh(x), acosh(x), atanh(x)  & \&asinh(\$x), \&acosh(\$x), \&atanh(\$x)  &   \\ 

 \hline 
/DIS(\$x,''nn'')  & \&format(\$x,'nn')  &  The difference is obvious. \\ 

 \hline 
Not in CAPA  & \&prettyprint(\$x,'nn','optional target')  &   \\ 

 \hline 
Not in CAPA  & \&dollarformat(\$x,'optional target')  &   \\ 

 \hline 
Not in CAPA  & \&languages(@desired\_languages)  &   \\ 

 \hline 
roundto(x,n)  & \&roundto(\$x,\$n)  &   \\ 

 \hline 
Not in CAPA  & \&cas(\$s,\$e)  &   \\ 

 \hline 
Not in CAPA  & \&implicit\_multiplication(\$f)  &   \\ 

 \hline 
web(``a'',''b'',''c'') or web(a,b,c)  & \&web(``a'',''b'',''c'') or \&web(\$a,\$b,\$c)  &   \\ 

 \hline 
html(``a'') or html(a)  & \&html(``a'') or \&html(\$a)  &   \\ 

 \hline 
jn(m,x)  & \&j0(\$x), \&j1(\$x), \&jn(\$m,\$x), \&jv(\$y,\$x)  & 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) is new to LON-CAPA. \\ 

 \hline 
yn(m,x)  & \&y0(\$x), \&y1(\$x), \&yn(\$m,\$x), \&yv(\$y,\$x)  & 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) is new to LON-CAPA. \\ 

 \hline 
random(l,u,d)  & \&random(\$l,\$u,\$d)  & In CAPA, all the 3 arguments must be of the same type. However, now you can mix the type \\ 

 \hline 
choose(i,...)  & \&choose(\$i,...)  &   \\ 

 \hline 
/MAP(seed;w,x,y,z;a,b,c,d)  & \parbox{6.49cm}{
Option 1 - \&map(\$seed,[$\backslash$\$w,$\backslash$\$x,$\backslash$\$y,$\backslash$\$z],[\$a,\$b,\$c,\$d]) or \\
 Option 2 - \&map(\$seed,$\backslash$@mappedArray,[\$a,\$b,\$c,\$d]) \\
 Option 3 - @mappedArray = \&map(\$seed,[\$a,\$b,\$c,\$d]) \\
 Option 4 - (\$w,\$x,\$y,\$z) = \&map(\$seed,$\backslash$@a) \\
 where \$a='A'\\
 \$b='B'\\
 \$c='B'\\ 
 \$d='B'\\ 
 \$w, \$x, \$y, and \$z are variables } & 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 ($\backslash$) before the arguments in the second and third groups. \\ 

 \hline 
rmap(seed;a,b,c,d;w,x,y,z)  & \parbox{6.49cm}{Option 1 - \&rmap(\$seed,[$\backslash$\$w,$\backslash$\$x,$\backslash$\$y,$\backslash$\$z],[\$a,\$b,\$c,\$d]) or \\ 
 Option 2 - \&rmap(\$seed,$\backslash$@rmappedArray,[\$a,\$b,\$c,\$d]) \\
 Option 3 - @rmapped\_array = \&rmap(\$seed,[\$a,\$b,\$c,\$d]) \\
 Option 4 - (\$w,\$x,\$y,\$z) = \&rmap(\$seed,$\backslash$@a) \\
 where \$a='A'\\
 \$b='B'\\
 \$c='B'\\ 
 \$d='B'\\ 
 \$w, \$x, \$y, and \$z are variables }  & 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 ($\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). \\ 

 \hline 
NOT IMPLEMENTED IN CAPA  & \$a=\&xmlparse(\$string)   & New to LON-CAPA \\ 

 \hline 
tex(a,b), tex(``a'',''b'')  & \&tex(\$a,\$b), \&tex(``a'',''b'')  &   \\ 

 \hline 
var\_in\_tex(a)  & \&var\_in\_tex(\$a)  &   \\ 

 \hline 
to\_string(x), to\_string(x,y)  & \&to\_string(\$x), \&to\_string(\$x,\$y)  &   \\ 

 \hline 
capa\_id(), class(), section(), set(), problem()  & \&class(), \&section()  & capa\_id(), set() and problem() are no longer used. Currently, they return a null value. \\ 

 \hline 
name(), student\_number()  & \&name(), \&student\_number()  &   \\ 

 \hline 
open\_date(), due\_date(), answer\_date()  & \&open\_date(), \&due\_date(), \&answer\_date()  & Output format for time is changed slightly. If pass noon, it displays ..pm else it displays ..am. So 23:59 is displayed as 11:59 pm. \\ 

 \hline 
get\_seed(), set\_seed()  & Not implemented  &   \\ 

 \hline 
sub\_string(a,b,c)  & \&sub\_string(\$a,\$b,\$c)
perl  substr function. However, note the differences  & Perl intrinsic function, substr(string,b,c) starts counting from 0 (as opposed to 1). In the example to the left, substr(\$a,4,4) returns ``ome ``. \\ 

 \hline 
array[xx]  & @arrayname 
Array is intrinsic in perl. To access a specific element use \$arrayname[\$n] where \$n is the \$n+1 element since the array count starts from 0  & In LON-CAPA, an array is defined by @arrayname. It is not necessary to specify the dimension of the array.  \\ 

 \hline 
array\_moments(B,A)  & @B=\&array\_moments(@A)  & 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. \\ 

 \hline 
array\_max(Name), array\_min(Name)  & \&min(@Name), \&max(@Name)  & Combined with the min and max functions defined earlier. \\ 

 \hline 
init\_array(Name)  & undef @name  & Use perl intrinsic undef function. \\ 

 \hline 
random\_normal (return\_array,item\_cnt,seed,av,std\_dev)  & @return\_array=\&random\_normal (\$item\_cnt,\$seed,\$av,\$std\_dev)  & In CAPA the results are passed as the first argument whereas in LON-CAPA the results are set equal to the function. \\ 

 \hline 
random\_beta (return\_array,item\_cnt,seed,aa,bb)  & @return\_array=\&random\_beta (\$item\_cnt,\$seed,\$aa,\$bb) 
 NOTE: Both \$aa and \$bb MUST be greater than 1.0E-37.  & In CAPA the results are passed as the first argument whereas in LON-CAPA the results are set equal to the function. \\ 

 \hline 
random\_gamma (return\_array,item\_cnt,seed,a,r)  & @return\_array=\&random\_gamma (\$item\_cnt,\$seed,\$a,\$r) 
 NOTE: Both \$a and \$r MUST be positive.  & In CAPA the results are passed as the first argument whereas in LON-CAPA the results are set equal to the function. \\ 

 \hline 
random\_exponential (return\_array,item\_cnt,seed,av)  & @return\_array=\&random\_exponential (\$item\_cnt,\$seed,\$av) 
 NOTE: \$av MUST be non-negative.  & In CAPA the results are passed as the first argument whereas in LON-CAPA the results are set equal to the function. \\ 

 \hline 
random\_poisson (return\_array,item\_cnt,seed,mu)  & @return\_array=\&random\_poisson (\$item\_cnt,\$seed,\$mu) 
 NOTE: \$mu MUST be non-negative.  & In CAPA the results are passed as the first argument whereas in LON-CAPA the results are set equal to the function. \\ 

 \hline 
random\_chi (return\_array,item\_cnt,seed,df)  & @return\_array=\&random\_chi (\$item\_cnt,\$seed,\$df)  
 NOTE: \$df MUST be positive.  & In CAPA the results are passed as the first argument whereas in LON-CAPA the results are set equal to the function. \\ 

 \hline 
random\_noncentral\_chi (return\_array,item\_cnt,seed,df,nonc)  & @return\_array=\&random\_noncentral\_chi (\$item\_cnt,\$seed,\$df,\$nonc) 
 NOTE: \$df MUST be at least 1 and \$nonc MUST be non-negative.  & In CAPA the results are passed as the first argument whereas in LON-CAPA the results are set equal to the function. \\ 

 \hline 
NOT IMPLEMENTED IN CAPA  & @return\_array=\&random\_f (\$item\_cnt,\$seed,\$dfn,\$dfd) 
 NOTE: Both \$dfn and \$dfd MUST be positive.  & New to LON-CAPA \\ 

 \hline 
NOT IMPLEMENTED IN CAPA  & @return\_array=\&random\_noncentral\_f (\$item\_cnt,\$seed,\$dfn,\$dfd,\$nonc) 
 NOTE: \$dfn must be at least 1, \$dfd MUST be positive, and \$nonc must be non-negative.  & New to LON-CAPA \\ 

 \hline 
NOT DOCUMENTED IN CAPA  & @return\_array=\&random\_multivariate\_normal (\$item\_cnt,\$seed,$\backslash$@mean,$\backslash$@covar) 
 NOTE: @mean should be of length p array of real numbers. @covar should be a length p array of references to length p arrays of real numbers (i.e. a p by p matrix.  & Note the backslash before the @mean and @covar arrays. \\ 

 \hline 
NOT IMPLEMENTED IN CAPA  & @return\_array=\&random\_multinomial (\$item\_cnt,\$seed,@p) 
 NOTE: \$item\_cnt is rounded with int() and the result must be non-negative. The number of elements in @p must be at least 2.  & New to LON-CAPA \\ 

 \hline 
NOT IMPLEMENTED IN CAPA  & @return\_array=\&random\_permutation (\$seed,@array)   & New to LON-CAPA \\ 

 \hline 
NOT IMPLEMENTED IN CAPA  & @return\_array=\&random\_uniform (\$item\_cnt,\$seed,\$low,\$high) 
 NOTE: \$low must be less than or equal to \$high.  & New to LON-CAPA \\ 

 \hline 
NOT IMPLEMENTED IN CAPA  & @return\_array=\&random\_uniform\_integer (\$item\_cnt,\$seed,\$low,\$high) 
 NOTE: \$low and \$high are both passed through int(). \$low must be less than or equal to \$high.  & New to LON-CAPA \\ 

 \hline 
NOT IMPLEMENTED IN CAPA  & @return\_array=\&random\_binomial (\$item\_cnt,\$seed,\$nt,\$p) 
 NOTE: \$nt is rounded using int() and the result must be non-negative. \$p must be between 0 and 1 inclusive.  & New to LON-CAPA \\ 

 \hline 
NOT IMPLEMENTED IN CAPA  & @return\_array=\&random\_negative\_binomial (\$item\_cnt,\$seed,\$ne,\$p) 
 NOTE: \$ne is rounded using int() and the result must be positive. \$p must be between 0 and 1 exclusive.  & New to LON-CAPA \\
\hline

\end{longtable}


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