File:  [LON-CAPA] / loncom / html / adm / help / tex / Calling_Functions.tex
Revision 1.2: download - view: text, annotated - select for diffs
Thu Jul 18 15:52:27 2002 UTC (22 years, 1 month ago) by bowersj2
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, version_0_99_2, version_0_99_1, version_0_99_0, version_0_6_2, version_0_6, version_0_5_1, version_0_5, conference_2003, HEAD
Convenince labels added to the top of each file to assist in creating
index-type help files for things like the XML editor screen (where
there's nothing to hook help to).

    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 http://mileva.lite.msu.edu/loncapadocs/homework/homework5.html.
    8: For now, let's just look at some simple examples.
    9: 
   10: %
   11: \begin{figure}
   12: \begin{lyxcode}
   13: \$a~=~-3.0;
   14: 
   15: \$b~=~\&sin(\$a);
   16: 
   17: \$c~=~\&pow(3.0,~\&abs(\$a));
   18: \end{lyxcode}
   19: 
   20: \caption{Some Function Calls\label{Some Function Calls Figure}}
   21: \end{figure}
   22: In the \textbf{Script} block, function names start with \textbf{\&}. Some
   23: example function calls are shown in figure \ref{Some Function Calls Figure}.
   24: You can see that functions can take either variables, numbers, or the results
   25: of other function calls as parameters. The \texttt{\&sin} function returns
   26: the sine of an angle expressed in radians. \texttt{\&pow} raises the first
   27: parameter to the power of the second parameter. \texttt{\&abs} returns the
   28: absolute value of the argument.

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