Annotation of loncom/html/adm/help/tex/Spreadsheet_Functions.tex, revision 1.11

1.2       bowersj2    1: \label{Spreadsheet_Functions}
1.4       matthew     2: The following special functions are available in the spreadsheet.
1.10      lira        3: Please see \textbf{Referencing Cells} (\ref{Spreadsheet_Referencing_Cells})
1.4       matthew     4: for information on specifying cells and ranges.
1.1       bowersj2    5: 
                      6: \begin{itemize}
                      7: 
                      8: \item \texttt{\&NUM(range)} - number of non-empty cells in range
1.3       bowersj2    9: \index{NUM}
1.1       bowersj2   10: 
                     11: \item \texttt{\&BIN(low, high, range)} - number of non-empty cells in
                     12:   range with values between low and high
1.3       bowersj2   13: \index{BIN}
1.1       bowersj2   14: 
                     15: \item \texttt{\&SUM(range)} - sum of the non-empty cells in range
1.3       bowersj2   16: \index{SUM}
1.1       bowersj2   17: 
                     18: \item \texttt{\&MEAN(range)} - mean value of non-empty cells in range
1.3       bowersj2   19: \index{MEAN}
1.1       bowersj2   20: 
                     21: \item \texttt{\&STDDEV(range)} - standard deviation of non-empty cells
                     22:   in range 
1.3       bowersj2   23: \index{STDDEV}
1.1       bowersj2   24: 
                     25: \item \texttt{\&PROD(range)} - product of non-empty cells in range
1.3       bowersj2   26: \index{PROD}
1.1       bowersj2   27: 
                     28: \item \texttt{\&MAX(range)} - maximum value of non-empty cell in range
1.3       bowersj2   29: \index{MAX}
1.1       bowersj2   30: 
                     31: \item \texttt{\&MIN(range)} - minimum value of non-empty cells in
                     32:   range 
1.3       bowersj2   33: \index{MIN}
1.1       bowersj2   34: 
1.9       riegler    35: \item \texttt{\&SUMMAX(n ,range)} - sum of the maximum $n$ non-empty
1.1       bowersj2   36:   cells in range
1.3       bowersj2   37: \index{SUMMAX}
1.1       bowersj2   38: 
1.9       riegler    39: \item \texttt{\&SUMMIN(n, range)} - sum of the minimum $n$ non-empty
1.1       bowersj2   40:   cells in range
1.3       bowersj2   41: \index{SUMMIN}
1.1       bowersj2   42: 
1.6       matthew    43: \item \texttt{\&EXT(expression)} - access to EXT function in lonnet.
1.10      lira       44: Use \texttt{\&EXT(`system.time')} to retrieve the current time.
1.3       bowersj2   45: \index{EXT}
1.1       bowersj2   46: 
1.8       albertel   47: \item \texttt{\&PARM(parameter)} - get the value of a specific parameter 
                     48: \index{PARM}
                     49: 
                     50: \item \texttt{\&MINPARM(expression)} - get the value of a parameter that 
                     51: matches the expression that is the smallest in value (If one specified 
                     52: 'opendate' it would return the smallest opendate set on the problem.)
                     53: \index{MINPARM}
                     54: 
                     55: \item \texttt{\&MAXPARM(expression)} -  get the value of a parameter that 
                     56: matches the expression that is the largest in value (If one specified 
1.9       riegler    57: 'opendate' it would return the largest opendate set on the problem.)
1.8       albertel   58: \index{MAXPARM}
                     59: 
1.5       matthew    60: \item \texttt{\&SUMSEQ(column,sequence1,sequence2,sequence3,...)} -
1.8       albertel   61: sum the given column across the folders or sequences listed.
1.5       matthew    62: 
                     63: When specifying a sequence use the full title.  Instead of a sequence title
1.9       riegler    64: the word \texttt{all} can be used to sum over all sequences.  Regular expressions
                     65: can be entered as well, if prefixed by \texttt{regexp:}.  See below for examples.
1.5       matthew    66: 
                     67: \begin{itemize}
                     68: 
1.10      lira       69: \item \texttt{\&SUMSEQ(`Z',`Chapter 1');}
1.5       matthew    70: 
1.10      lira       71: \item \texttt{\&SUMSEQ(`Z',`Chapter 1',`Chapter 2',`Chapter 3');}
1.5       matthew    72: 
1.10      lira       73: \item \texttt{\&SUMSEQ(`Z',`all');} - sum over all sequences.
1.5       matthew    74: 
1.10      lira       75: \item \texttt{\&SUMSEQ(`Z',`regexp:Large Biomolecules');} -
1.5       matthew    76:  sum over all sequences which match the regular expression 
                     77: /Large Biomolecules/.
                     78: 
                     79: \end{itemize}
                     80: 
1.1       bowersj2   81: \end{itemize}
                     82: 
1.10      lira       83: \noindent
                     84: In addition, most non-IO Perl functions work in cells. Perl offers a compact \texttt{if} structure using the logic
1.11    ! lira       85: \texttt{TEST\char`_EXPR?IF\char`_TRUE\char`_EXPR\char`:IF\char`_FALSE\char`_EXPR;}. The \texttt{if} statements can be nested. Suppose that students are to receive full credit for a correct answer on the first attempt, 3/4 credit for a correct answer on two attempts, and half credit for a correct answer on more than two attempts. To scale the points awarded on the assessment spreadsheet (by default in \texttt{Z0}) with the number of tries (by default in \texttt{C0}), the adjusted score can be programmed in an empty export cell in the Assessment Spreadsheet row 0, as illustrated by the following example:\\
1.10      lira       86: 
                     87: \noindent
                     88: \texttt{C0$>$2 ? (0.5*Z0) \char`: (C0$>$1 ? (0.75*Z0) \char`: Z0);}\\
                     89: 
                     90: \noindent
                     91: is equivalent to
                     92:  
                     93: \begin{verbatim}
                     94: if (C0 > 2) {
                     95:   $cellvalue = 0.5*Z0; 
                     96: } elsif (C0 > 1) {
                     97:   $cellvalue = 0.75*Z0;
                     98: } else {$cellvalue = Z0;}
                     99: $cellvalue;
                    100: \end{verbatim}
                    101: 
                    102: Use of parantheses is usually necessary in the compact \texttt{if} statement to assure correct precedence.

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