9

Expression Te chniques 149
To use a function in an expression, enter the name
of the func tion and appropriate arguments to it.
Trig on om e tric Functions
The sine, cosine, and tangent functions take an
angle in degrees and return a floating-point value.
Thearcfunctionstakeafloating-pointvalueand
return a value in degrees.
Funct i on M ea n ing
sin(p)
sine
cos(p)
cosine
tan(p)
tangent
asin(p)
arc sine
acos(p)
arc cosine
atan(p)
arc tangent
Hyperbolic Functio ns
H yperbolic functions take a floating-point value
and return a floating-p oint value.
Funct i on M ea n ing
sinh(p) hyperbolic sine
cosh(p) hyperbolic cosine
tanh(p) hyperbolic tangent
Conversion Be t wee n Radians an d Degrees
Funct i on M ea n ing
radToDeg(p) takes p in radians and
returns the same angle in
degrees
degToRad(p) takes p in degrees and
returns the same angle in
radians
Rounding Functions
Fu nction Meaning
ceil(p) smallest integer greater
than or equal to p
floor(p) largest integer less than or
equal to p
Standard Calculations
Fu nction Meaning
ln(p) natural (base e) logarithm
log(p) common (base 10)
logarithm
exp(p) exponential function
exp(p)=e^p
pow(p,q) p to the power of q (p^q)
sqrt(p)
square root
abs(p) absolute value
min(p,q)
minimum returns p or q,
depending on which is
smaller
max(p,q)
maximum returns p or q,
depending on which is
greater
mod(p,q) remainder of p divided by q
Conditional Functions
Fu nction Meaning
if(p,q,r) works like the common
spreadsheet "if" (If p is
nonzero then "if" returns q,
other w ise "if" returns r.)
vif(c,V1,V2) "Vector If" (Value is V1 if c is
true, else V2.)
Vec tor Handling Functions
Fu nction Meaning
length(V) length of V
comp(V,i) i’th component (I=0,1,2):
comp([5,6,7],1)=6
unit(V) returns a unit vector in the
same direction as V