Math Functions

The syntax for using math functions in C is practically identical to the syntax you use in Maple. To invoke a function, you write the name of the function followed by a list of arguments in parentheses. To call the sine function, for example, you write:


where the ``...'' is replaced with an expression that is the angle you want to take the sine of. The angle is measured in radians. Note that the value of the expression that you give to sin must be a floating-point number, not an integer.

Near the bottom of each of programs you'll see example uses of the sine and cosine functions. We will talk about other built-in math functions--and how you can write your own functions--in future lessons. For today you'll only need sine and cosine.

Eric N. Eide
Hamlet Project
Department of Computer Science
University of Utah