# Specifying Functions in Gnuplot

In 2D plots, the variable to use is x, in 3D plots, use x and y.

Multiplication is denoted by *, and division by /. Exponents are denoted by**, and all multiplication must be explicit. That is, 3x would generate and error, you would want to use 3*x.

For example, the polynomial 3x4 + 4x - 2/3 would be the following in Gnuplot:

• 3*x**4 + 4*x - 2/3
Gnuplot also has a number of predefined functions. These are called by putting the arguments in parenthesis, i.e., sin(x). These include the following:
• The standard trig functions, sin, cos, and tan Note, to use the constant pi can be referenced by just using pi.
• The inverse trig functions , asin, acos, and atan.
• The hyperbolic trig functions, sinh, cosh, and tanh.
• The exp and log function. exp raises e to the power of its argument. For example, 4e2x would be 4*exp(2*x) in Gnuplot. log returns the natural log (base e) of it's argument. This corresponds to ln in normal math notation.
• For information on other functions, type help functions in Gnuplot.
The following are other examples of functions. Make sure you understand what functions are being described.
• (x**2 - 4)/(x +2)
• x**2 + y**2 - (x*y)**(2/3)
• log(exp(x)) (Hint, this simplifies to x)
• sin(x*y)
• 3*x**2 + 6/(1*y**2)