In the following sections, unary means that the function takes one argument. Unless noted otherwise, unary functions have the general form Binary infix operations
function(x). Binary, tertiary, and multi-ary functions are natural extensions of this idea, each having two, three and more than two arguments respectively.
are functions which take two arguments on either side of the function name.
Constants & Variables
To GCalc, any consecutive string of alphabetic characters that isn't a function name is a variable name. GCalc 3 is case sensitive (unlike GCalc 2).
The most common variable name is
x, but you may have the occasion to use others, such as
r, or even
There are currently two reserved variables names
e, which represent the numbers 3.14159265... and 2.7182818..., respectively.
These are the 5 basic functions of arithmetic. Standard order of operations apply, i.e. Exponentiation, then multiplication and division, then addition and subtraction.
Exponentiation is right associative while the rest are left-associative. This means that
x^y^z is the same as
a+b+c is equivalent to
These are the trignometric functions (and their inverses) found in any self-respecting pre-calculus textbook. Angles are always expressed in radians.
These are the hyperbolic functions (and their inverses) found in any self-respecting calculus textbook.
These are unary functions which deal with the sign of the given argument. The expressions
neg(x) are equivalent way to express the negation of
x. The expression
abs(x) is the absolute value of
x. The expression
sgn(x) is 1 if
x>0, -1 if
x<0, and 0 if
sqrt is a unary function that evaluates the the square root of the argument.
root is a binary function that calculates the nth root. The general format is
root(x, n), where
n is an integer. This is preferred to
x^(1/n) since you'll notice that if
n is odd, the
x^(1/n) is undefined for negative
|Log base b|
exp is a unary function that evaluates the the exponential of the argument. It is equivalent to
ln are unary functions that evaluate the the common and natural logarithm of the argument.
logb(x,b) evaluates the logarithm base
x. It is mathematically equivalent to
ln(x) are equivalent to
Each of the three wave functions (
swwave) take three arguments. The general format is
t is a time function, 0<
d<1 is the duty cycle, and
T is the period. For example,
will produce the graph shown (Figure 1).
Each of the three pulse functions (
swpulse) take two arguments. The general format is
t is a time function. The pulse will 'turn on' at t=0 and 'turn off' at t=
a. For example,
4 trpulse(t+3,6) will produce the graph shown (Figure 2).
Step function is also known as the Heavyside function.
step(x) is 1 if
x is positive, and 0 otherwise.
Finally the stair function
stair(x,a) is 0 when
x is negative. There is a rise of 1 (starting at
x=0) and a run of
The rounding function,
floor are both unary functions which return a rounded value of the argument.
ceil(x) is the smallest (closest to negative infinity) integer that is not greater than
floor(x) is the largest (closest to positive infinity) integer that is not less than
Maximum and Minimum
min are multi-ary functions which respectively compute the maximum and minimum of the given parameters. For example
max(cos(x),sin(x)) will generate the graph shown (Figure 3). Both
min can take many inputs.
Sum and Product
prod are multi-ary functions which respectively compute the sum and product of the given parameters. For example
sum(1,-2x,x^2) is equivalent to
1-2x+x^2. Both these functions can take many inputs.
|Taylor Series Approximation|
diff has the format
diff(f,x), where the first argument is a multivariable function. Differentiation is always with respect to some variable, which is named in the other argument of
diff. One can also name multiple variables, to take multiple derivatives with respect to those variables. For example,
diff(x^2 y^2, x, y) will be the same as
int has the general format
f is a function of one variable,
x is variable of integration,
b are the lower and upper end point, respectively, and
tol is the tolerance of the numerical integration algorithm.
GCalc utilizes an adaptive Simpson's rule
algorithm for numerical integration. Be careful when integrating nonsmooth or discontinuous functions.
Given a function
f with independent variable
x, the taylor polynomial approximation of
f of degree
x0 can be found with
|Greater than or equal|
|Less than or equal|
These operations take two numbers and does a comparison. If the inequality or equality evaluates to true, then the operation returns
1. Otherwise, the operation returns a
NaN (Not A Number).
|Logical Negation ('not')|
These standard logical operation take inequalities or other boolean operations as arguments. The operation
not is unary, while
|| are (infix) binary. For example,
not(x>1 && x<=y)
is a valid expression.
Be sure to use parentheses with
not to minimize confusion about order of precedence.
case, one can define a piecewise function. The general format is
case(t1,v1,t2,v2,...,[default]). If the test
tN evaluates to true, then the function value is the value
vN at that point. At any given point, if multiple tests evaluate to true, then the function value is the value corresponding to the first test that evaluates to true. If no test evaluates to true, then either the function takes on the optional
default or is undefined.
case(x^2<=pi^2,sin(x),0) corresponds to the graph shown (Figure 4).