Complex 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. 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(z) |z| Absolute value.
a:=b a:=b Assignment.
f(z):=2z f(z):=2z Function definition.
f(x,y):=x*y f(x,y):=x⋅y Function definition.
z.2z z ↦ 2z Lambda expression.
(x,y).x*y (x,y) ↦ x⋅y Lambda expression.
f'(a) f'(a) Complex 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(z.f(z),a) df(z)/dz|z=a Complex derivative of f at a.
diff(z.f(z),a,n) (d/dz)n f(z)|z=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],z.f(z)) γ f(z) dz Path integral, γ=line segment [a,b].
int([a,b,c],z.f(z)) γ f(z) dz Path integral, γ=[a,b]⊕[b,c].
int(p,z.f(z)) γ f(z) dz Path integral, γ=[p0,p1]⊕[p1,p2]⊕…
pow(f,n,z) fn(z) 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(z) Absolute value.
sgn(z) Signum, i.e. abs(z)/z.
floor(z) Re,Im: rounded towards minus infinity.
ceil(z) Re,Im: rounded towards plus infinity.
rd(z) Re,Im: rounded towards zero.
frac(z) Re,Im: fractional part.

Exponentiation and logarithms

Function Explanation
exp(z) Natural exponential function.
ln(z) Natural logarithm.
lg(z) Common logarithm.
ld(z) Binary logarithm.
lb(z) Binary logarithm.
log(z,b) Logarithm to base b.
sqrt(z) Square root.
root(n,z) n-th root.

Trigonometric functions and related

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

Gamma function and related

Function Explanation
gamma(z) Gamma function Γ(z).
fac(z) Factorial function, i.e. gamma(z+1).

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].
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(z)
A complex function.
sin(z);colorfn(3)
A complex function, different coloring method.