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