File:  [LON-CAPA] / loncom / html / adm / help / tex / CAPA_LON-CAPA_function_diffs.tex
Revision 1.3: download - view: text, annotated - select for diffs
Fri Jun 27 14:20:01 2003 UTC (21 years ago) by albertel
Branches: MAIN
CVS tags: version_1_1_X, version_1_1_3, version_1_1_2, version_1_1_1, version_1_1_0, version_1_0_99_3, version_1_0_99_2, version_1_0_99_1, version_1_0_99, version_1_0_3, version_1_0_2, version_1_0_1, version_1_0_0, version_0_99_5, version_0_99_4, version_0_99_3, HEAD
- change " to ' in prettyprint/format calls
- add ) to dollarformat calls

    1: \label{CAPA_LON-CAPA_function_diffs}
    2: 
    3: \begin{longtable}{|p{5cm}|p{6.5cm}|p{5.5cm}|}
    4: \hline 
    5: \textbf{CAPA Functions }
    6:  &\textbf{LON-CAPA }
    7:  &\textbf{Differences (if any) }
    8:  \endhead
    9:  \hline 
   10: sin(x), cos(x), tan(x)  & \&sin(\$x), \&cos(\$x), \&tan(\$x)  &   \\ 
   11: 
   12:  \hline 
   13: asin(x), acos(x), atan(x), atan2(y,x)  & \&asin(\$x), \&acos(\$x), \&atan(\$x), \&atan2(\$y,\$x)  &   \\ 
   14: 
   15:  \hline 
   16: log(x), log10(x)  & \&log(\$x), \&log10(\$x)  &   \\ 
   17: 
   18:  \hline 
   19: exp(x), pow(x,y), sqrt(x)  & \&exp(\$x), \&pow(\$x,\$y), \&sqrt(\$x)  &   \\ 
   20: 
   21:  \hline 
   22: abs(x), sgn(x)  & \&abs(\$x), \&sgn(\$x)  &   \\ 
   23: 
   24:  \hline 
   25: erf(x), erfc(x)  & \&erf(\$x), \&erfc(\$x)  &   \\ 
   26: 
   27:  \hline 
   28: ceil(x), floor(x)  & \&ceil(\$x), \&floor(\$x)  &   \\ 
   29: 
   30:  \hline 
   31: min(...), max(...)  & \&min(...), \&max(...)  &   \\ 
   32: 
   33:  \hline 
   34: factorial(n)  & \&factorial(\$n)  &   \\ 
   35: 
   36:  \hline 
   37: N\%M  & \$N\%\$M  &   \\ 
   38: 
   39:  \hline 
   40: sinh(x), cosh(x), tanh(x)  & \&sinh(\$x), \&cosh(\$x), \&tanh(\$x)  &   \\ 
   41: 
   42:  \hline 
   43: asinh(x), acosh(x), atanh(x)  & \&asinh(\$x), \&acosh(\$x), \&atanh(\$x)  &   \\ 
   44: 
   45:  \hline 
   46: /DIS(\$x,''nn'')  & \&format(\$x,'nn')  &  The difference is obvious. \\ 
   47: 
   48:  \hline 
   49: Not in CAPA  & \&prettyprint(\$x,'nn')  &   \\ 
   50: 
   51:  \hline 
   52: Not in CAPA  & \&dollarformat(\$x)  &   \\ 
   53: 
   54:  \hline 
   55: roundto(x,n)  & \&roundto(\$x,\$n)  &   \\ 
   56: 
   57:  \hline 
   58: web(``a'',''b'',''c'') or web(a,b,c)  & \&web(``a'',''b'',''c'') or \&web(\$a,\$b,\$c)  &   \\ 
   59: 
   60:  \hline 
   61: html(``a'') or html(a)  & \&html(``a'') or \&html(\$a)  &   \\ 
   62: 
   63:  \hline 
   64: 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. \\ 
   65: 
   66:  \hline 
   67: 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. \\ 
   68: 
   69:  \hline 
   70: 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 \\ 
   71: 
   72:  \hline 
   73: choose(i,...)  & \&choose(\$i,...)  &   \\ 
   74: 
   75:  \hline 
   76: /MAP(seed;w,x,y,z;a,b,c,d)  & \parbox{6.49cm}{
   77: Option 1 - \&map(\$seed,[$\backslash$\$w,$\backslash$\$x,$\backslash$\$y,$\backslash$\$z],[\$a,\$b,\$c,\$d]) or \\
   78:  Option 2 - \&map(\$seed,$\backslash$@mappedArray,[\$a,\$b,\$c,\$d]) \\
   79:  Option 3 - @mappedArray = \&map(\$seed,[\$a,\$b,\$c,\$d]) \\
   80:  Option 4 - (\$w,\$x,\$y,\$z) = \&map(\$seed,$\backslash$@a) \\
   81:  where \$a='A'\\
   82:  \$b='B'\\
   83:  \$c='B'\\ 
   84:  \$d='B'\\ 
   85:  \$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. \\ 
   86: 
   87:  \hline 
   88: 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 \\ 
   89:  Option 2 - \&rmap(\$seed,$\backslash$@rmappedArray,[\$a,\$b,\$c,\$d]) \\
   90:  Option 3 - @rmapped\_array = \&rmap(\$seed,[\$a,\$b,\$c,\$d]) \\
   91:  Option 4 - (\$w,\$x,\$y,\$z) = \&rmap(\$seed,$\backslash$@a) \\
   92:  where \$a='A'\\
   93:  \$b='B'\\
   94:  \$c='B'\\ 
   95:  \$d='B'\\ 
   96:  \$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). \\ 
   97: 
   98:  \hline 
   99: NOT IMPLEMENTED IN CAPA  & \$a=\&xmlparse(\$string)   & New to LON-CAPA \\ 
  100: 
  101:  \hline 
  102: tex(a,b), tex(``a'',''b'')  & \&tex(\$a,\$b), \&tex(``a'',''b'')  &   \\ 
  103: 
  104:  \hline 
  105: var\_in\_tex(a)  & \&var\_in\_tex(\$a)  &   \\ 
  106: 
  107:  \hline 
  108: to\_string(x), to\_string(x,y)  & \&to\_string(\$x), \&to\_string(\$x,\$y)  &   \\ 
  109: 
  110:  \hline 
  111: capa\_id(), class(), section(), set(), problem()  & \&class(), \&section()  & capa\_id(), set() and problem() are no longer used. Currently, they return a null value. \\ 
  112: 
  113:  \hline 
  114: name(), student\_number()  & \&name(), \&student\_number()  &   \\ 
  115: 
  116:  \hline 
  117: 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. \\ 
  118: 
  119:  \hline 
  120: get\_seed(), set\_seed()  & Not implemented  &   \\ 
  121: 
  122:  \hline 
  123: sub\_string(a,b,c)  & \&sub\_string(\$a,\$b,\$c)
  124: 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 ``. \\ 
  125: 
  126:  \hline 
  127: array[xx]  & @arrayname 
  128: 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.  \\ 
  129: 
  130:  \hline 
  131: 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. \\ 
  132: 
  133:  \hline 
  134: array\_max(Name), array\_min(Name)  & \&min(@Name), \&max(@Name)  & Combined with the min and max functions defined earlier. \\ 
  135: 
  136:  \hline 
  137: init\_array(Name)  & undef @name  & Use perl intrinsic undef function. \\ 
  138: 
  139:  \hline 
  140: 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. \\ 
  141: 
  142:  \hline 
  143: random\_beta (return\_array,item\_cnt,seed,aa,bb)  & @return\_array=\&random\_beta (\$item\_cnt,\$seed,\$aa,\$bb) 
  144:  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. \\ 
  145: 
  146:  \hline 
  147: random\_gamma (return\_array,item\_cnt,seed,a,r)  & @return\_array=\&random\_gamma (\$item\_cnt,\$seed,\$a,\$r) 
  148:  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. \\ 
  149: 
  150:  \hline 
  151: random\_exponential (return\_array,item\_cnt,seed,av)  & @return\_array=\&random\_exponential (\$item\_cnt,\$seed,\$av) 
  152:  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. \\ 
  153: 
  154:  \hline 
  155: random\_poisson (return\_array,item\_cnt,seed,mu)  & @return\_array=\&random\_poisson (\$item\_cnt,\$seed,\$mu) 
  156:  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. \\ 
  157: 
  158:  \hline 
  159: random\_chi (return\_array,item\_cnt,seed,df)  & @return\_array=\&random\_chi (\$item\_cnt,\$seed,\$df)  
  160:  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. \\ 
  161: 
  162:  \hline 
  163: random\_noncentral\_chi (return\_array,item\_cnt,seed,df,nonc)  & @return\_array=\&random\_noncentral\_chi (\$item\_cnt,\$seed,\$df,\$nonc) 
  164:  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. \\ 
  165: 
  166:  \hline 
  167: NOT IMPLEMENTED IN CAPA  & @return\_array=\&random\_f (\$item\_cnt,\$seed,\$dfn,\$dfd) 
  168:  NOTE: Both \$dfn and \$dfd MUST be positive.  & New to LON-CAPA \\ 
  169: 
  170:  \hline 
  171: NOT IMPLEMENTED IN CAPA  & @return\_array=\&random\_noncentral\_f (\$item\_cnt,\$seed,\$dfn,\$dfd,\$nonc) 
  172:  NOTE: \$dfn must be at least 1, \$dfd MUST be positive, and \$nonc must be non-negative.  & New to LON-CAPA \\ 
  173: 
  174:  \hline 
  175: NOT DOCUMENTED IN CAPA  & @return\_array=\&random\_multivariate\_normal (\$item\_cnt,\$seed,$\backslash$@mean,$\backslash$@covar) 
  176:  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. \\ 
  177: 
  178:  \hline 
  179: NOT IMPLEMENTED IN CAPA  & @return\_array=\&random\_multinomial (\$item\_cnt,\$seed,@p) 
  180:  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 \\ 
  181: 
  182:  \hline 
  183: NOT IMPLEMENTED IN CAPA  & @return\_array=\&random\_permutation (\$seed,@array)   & New to LON-CAPA \\ 
  184: 
  185:  \hline 
  186: NOT IMPLEMENTED IN CAPA  & @return\_array=\&random\_uniform (\$item\_cnt,\$seed,\$low,\$high) 
  187:  NOTE: \$low must be less than or equal to \$high.  & New to LON-CAPA \\ 
  188: 
  189:  \hline 
  190: NOT IMPLEMENTED IN CAPA  & @return\_array=\&random\_uniform\_integer (\$item\_cnt,\$seed,\$low,\$high) 
  191:  NOTE: \$low and \$high are both passed through int(). \$low must be less than or equal to \$high.  & New to LON-CAPA \\ 
  192: 
  193:  \hline 
  194: NOT IMPLEMENTED IN CAPA  & @return\_array=\&random\_binomial (\$item\_cnt,\$seed,\$nt,\$p) 
  195:  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 \\ 
  196: 
  197:  \hline 
  198: NOT IMPLEMENTED IN CAPA  & @return\_array=\&random\_negative\_binomial (\$item\_cnt,\$seed,\$ne,\$p) 
  199:  NOTE: \$ne is rounded using int() and the result must be positive. \$p must be between 0 and 1 exclusive.  & New to LON-CAPA \\
  200: \hline
  201: 
  202: \end{longtable}
  203: 

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