# Inputting Functions

If you have Khoros set up correctly on your machine, then typing in `xprism2` should bring up the following window (Figure 1). Since we have not specified a function, `xprism2` gives us an enchanting view of a black square. On the left of the void there is a button marked . Click on the Plot button, and you will find a whole new window (Figure 2) opening just for you, which includes the methods of inputting a function.

## Inputting a Function from a File

Notice that Figure 2 opens with the Input File option already highlighted. To input a file, you must enter in the path name, and the entire pathname to the file. Remember that Khoros is working from its own home directory, wherever that may be, so you must redirect the path. You must have the mouse positioned in the box where you are typing the path name, or it will not be entered. Then click on the button to bring up the graph. Figure 3 shows the window with the path, entered in red, to the text file ``` test2.text```

What should be in the text file? Since we are plotting a two-dimensional function, you must write the function in terms of one variable, namely x. For multiplication, use the `*' symbol, for exponentiation, use `**', for division use `/', and for addition and subtraction use `+' and `-'. You may also add the domain and the number of tick marks in the file. For example, if you wish x to range from to 3.14 with 40 tick marks for the function f(x) = sin(x) · cos(x) + x² , then the text file would read as

``` f(x) = sin(x)*cos(x) + x**2 x=(-pi, 3.14,40) ```.

Once this has been done (successfully), you should get a graph that resembles the following:

Figure 4 -- test2.text plot

## Inputting a Function from the Screen

If you wish to start from scratch, and make up functions as you go, then you have the option of running `xprism2` and creating functions while within the program. From Figure 2, choose the button. In Figure 5 , you will see the Input Function window with the function sin(x²)-2cos(x) in red entered in the Function f(x) = box. (Notice that we must use the same symbols for multiplication and exponentiation that we used in the From a File section: `*' for multiplication and `**' for exponents.)
Once you click on the button ,the resulting graph should resemble Figure 6 below.

Figure 6 - Plot of sin(x²)-2cos(x)