IN104: Function Evaluator




This applet incorporates Steinar Foss' expression interpreter alogorithm. A DOS program, based on this algorithm (MA, 23K), as well as JavaScript, C (9K) and QuickBasic (8K) versions of this algorithm are also available.

The simplest way to use this applet is to enter a mathematical expression in the 'Arbitrary function' text-field and an appropriate value for x (optional), press 'Enter' in either field and read the answer in the text-box below. The following mathematical functions are supported: 'SIN' - sine, 'COS' - cosine, 'TAN' - tangent, 'ATAN' or 'ATN' - arc tangent, 'SQRT' or 'SQR' - square root, 'LOG' - nLogarithm (ln()), 'EXP' - exponent (e = 2.718281828459045), 'ABS' - absolute, 'PI' - (= 3.141592653589793).

Numbers in scientific format should be entered in the following fashion (the algorithm is case sensitive):
[+/-]12345E[+/-]123 | (-0.007) = (-7E-3) | 7000000 = 7E6

To calculate an nth power of x (xn) use symbol ^. E.g.: 15^3 = 153 = 3375.

You can use up to 150 nested parenthesis. Unrecognised characters and spaces will be ignored. Negative numbers should preferably be entered in parenthesis: (-85).

The program also accepts alternative, short, commands (S, C, T, N, R, L, e, A, P). For example, to calculate ABS(SIN(5) + (4 * 0.0007) - TAN(6 ^ 2)), you can alternatively enter A(S5+(4*7E-4)-T(6^2)).

Trigonometric functions use radians. To convert degrees to radians, multiply the degrees by PI/180. To convert from radians to degrees, multiply the radians by 180/PI.


Sources: