Function grapher manual

Table of contents

  1. Syntax
  2. Higher order operations
  3. Constants
  4. Elementary special functions
  5. Exponentiation and logarithms
  6. Trigonometric functions and related
  7. Gamma function and related
  8. Antiderivatives
  9. Elliptic integrals and related
  10. Polynomial functions
  11. Utility functions
  12. Input examples

Syntax

Syntax Math Explanation
a+b, a-b a+b, a−b Addition, subtraction.
a*b, a/b a⋅b, a/b Multiplication, division.
a^n an Exponentiation.
n! n! Factorial.
abs(x) |x| Absolute value.
a:=b a:=b Assignment.
f(x):=2x f(x):=2x Function definition.
f(x,y):=x*y f(x,y):=x⋅y Function definition.
x.2x x ↦ 2x Lambda expression.
(x,y).x*y (x,y) ↦ x⋅y Lambda expression.
f'(a) f'(a) Derivative of f at a.
f''(a) f''(a) Second derivative of f at a.
if(a,x,y) x if a else y Conditional expression.
a&b a∧b Conjunction: a and b.
a|b a∨b Disjunction: a or b.
a<b, a>b a<b, a>b Comparison.
a<=b, a>=b a≤b, a≥b Comparison.

Higher order operations

Function Math Explanation
diff(x.f(x),a) df(x)/dx|x=a Derivative of f at a.
diff(x.f(x),a,n) (d/dx)n f(x)|x=a The n-th derivative of f at a.
sum(a,b,k.f(k)) k∈[a,b] f(k) Sum.
prod(a,b,k.f(k)) k∈[a,b] f(k) Product.
int(a,b,x.f(x)) [a,b] f(x) dx Definite integral.
inv(f,x,a,b) (f|[a,b])−1(x) Inverse function of f restricted to [a,b].
pow(f,n,x) fn(x) The n-th iterate of f.

Constants

Constant Explanation
pi Half length of the unit circle.
tau Length of the unit circle.
e Base of the natural logarithm.
deg Degree unit: tau/360.
gon Gradian unit: tau/400.
gc Euler-Mascheroni constant (gamma constant).
nan Not a number.

Elementary special functions

Function Explanation
abs(x) Absolute value.
sgn(x) Signum.
floor(x) Rounded towards minus infinity.
ceil(x) Rounded towards plus infinity.
rd(x) Rounded towards zero.
frac(x) Fractional part.
div(x,y) Floor division.
mod(x,y) Floor division remainder.
diveuc(x,y) Euclidean division.
modeuc(x,y) Euclidean division remainder.
divtrunc(x,y) Truncating division.
modtrunc(x,y) Truncating division remainder.
max(x,y) Maximum.
min(x,y) Minimum.
hypot(x,y) Hypotenuse length: sqrt(x^2+y^2).
angle(x,y) Phase angle of coordinate vector (x,y).

Exponentiation and logarithms

Function Explanation
exp(x) Natural exponential function.
ln(x) Natural logarithm.
lg(x) Common logarithm.
ld(x) Binary logarithm.
lb(x) Binary logarithm.
log(x,b) Logarithm to base b.
sqrt(x) Square root.
root(n,x) n-th root.
W(x) Lambert W function, upper branch.
Wm1(x) Lambert W function, lower branch.

Trigonometric functions and related

Function Explanation
sin(x), cos(x), tan(x),
sec(x), csc(x), cot(x)
Trigonometric functions.
asin(x), acos(x),
atan(x), acot(x)
Inverse trigonometric functions.
sinh(x), cosh(x),
tanh(x), coth(x)
Hyperbolic functions.
asinh(x), acosh(x),
atanh(x), acoth(x)
Inverse hyperbolic functions.
sinc(x) Cardinal sine: sin(pi*x)/(pi*x).

Gamma function and related

Function Explanation
gamma(x) Gamma function Γ(x).
fac(x) Factorial function, i.e. gamma(x+1).
gamma(a,x) Lower incomplete gamma function γ(a,x).
Gamma(a,x) Upper incomplete gamma function Γ(a,x).
erf(x) Error function.
psi(x) Digamma function ψ(x).
psi(n,x) Polygamma function ψn(x).
zeta(x) Zeta function ζ(x).

