File:  [LON-CAPA] / loncom / html / adm / help / tex / Calling_Functions.tex
Revision 1.7: download - view: text, annotated - select for diffs
Fri Jul 5 18:30:40 2013 UTC (11 years, 1 month ago) by lira
Branches: MAIN
CVS tags: version_2_12_X, version_2_11_X, version_2_11_5_msu, version_2_11_5, version_2_11_4_uiuc, version_2_11_4_msu, version_2_11_4, version_2_11_3_uiuc, version_2_11_3_msu, version_2_11_3, version_2_11_2_uiuc, version_2_11_2_msu, version_2_11_2_educog, version_2_11_2, version_2_11_1, version_2_11_0_RC3, version_2_11_0_RC2, version_2_11_0, HEAD
cleanup and formatting with a few clarifications

    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 in the Script section 
    8: \ref{Script_Functions} and LON-CAPA function section \ref{Problem_LON-CAPA_Functions}.
    9: 
   10: For now, let's just look at some simple examples.
   11: 
   12: %
   13: \begin{figure}
   14: \$a~=~-3.0;
   15: 
   16: \$b~=~\&sin(\$a);
   17: 
   18: \$c~=~\&pow(3.0,~\&abs(\$a));
   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 above.
   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>