# Function Help

( <-- Back to the Function Graphing & Evaluation Utility )

The syntax for specifying mathematical expressions representing functions in this tool is similar to that of various programming languages and command-line based math applications, and is composed of the variable x, constant symbols, numbers, operators, and functions. Here is an example of an expression you can enter in the function text box:

`( 3*sin[pi*x/2]^2 + 1/(x^2+1) )/5 + e^(1-x*0.1)`

You may group operations together within parentheses, nested to any level. Function input is case insensitive, so you may capitalize or not capitalize x, constant symbols, or function names as desired. All whitespace and newlines are ignored, as well as any text enclosed within c-style comments "/* */" (example: /* this is a comment */), so feel free to use multiple lines, indent lines, insert comments or comment out portions of your function, etc.

Expressions can evaluate to either a real number between -1e200 and 1e200, or to "NaN", i.e. "Not a Number". For example, both 1/x and ln[x] will evaluate to NaN for x=0.

### Operators

The following operators are supported:

 -a Negation - result is negative a. a + b Addition - result is a plus b. a - b Subtraction - result is a minus b. a * b Multiplication - result is a times b. a / b Division - result is a divided by b. a ^ b Exponent - result is a raised to the bth power.

The relative precedence of the operators is as follows, from lowest to highest:

 + , - * , / ^ - (negation)

### Constant Symbols

The following symbols represent numerical constants & may be used within expressions:

 e Natural log base :  2.7182818284590452 pi Pi :  3.1415926535897932

### Functions

The following functions are available, and take one or more arguments. Arguments must be enclosed within square brackets ("[ ]"), and separated by a comma (",") when there are multiple arguments.

Real-valued functions:

 ln[a] Natural logarithm, or log base e, of a. Defined for all a>0. log2[a] Log base 2 of a. Defined for all a>0. log10[a] Log base 10 of a. Defined for all a>0. sqrt[a] Square root of a (equivalent to a^0.5). Defined for all a>=0. abs[a] Absolute value of a. sin[a] Sine of a, where a is an angle in radians. cos[a] Cosine of a, where a is an angle in radians. tan[a] Tangent of a, where a is an angle in radians. arcsin[a] Arcsine, or inverse sine, of a - evaluates to the angle (in radians) whose sine is a. Defined for all a within [-1,1]. arccos[a] Arccosine, or inverse cosine, of a - evaluates to the angle (in radians) whose cosine is a. Defined for all a within [-1,1]. arctan[a] Arctangent, or inverse tangent, of a - evaluates to the angle (in radians) whose tangent is a. sinh[a] Hyperbolic sine of a. cosh[a] Hyperbolic cosine of a. tanh[a] Hyperbolic tangent of a. floor[a] Rounds a down to the nearest integer. ceil[a] Rounds a up to the nearest integer. mod[a , b] Remainder of a divided by b. Defined for all b!=0. lngamma[a] Natural log of the gamma function value of a. Defined for all a>0.

Boolean functions:

These functions evaluate to 1 if true, 0 if false.

 is_eq[a , b] True if a is equal to b. is_neq[a , b] True if a is not equal to b. is_lt[a , b] True if a is less than b. is_lte[a , b] True if a is less than or equal to b. is_gt[a , b] True if a is greater than b. is_gte[a , b] True if a is greater than or equal to b. is_nan[a] True if a is NaN.

( <-- Back to the Function Graphing & Evaluation Utility )

sporkforge 