File:  [LON-CAPA] / loncom / html / adm / help / tex / Calling_Functions.tex
Revision 1.3: download - view: text, annotated - select for diffs
Mon May 10 14:27:33 2004 UTC (20 years, 2 months ago) by www
Branches: MAIN
CVS tags: version_1_3_X, version_1_3_3, version_1_3_2, version_1_3_1, version_1_3_0, version_1_2_X, version_1_2_99_1, version_1_2_99_0, version_1_2_1, version_1_2_0, version_1_1_99_5, version_1_1_99_4, version_1_1_99_3, version_1_1_99_2, version_1_1_99_1, version_1_1_99_0, HEAD
Typos

    1: \label{Calling_Functions}
    2: 
    3: With variables, you can store strings or numbers. \textbf{Functions} allow
    4: you to manipulate these strings or numbers. Functions work like mathematical
    5: functions: They take some number of arguments in, and return one argument,
    6: usually a number or a string for our purposes. There are a lot of functions
    7: available in LON-CAPA. You can see a complete list at
    8: \ref{all functions table}.
    9: 
   10: For now, let's just look at some simple examples.
   11: 
   12: %
   13: \begin{figure}
   14: \begin{lyxcode}
   15: \$a~=~-3.0;
   16: 
   17: \$b~=~\&sin(\$a);
   18: 
   19: \$c~=~\&pow(3.0,~\&abs(\$a));
   20: \end{lyxcode}
   21: 
   22: \caption{Some Function Calls\label{Some Function Calls Figure}}
   23: \end{figure}
   24: In the \textbf{Script} block, function names start with \textbf{\&}. Some
   25: example function calls are shown in figure \ref{Some Function Calls Figure}.
   26: You can see that functions can take either variables, numbers, or the results
   27: of other function calls as parameters. The \texttt{\&sin} function returns
   28: the sine of an angle expressed in radians. \texttt{\&pow} raises the first
   29: parameter to the power of the second parameter. \texttt{\&abs} returns the
   30: absolute value of the argument.

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