Annotation of loncom/html/adm/help/tex/CAPA_LON-CAPA_function_diffs.tex, revision 1.5
1.1 bowersj2 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
1.3 albertel 46: /DIS(\$x,''nn'') & \&format(\$x,'nn') & The difference is obvious. \\
1.1 bowersj2 47:
48: \hline
1.4 albertel 49: Not in CAPA & \&prettyprint(\$x,'nn','optional target') & \\
1.1 bowersj2 50:
51: \hline
1.4 albertel 52: Not in CAPA & \&dollarformat(\$x,'optional target') & \\
1.1 bowersj2 53:
54: \hline
1.5 ! albertel 55: Not in CAPA & \&languages(@desired\_languages) & \\
! 56:
! 57: \hline
1.1 bowersj2 58: roundto(x,n) & \&roundto(\$x,\$n) & \\
59:
60: \hline
61: web(``a'',''b'',''c'') or web(a,b,c) & \&web(``a'',''b'',''c'') or \&web(\$a,\$b,\$c) & \\
62:
63: \hline
64: html(``a'') or html(a) & \&html(``a'') or \&html(\$a) & \\
65:
66: \hline
67: 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. \\
68:
69: \hline
70: 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. \\
71:
72: \hline
73: 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 \\
74:
75: \hline
76: choose(i,...) & \&choose(\$i,...) & \\
77:
78: \hline
79: /MAP(seed;w,x,y,z;a,b,c,d) & \parbox{6.49cm}{
1.2 bowersj2 80: Option 1 - \&map(\$seed,[$\backslash$\$w,$\backslash$\$x,$\backslash$\$y,$\backslash$\$z],[\$a,\$b,\$c,\$d]) or \\
81: Option 2 - \&map(\$seed,$\backslash$@mappedArray,[\$a,\$b,\$c,\$d]) \\
82: Option 3 - @mappedArray = \&map(\$seed,[\$a,\$b,\$c,\$d]) \\
83: Option 4 - (\$w,\$x,\$y,\$z) = \&map(\$seed,$\backslash$@a) \\
84: where \$a='A'\\
85: \$b='B'\\
86: \$c='B'\\
87: \$d='B'\\
1.1 bowersj2 88: \$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. \\
89:
90: \hline
1.2 bowersj2 91: 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 \\
92: Option 2 - \&rmap(\$seed,$\backslash$@rmappedArray,[\$a,\$b,\$c,\$d]) \\
93: Option 3 - @rmapped\_array = \&rmap(\$seed,[\$a,\$b,\$c,\$d]) \\
94: Option 4 - (\$w,\$x,\$y,\$z) = \&rmap(\$seed,$\backslash$@a) \\
95: where \$a='A'\\
96: \$b='B'\\
97: \$c='B'\\
98: \$d='B'\\
1.1 bowersj2 99: \$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). \\
100:
101: \hline
102: NOT IMPLEMENTED IN CAPA & \$a=\&xmlparse(\$string) & New to LON-CAPA \\
103:
104: \hline
105: tex(a,b), tex(``a'',''b'') & \&tex(\$a,\$b), \&tex(``a'',''b'') & \\
106:
107: \hline
108: var\_in\_tex(a) & \&var\_in\_tex(\$a) & \\
109:
110: \hline
111: to\_string(x), to\_string(x,y) & \&to\_string(\$x), \&to\_string(\$x,\$y) & \\
112:
113: \hline
114: capa\_id(), class(), section(), set(), problem() & \&class(), \§ion() & capa\_id(), set() and problem() are no longer used. Currently, they return a null value. \\
115:
116: \hline
117: name(), student\_number() & \&name(), \&student\_number() & \\
118:
119: \hline
120: 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. \\
121:
122: \hline
123: get\_seed(), set\_seed() & Not implemented & \\
124:
125: \hline
126: sub\_string(a,b,c) & \&sub\_string(\$a,\$b,\$c)
127: 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 ``. \\
128:
129: \hline
130: array[xx] & @arrayname
131: 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. \\
132:
133: \hline
134: 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. \\
135:
136: \hline
137: array\_max(Name), array\_min(Name) & \&min(@Name), \&max(@Name) & Combined with the min and max functions defined earlier. \\
138:
139: \hline
140: init\_array(Name) & undef @name & Use perl intrinsic undef function. \\
141:
142: \hline
143: 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. \\
144:
145: \hline
146: random\_beta (return\_array,item\_cnt,seed,aa,bb) & @return\_array=\&random\_beta (\$item\_cnt,\$seed,\$aa,\$bb)
147: 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. \\
148:
149: \hline
150: random\_gamma (return\_array,item\_cnt,seed,a,r) & @return\_array=\&random\_gamma (\$item\_cnt,\$seed,\$a,\$r)
151: 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. \\
152:
153: \hline
154: random\_exponential (return\_array,item\_cnt,seed,av) & @return\_array=\&random\_exponential (\$item\_cnt,\$seed,\$av)
155: 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. \\
156:
157: \hline
158: random\_poisson (return\_array,item\_cnt,seed,mu) & @return\_array=\&random\_poisson (\$item\_cnt,\$seed,\$mu)
159: 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. \\
160:
161: \hline
162: random\_chi (return\_array,item\_cnt,seed,df) & @return\_array=\&random\_chi (\$item\_cnt,\$seed,\$df)
163: 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. \\
164:
165: \hline
166: random\_noncentral\_chi (return\_array,item\_cnt,seed,df,nonc) & @return\_array=\&random\_noncentral\_chi (\$item\_cnt,\$seed,\$df,\$nonc)
167: 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. \\
168:
169: \hline
170: NOT IMPLEMENTED IN CAPA & @return\_array=\&random\_f (\$item\_cnt,\$seed,\$dfn,\$dfd)
171: NOTE: Both \$dfn and \$dfd MUST be positive. & New to LON-CAPA \\
172:
173: \hline
174: NOT IMPLEMENTED IN CAPA & @return\_array=\&random\_noncentral\_f (\$item\_cnt,\$seed,\$dfn,\$dfd,\$nonc)
175: NOTE: \$dfn must be at least 1, \$dfd MUST be positive, and \$nonc must be non-negative. & New to LON-CAPA \\
176:
177: \hline
178: NOT DOCUMENTED IN CAPA & @return\_array=\&random\_multivariate\_normal (\$item\_cnt,\$seed,$\backslash$@mean,$\backslash$@covar)
179: 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. \\
180:
181: \hline
182: NOT IMPLEMENTED IN CAPA & @return\_array=\&random\_multinomial (\$item\_cnt,\$seed,@p)
183: 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 \\
184:
185: \hline
186: NOT IMPLEMENTED IN CAPA & @return\_array=\&random\_permutation (\$seed,@array) & New to LON-CAPA \\
187:
188: \hline
189: NOT IMPLEMENTED IN CAPA & @return\_array=\&random\_uniform (\$item\_cnt,\$seed,\$low,\$high)
190: NOTE: \$low must be less than or equal to \$high. & New to LON-CAPA \\
191:
192: \hline
193: NOT IMPLEMENTED IN CAPA & @return\_array=\&random\_uniform\_integer (\$item\_cnt,\$seed,\$low,\$high)
194: NOTE: \$low and \$high are both passed through int(). \$low must be less than or equal to \$high. & New to LON-CAPA \\
195:
196: \hline
197: NOT IMPLEMENTED IN CAPA & @return\_array=\&random\_binomial (\$item\_cnt,\$seed,\$nt,\$p)
198: 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 \\
199:
200: \hline
201: NOT IMPLEMENTED IN CAPA & @return\_array=\&random\_negative\_binomial (\$item\_cnt,\$seed,\$ne,\$p)
202: NOTE: \$ne is rounded using int() and the result must be positive. \$p must be between 0 and 1 exclusive. & New to LON-CAPA \\
203: \hline
204:
205: \end{longtable}
206:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>