This page expalins what kind of functions you can enter in the java applets on these pages, and how to do it.

The functions are all functions of one or two varaibles, usually x, or x and y, but in every case this is specified on the applet page.

Use +, -, * and / to denote, respectively addition, subtraction, multiplication or division. You must explicity use * to denote multiolication. If you mean "x times y" and enter "xy" instead of "x*y", an exception will be thrown while parsing, and the error message "I encountered the unknown string "xy" where I was expecting a variable name" will be printed out in the java console.

So if you enter a function, and nothing happens, have your browser show the console; it will explain what the trouble was.

To enter powers, use "^" to put things in the exponent. For example, to enter

f(x,y) = xy3/2 + y2,

type

x*y^(1.5) + y^2

into the text field for f(x,y). You could also type in "x*y^(3/2) + y^2" but this will be slower because the division 3/2 = 1.5 will be done each time the function is evaluated, and floating point divisions are slow. (You'd be unlikely to notice the difference in such a simple case, but it is good to get in the habit of avoiding divisions when working with computers...)

Anyway, this is enough to enter any polynomial function in one or two variables. Examples of such:

For x2 + y2 -1, type x^2 + y^2 - 1 .

For 3xy2 - y/x, type 3*x*y^2 - y/x . Also, "white space" is ignored, so "x^2+y^2-1" yields the same as "x^2 + y^2 - 1" -- its just harder to read.

You use parentheses in the usual way to indicate the priority of operations: For example,

To get (x2 + 1)/(x4 + 1), type (x^2+1)/(x^4 + 1) . If you have unmatched parenteses in your expession, the parser will stop parsing, and prinyt out an error message telling you so on the console.

There are also a number of built in functions that you can use. In this case, square braces [ ] must be used to indicate the argument. For example, to get sin(x2) type sin[x^2]. To get sin2(x) though, type (sin[x])^2. The parser treats whatever it sees before an [ ... ] as a function name, and it looks in its list of known functions. It finds "sin" there, but not "sin^2". On the other hand, it is pretty forgiving about capitalization and names; it also accepts "Sin", "SIN" "sinus", "Sine", and aything else, in whatever case, as long as the first three letters are "sin". The same flexibility is built in with the other functions.

The full list of recognized functions is:

  • abs[ ] -- the absolute value function. That is, to get |x|, type abs[x].
  • arccos[ ] -- the arccosine function.
  • arcsin[ ] -- the arcsine function.
  • arctan[ ] -- the arctangent function.
  • cos[ ] -- the cosine function.
  • exp[ ] -- the exponential function.
  • hev[ ] -- the Heaviside function; hev[x] = 0 for x < 0, and hev[x] = 1 for all other x; i.e., all non-negative x.
  • log[ ] -- the natural logarithm function.
  • sgn[ ] -- the sign function; sgn[0] = 0, sgn[x] = x/|x| otherwise.
  • sin[ ] -- the sine function.
  • tan[ ] -- the tangent function.
  • For example, to enter e(x2 + y2)/(1 + x2), type

    exp[x^2 + y^2]/(1 + x^2) or exp[x^2 + y^2]*(1 + x^2)^(-1)

    Please e-mail me if you have any questions.

    THIS PAGE IS NOT A PUBLICATION OF THE GEORGIA
    INSTITUTE OF TECHNOLOGY AND THE GEORGIA INSTITUTE
    OF TECHNOLOGY HAS NOT HAS NOT EDITED OR EXAMINED
    THE CONTENT. THE AUTHOR OF THE PAGE IS SOLELY
    RESPONSIBLE FOR THE CONTENT.
    
    


    Return to Eric Carlen's home page

    Eric A. Carlen (send message)