Antiderivatives

Function Explanation
Ei(x) Exponential integral.
En(n,x) Exponential integral En(x).
li(x) Integral logarithm.
Li(x) Integral logarithm with offset li(2).

Elliptic integrals and related

Function Explanation
agm(x,y) Arithmetic-geometric mean.
E(m) Complete elliptic integral E(m), m=k2.
K(m) Complete elliptic integral K(m), m=k2.
E(phi,m) Elliptic integral E(φ,m), m=k2.
F(phi,m) Elliptic integral F(φ,m), m=k2.
Pi(phi,n,m) Elliptic integral Π(φ,n,m), m=k2.
RF(x,y,z) Carlson symmetric form RF(x,y,z).
RJ(x,y,z,p) Carlson symmetric form RJ(x,y,z,p).
RC(x,y) Carlson symmetric form RF(x,y,y).
RD(x,y,z) Carlson symmetric form RJ(x,y,z,z).

Polynomial functions

Function Explanation
PP(n,0,x) Legendre polynomial Pn(x).
PP(n,a,x) Associated legendre function Pn,a(x).
PL(n,0,x) Laguerre polynomial Ln(x).
PL(n,a,x) Associated Laguerre polynomial Ln,a(x).
PH(n,x) Hermite polynomial Hn(x).
PT(n,x) Chebyshev polynomial Tn(x).
PU(n,x) Chebyshev polynomial Un(x).

Utility functions

Function Explanation
rand() Random number from interval [0,1].
rand(a,b) Random number from interval [a,b].
rand(a) Randomly pick an element from list a.
rand(a:b) Randomly pick an element from [a,a+1,a+2,...,b].
rand(a:b:d) Randomly pick an element from [a,a+d,a+2d,...,b].
af(x0,y0,x1,y1) The affine function through (x0, y0) and (x1, y1).
Example: f:=af(2,1,6,2),f(x).
tg(f,a,x) Tangent line f(a)+f'(a)*(x-a).
sc(f,a,b,x) Secant line f(a)+(f(b)-f(a))/(b-a)*(x-a).
clamp(x,a,b) The same as min(max(x,a),b).
roots(f) Try to find the zeroes of f(x) for x∈[−100,100].
roots(f,a,b) Try to find the zeroes of f(x) for x∈[a,b].
map(f,a) Apply f to every element of list a.
Example: map(x.2x,1:10).
filter(p,a) The elements x in a that fulfill the predicate p.
Example: filter(k.mod(k,2)=1,1:10).

Input examples

sin(x)
An explicit function.
sin(x);scale(0.1),P(pi,0)
Draw a function at position P(x,y) and scale(dx,dy=dx).
sin(x);;scale(0.1),P(pi,0)
Everything after two semicolons is applied only once and then removed.
sin(x),cos(x),tan(x)
Many functions.
x^2-x^2=1
An implicit function.
x^2-x^2=1,x,-x
An implicit function and asymptotes.
f(x):=ln(x),f(x),f'(x)
A function and its derivative.
f(x):=sin(x),a:=2,f(x),f(a)+f'(a)*(x-a)
Tangent line to a function.
exp(x),sum(0,4,k.x^k/fac(k))
Partial sum of the exponential series.
int(0,10,t.t^(x-1)*exp(-t))
Gamma function via parameter integral.
[cos(t),sin(2t)/2]
A parametric curve.
t0:=0,t1:=10pi,[t/10*cos(t),t/10*sin(t)]
A parametric curve for given parameter domain.
r(t):=sin(5t)+4,[r(t)*cos(t),r(t)*sin(t)]
A star.
cos(sqrt(x^2+y^2))
A bivariate function.
[cos(u)sin(v),sin(u)sin(v),cos(v)]
A parametric surface.
[(R+r*cos(v))cos(u),(R+r*cos(v))sin(u),r*sin(v)];
R:=4,r:=2,v1:=2pi
A parametric torus.