Calculus Applets |
|
The calculus applets are all based on the Web Components for Mathematics library and developed with the Java programming language. A typical applet, for graphing a function, appears below.
Try the following:
Function Syntax: The syntax for the definition of a function is very similar to that found on common graphing calculators. Binary operators such as + (addition), - (subtraction), * (multiplication), / (division), and ^ (exponentiation) follow the standard rules for precedence. Operators at equal levels are performed left to right, and grouping parentheses are also supported. The following are the symbols and operations allowed in a function definition.
| +, -, *, / | The standard arithmetic binary operators.
Multiplication is implied if the * is left out (e.g., 2*x and 2x are
equivalent, but note that 2*3 is not the same as 23). Example:
2x-1 The – sign can also be used as negation, as in – ( x + 2 ). Use parentheses when an exponent has a - sign, as in e^(-1). |
| ( ) | Parentheses are used for grouping and also to delimit the arguments to a function. Examples: (x-2)/3 and sin(x) |
| x | The independent variable used in all function definitions (some applets support other variables, as noted on those pages) |
| ^ | Exponentiation binary operator. If the exponent is not an integer, the program checks whether it is a rational number. If the reduced denominator is even, or if the program cannot determine that the exponent is rational, then only the non-negative part of the domain is graphed. If it is rational and the reduced denominator is odd, then the negative part of the domain is also graphed. For example, x^(1/3) will graph a domain of all reals, while x^(pi) will only use non-negative reals. |
| ! | Factorial, as in x ! |
| e, pi | Built-in constants. |
Built-in Functions: The following built-in functions are provided:
| abs(x) | Absolute value |
| arccos(x) | Inverse cosine (radians) |
| arcsin(x) | Inverse sine (radians) |
| arctan(x) | Inverse tangent (radians) |
| ceiling(x) | The smallest (closest to negative infinity) real value that is greater than or equal to x and is equal to a mathematical integer. |
| cos(x) | Cosine (radians) |
| cosh(x) | Hyperbolic cosine |
| cot(x) | Cotangent (radians) |
| csc(x) | Cosecant (radians) |
| cubert(x) | Cube root |
| exp(x) | Exponential function (i.e., e^x) |
| floor(x) | The largest (closest to positive infinity) real value that is less than or equal to x and is equal to a mathematical integer. |
| ln(x) | Natural logarithm (base e) |
| log2(x) | Base 2 logarithm |
| log10(x) | Common logarithm (base 10) |
| round(x) | The closest integer to x |
| sec(x) | Secant (radians) |
| sin(x) | Sine (radians) |
| sinh(x) | Hyperbolic sine |
| sqrt(x) | Square root |
| tan(x) | Tangent (radians) |
| tanh(x) | Hyperbolic tangent |
| trunc(x) | Drop any digits after the decimal point |
Piecewise Functions: In addition, a special syntax is provided for conditional expressions, which enables you to graph piecewise functions. A conditional expression is an expression using the ? operator. An example is ((x > 0)? x : -x) which says: “if x is greater than 0, then the value is x, otherwise it is – x.” The part before the ? is the condition and compares two quantities using one of the comparison operators =, >, <, >=, <=, or <> (not equal). You can also write more complex expressions using & (the AND binary operator), | (the OR binary operator), and ~ (the NOT unary operator). The part between the ? and the : is the value if the condition is true and can be any valid expression (even another conditional expression). The part after the : is the value if the condition is false. Note that the parentheses surrounding the conditional expression are not required, but are recommended if the conditional expression is part of a larger expression. The false part (after the :) is optional. If it is not present, then when the condition is false the expression evaluates to “not a number,” which will cause nothing to be graphed for that domain value.
Background: These applets are built using the Web Components for Mathematics(WCM) library and the Java programming language. More information on WCM can be found at http://webcompmath.sourceforge.net/
This work by Thomas S. Downey is licensed under a Creative Commons Attribution 3.0 License.
| Prev | Home | Next |