# How To Draw Function Graphs (Mathematics / Analysis)

Empirical plotter for mathematical functions and calculus.

*Due to overload issues, the plotter can no longer display extremely computational intensive functions. like the gamma functions and those which use this. Those can still be found in the source code .*

With openPlaG mathematical function graphs can be drawn. Up to three graphs can be shown in one image. For this, input fields for three formulas are available. For the proper use of the plotter, it is advisable to activate JavaScript .

**Draw** plots the image of the graph, **Reset** sets all values back and **Standard** sets back display settings.

## Syntax

The formulas f(x), g(x) and h(x) can contain the following symbols:

**x** Function variable x

**0-9** Numbers, e.g. **123.45** Input values are hardly restricted (as long as you don't use numbers with more than 300 or so digits). The output value (result) at a non-log scale can only be up to 100000 (and -100000), this is also the maximum value for both axes.

Very large numbers can be written like **2.5E20** for 2.5*10 20. very small ones like **3E-10** for 3*10 -10. Decimal digits are exact up to a number of 12.

**.** Point or comma as decimal separator, e.g. **1.5** or **1,5**

**( ) [ ] < > < >** Brackets, e.g. **<[(1+x)/(2-x)+1]*3>/(2*x^2)**. are allowed in any amount. Each opened bracket must be closed again. What kind of bracket you use doesn't matter.

**#** as separator for formulas with multiple input values, e.g. **scir(x#2)**

**asy** Vertical asymptote for a given fixed value, e.g. **asy(1)** or **asy(e)**

**Q** Substitution for a self-defined formula.

#### - Basic arithmetic operations

**+** Plus, e.g. **x+1**

**-** Minus, e.g. **1-x**

***** Times, this can only be omitted, when standing between a number and a letter. E.g. you can write **2x** instead of **2*x**. but not xsin(x) or ex.

**/ :** Divided by, e.g. **1/x** or **1:x**

### Constants

**e** Euler's number: 2.718281828459

**pi** π. Pi: 3.1415926535898

**go** Relation of the golden ratio: 1.6180339887499

**d** Feigenbaum constant delta: 4.6692016091030

### Functions

Nested functions like **sin(pow(x#2/3))** or polynomials like **2*x^3-4*x^2+x+1** are no problem at all. Functions with multiple variables, like **norm**. can have the x at any one or at several positions. The standard position is shown in the examples.

### - Basic functions

**^** or **pow** Power, e.g. **x^2** or **pow(x#2)** for x 2. Root can be written as e.g. **x^(1/2)** or **x^.5** for square root of x, an exponential function like this: **e^x** for e x .

*Roots of negative values can only be shown, if the numerator of the power is 1 and the denominator of the power is odd (e.g. x^(1/3) ). To calculate negative x-values for e.g. x^(2/3). you have to alter this function into (x^(1/3))^2*

**sqr** Square root, e.g. **sqr(x)** as equivalent to x^(1/2).

**exp** Exponent, e.g. **exp(x)** as equivalent to e^x.

**log** Natural logarithm. e.g. **log(x)**

**log10** Decadic logarithm, e.g. **log10(x)**

**logn** Logarithm to the base n, e.g. **logn(2#x)** for the binary (base 2) logarithm.

### - Trigonometric and hyperbolic functions

**sin** Sine, sinus, e.g. **sin(x)**

**cos** Cosine, cosinus, e.g. **cos(x)**

**tan** Tangent, e.g. **tan(x)**

**cot** Cotangent, e.g. **cot(x)**

**sin2** Sine square, e.g. **sin2(x)**

**cos2** Cosine square, e.g. **cos2(x)**

**tanh** Hyperbolic Tangent, e.g. **tanh(x)**

**coth** Hyperbolic Cotangent, e.g. **coth(x)**

**arsinh** Area Hyperbolic Sine, e.g. **arsinh(x)**

**arcosh** Area Hyperbolic Cosine, e.g. **arcosh(x)**

**artanh** Area Hyperbolic Tangent, e.g. **artanh(x)**

**arcoth** Area Hyperbolic Cotangent, e.g. **arcoth(x)**

**cat** Catenary, e.g. **cat(2#x)** for 2*cosh(x/2). The first value is the constant a.

**hubb** Hubbert curve, e.g. **hubb(x)** for 1/(2+2*cosh(x)).

**L** Langevin function, e.g. **L(x)** for coth(x)-1/x.

**deg** Converts the radian number to the equivalent number in degrees, e.g. **deg(pi)**

**rad** Converts the number in degrees to the radian equivalent, e.g. **rad(180)**

### - Non-differentiable functions

**abs** Absolute value, e.g. **abs(x)**

**min** Minimum of several values, e.g. **min(1#x#x^(1/3))** as minimum of 1, x and third root of x.

**max** Maximum of several values, e.g. **max(abs(x)#x*x)** as maximum of the absolute value of x and x 2 .

**%** Modulo division, whole-numbered remainder, e.g. **10%x**

**fmod** Modulo division, floating point remainder, e.g. **fmod(x#1)** displays only the position after the decimal point of the input value.

**R** Round, e.g. **R(x#2)** rounds two decimal places, **R(x)** rounds to an integer.

**R0** Floor (rounding down), e.g. **R0(x)**

**R1** Ceil (rounding up), e.g. **R1(x)**

**dist** Distance function, e.g. **dist(x)** gives the distance to the nearest integer.

**prime** Prime number function, e.g. **prime(x)** This returns the next lower prime number (or x itself, if prime) for all x≥2 and x≤100000. At all four prime functions, non-integers are rounded.

**prime1** Prime number detecting function, e.g. **prime1(x)** Displays a number only if prime, else 0. To find all prime numbers in an interval, the span of the x-axis shouldn't be wider than the width of the image (usually 500) and you should switch off poles.

**prime2** Distinct prime factor counting function, e.g. **prime2(x)** returns the amount of different prime factors for an integer.

**prime3** Prime factor counting function, e.g. **prime3(x)** returns the amount of prime factors for an integer, including multiples. E.g. prime2(4) = 1, whereas prime3(4) = 2. If prime3(x) = 1, then x is prime.

**div** Divisor function, e.g. **div(x)** returns the number of divisors of an integer. Non-integers are rounded.

**dig** Digit sum, e.g. **dig(x)** returns the digital sum of an integer. Non-integers are rounded, - is ignored.

**dig2** Iterated (one-digit) digit sum, e.g. **dig2(x)** returns the iterated digital sum of an integer.

**adig** Alternating digit sum, e.g. **adig(x)** Non-integers are rounded, - is ignored.

**fac** Factorial, e.g. **fac(x)** Non-integers are rounded.

**H** Heaviside step function, e.g. **H(x)** 0, if x≤0, else 1.

**Hm** Multivariate Heaviside step function, e.g. **Hm(x*x-1#sin(x))** 0, if at least one value ≤0, else 1. Enter as many arguments as you want.

**sig** Signum function (sign function), e.g. **sig(x)**

**haar** Haar wavelet, e.g. **haar(x)**

**gcf** Greatest common factor (or greatest common divisor, gcd), e.g. **gcf(8#x)** returns the greatest common factor between two integers. Non-integers are rounded.

**lcm** Least common multiple, e.g. **lcm(8#x)** returns the least common multiple between two integers. Non-integers are rounded.

**mo** Möbius function, e.g. **mo(x)** returns for all positive integers 0, if divisible by a square>1, -1 if it has an odd number of distinct prime factors and 1 if it has an even number of distinct prime factors. Non-integers are rounded. Values are allowed up to 100000.

**toti** Euler's totient function, e.g. **toti(x)** counts all positive integers less than x that are comprime to x. Non-integers are rounded.

**odd** Find odd numbers, e.g. **odd(x)** returns numbers only when odd. Non-integers are rounded.

**even** Find even numbers, e.g. **even(x)** returns numbers only when even. Non-integers are rounded.

**bin** Binomial coefficient, e.g. **bin(4#x)** The two values are n and k. Non-integers are rounded.

**tri** Triangle curve, e.g. **tri(1#2#x)** The first value is the period, the second is the amplitude.

**rect** Rectangle curve, e.g. **rect(1#-1#2#x)** The first value is the upper limit, the second is the lower and the third is the period.

**saw** Sawtooth wave, e.g. **saw(2#1#x)** The first value is the period, the second is the amplitude.

**saw2** Reverse sawtooth wave, e.g. **saw2(2#1#x)** The first value is the period, the second is the amplitude.

**ramp** Ramp function, e.g. **ramp(1#2#1#x)** The first value is the start value, the second is the end value and the third is the height.

**ramp2** Reverse ramp function, e.g. **ramp2(1#2#1#x)** The first value is the start value, the second is the end value and the third is the height.

**trap** Trapezium (trapezoid) function, e.g. **trap(-4#-1#3#2#3#x)** The first value is the start value of the climb, the second is the end value of the climb, the third is the height, the fourth is the start value of the descent and the fifth is the end value of the descent.

**poly** Polygon or chart line, e.g. **poly(-4#2#-3#4#-2#1#-1#0#0#3#1#2#2#-1#3#3#4#1#x)** gives a chart, respectively a half polygon. Here, (-4,2) is connected to (-3,4), this to (-2,1) and so on. The first value of each pair is the x-value, the second one is the y-value. The x-values must increase with each step. To get a full polygon, enter a second term with the same start and end points, like **poly(-4#2#0.5#-4#4#1#x)**

**rand** Integer random number between two integers, e.g. **rand(0#2)** returns 0, 1 or 2 (Mersenne twister is used for generating).

**rand2** Random number between two numbers with decimal places (maximal 9), e.g. **rand2(0#1#3)** returns a number with three decimal places between 0 and 1 (Mersenne twister, too).

### - Probability functions and statistics

**norm** Normal or Gaussian distribution, e.g. **norm(0#1#x)** for the standard normal distribution. The first value is the expected value, the second is the standard deviation.

**phi** Φ. Cumulative Gaussian distribution function, e.g. **phi(0#1#x)** This is an approximation based on the displayed interval. It delivers reasonable values, if the normal distribution in the chosen interval starts at very low values near 0. A common display of both functions is advisable.

**lnorm** Log-normal distribution, e.g. **lnorm(0#1#x)** The first value is the mean, the second is the standard deviation.

**cau** Cauchy distribution or Lorentz distribution, e.g. **cau(0#1#x)** for the standard Cauchy distribution. The first value is the location parameter, the second is the scale parameter.

**lapc** Laplace distribution, e.g. **lapc(0#1#x)** The first value is the location parameter, the second is the scale parameter. The second

parameter must be >0.

**logd** Logistic distribution, e.g. **logd(1#2#x)** The first value is the location parameter, the second is the scale parameter.

**hlogd** Half-logistic distribution, e.g. **hlogd(x)**

**rlng** Erlang distribution, e.g. **rlng(5#1#x)** The first value is the shape parameter, the second is the rate parameter. The first parameter must be a natural number.

**pon** Exponential distribution, e.g. **pon(1#x)** The first value is the rate parameter.

**cosd** Raised cosine distribution, e.g. **cosd(0#1#x)** The first value is the location parameter, the second is the scale parameter. cosd is defined in the interval [location-scale;location+scale].

**sechd** Hyperbolic secant distribution, e.g. **sechd(x)**

**kum** Kumaraswamy distribution, e.g. **kum(2#3#x)** The first two values are the shape parameters a and b.

**levy** Lévy distribution, e.g. **levy(1#x)** The first value is the scale parameter.

**rlgh** Rayleigh distribution, e.g. **rlgh(1#x)** The first value is the scale parameter.

**wb** Weibull distribution, e.g. **wb(2#1#x)** The first value is the shape parameter, the second is the scale parameter.

**wig** Wigner semicircle distribution, e.g. **wig(1#x)** The first value gives the radius.

**igauss** Inverse Gaussian distribution, e.g. **igauss(1#0.25#x)** The first value is the shape parameter, the second is the scale parameter.

**par** Pareto distribution, e.g. **par(2#1#x)** The first value is the location parameter, the second is the shape parameter.

**shg** Shifted Gompertz distribution, e.g. **shg(0.5#1#x)** The first value is the scale parameter, the second is the shape parameter, both must be >0.

**brw** Relativistic Breit-Wigner distribution, e.g. **brw(1#2#x)** The first value is the mass of the resonance, the second is the resonance's width and the third is the energy.

**gen** Generalized extreme value distribution, e.g. **gen(0#1#0.2#x)** The first value is the location parameter, the second is the scale parameter and the third is the shape parameter.

**Ft** Fisher-Tippett distribution, e.g. **Ft(1#2#x)** The first value is the location parameter, the second is the scale parameter. The second parameter must be >0.

**rossi** Rossi distribution, or mixed extreme value distribution, e.g. **rossi(0#3#1#4#x)** The first four values are c1, c2, d1 and d2.

**gum1** Gumbel distribution type 1, e.g. **gum1(2#1#x)** The first two values are the parameters a and b.

**gum2** Gumbel distribution type 2, e.g. **gum2(2#1#x)** The first two values are the parameters a and b.

**trid** Triangular distribution, e.g. **trid(1#2#4#x)** The first value is the lower limit, the second is the most probable and the third is the upper limit.

#### - Discrete distributions

**bind** Binomial distribution, e.g. **bind(5#0.4#x)** The first value is the number of trials, the second is the success probability.

**poi** Poisson distribution, e.g. **poi(3#x)** The first value is λ. the second is the expected value.

**skel** Skellam distribution, e.g. **skel(1#2#x)** The first two values are the means of two different Poisson distributions.

**gk** Gauss-Kuzmin distribution, e.g. **gk(x)**

**geo** Geometric distribution (variant A), e.g. **geo(0.8#x)** The first value is a probability.

**hgeo** Hypergeometric distribution, e.g. **hgeo(8#3#2#x)** The first value is the total number of objects, the second is the total number of defective objects, the third is is the number of sample objects and the fourth the number of defective objects in the sample.

**logs** Logarithmic series distribution, e.g. **logs(0.1#x)** The first value is a probability.

**zm** Zipf-Mandelbrot law or Pareto-Zipf law, e.g. **zm(100#1#2#x)** The first three values are N, q and s. Maximum for N is 100.

**uni** Uniform distribution, e.g. **uni(1#2#x)** The first value is the lower limit, the second is the upper limit.

### - Special functions

**traj** Trajectory parabola, path of a thrown object, e.g. **traj(45#20#9.81#x)** The first value is the angle, the second is the speed (e.g. in meters per second). The third value is the gravitational acceleration (e.g. in m/s²), the normal value on earth for this is g = 9.81 m/s². The axes scale in this example is meters. Air resistance is ignored.

**pll** Parallel operator, as used, among others, for the calculation of parallel circuits and resistances, e.g. **pll(20#30#x)** Enter as many arguments as you want.

**M1** Arithmetic mean, e.g. **M1(2#3#x)** Enter as many arguments as you want.

**M2** Geometric mean, e.g. **M2(2#3#x)** Enter as many arguments as you want, only positive values are allowed.

**M3** Harmonic mean, e.g. **M3(2#3#x)** Enter as many arguments as you want, only positive values are allowed.

**M4** Root mean square, e.g. **M4(2#3#x)** Enter as many arguments as you want.

**M5** Median, e.g. **M5(2#3#x)** Enter as many arguments as you want.

**scir** Semicircle curve, e.g. **scir(x#1)** for a semicircle with the radius 1. The formula is sqr(r*r-x*x), r gives the radius.

**ell** Semielliptic curve, e.g. **ell(2#1#x)** for a semiellipse with the horizontal radius 2 and the vertical radius 1. The formula is sqr((1-x*x/(a*a))*b*b).

**ell2** Semi-superellipse or semi-hyperellipse, e.g. **ell2(2#3#4#x)** for a semiellipse with the horizontal radius 2, the vertical radius 3 and n=4.

**lmn** Lemniscate of Bernoulli, e.g. **lmn(1#x)** This returns a half lemniscate. For the other half, use **-lmn(1#x)**

**lmn2** Lemniscate of Gerono, e.g. **lmn2(x)** This returns a half lemniscate. For the other half, use **-lmn2(x)**

**lmn3** Lemniscate of Booth, e.g. **lmn3(1#x)** This returns a half lemniscate. For the other half, use **-lmn3(1#x)**

**pyth** Pythagorean theorem, e.g. **pyth(x#1)** The formula is c=sqr(a*a+b*b).

**thr** Rule of three, e.g. **thr(x#1#2)** The formula for thr(a#b#c) is f(x)=b*c/a.

**fib** Fibonacci numbers, e.g. **fib(x)** or **fib(x#1)** If the second value is 1, a continuous graph is shown, else a discrete.

**dc** Exponential decay, e.g. **dc(5#1#x)** The first value is the initial quantity, the second is the decay constant.

**erf** Gaussian error function, e.g. **erf(x)** For the computation its Taylor series is used.

**HY4** Hyper4, also known as tetration or super-exponentiation, e.g. **HY4(x#3)** for x to the power of (x to the power of x). Here the maximum value can be excessed very quickly!

**lambda** Lambda function, e.g. **lambda(x#3)** for x to the power of (x to the power of (3-1)).

**sgm** Sigmoid function, e.g. **sgm(x)** for 1/(1+e^(-x)).

**gom** Gompertz curve, e.g. **gom(2#-5#-3#x)** The first value is the upper asymptote, the second is the parameter b and the third is the growth rate. Second and third value must be negative.

**stir** Stirling's approximation for large factorials, e.g. **stir(x)** The formula is (2*pi*x)^(1/2)*(x/e)^x.

**omega** Lambert-W function or Omega function or product log (approximation), e.g. **omega(x)**

**bump** Bump function psi, ψ. e.g. **bump(x)** for exp(-1/(1-x*x)) between -1 and 1, else 0.

**srp** Serpentine curve, e.g. **srp(2#1#x)** The formula is a*a*x/(x*x+a*b). The first two values are a and b.

**bsc** Gaussian bell-shaped curve, e.g. **bsc(1#x)** The formula is exp(-a*a*x*x), the first value is the shape parameter a.

**gbsc** Generalized Gaussian bell-shaped curve, e.g. **gbsc(1#2#-1#x)** for 1*exp(2*x-1*x*x).

### - Programmable functions

**bool** Characteristic boolean function, e.g. **bool(1/x)** Returns nothing, if the input value is not defined, 0, if 0, else 1.

**bool0** Defined boolean function, e.g. **bool0(x)** Returns 0, if the input value is 0 or not defined, else 1.

**bool1** Undefined boolean function, e.g. **bool1(prime1(x))** Returns nothing, if the input value is 0 or not defined, else 1.

**con** Condition function, e.g. **con(0#sin(x)#1)** The first value is the lower limit, the third is the upper limit. If the second value is between these two, the result is 1, else 0.

**rcon** Reverse condition function, e.g. **rcon(0#sin(x)#1)** The first value is the lower limit, the third is the upper limit. If the second value is between these two, the result is 0, else 1.

**wcon** Weighted condition function, e.g. **wcon(0#sin(x)#1)** Only returns the second value, if this lies between the first and the third value.

**rwcon** Reverse weighted condition function, e.g. **rwcon(0#sin(x)#1)** Only returns the second value, if this doesn't lie between the first and the third value.

*&& (and) can be simulated with the minimum function, e.g.* **min< con[0#sin(x)#1] # con[0#cos(x)#1] >**

*|| (or) can be simulated with the maximum function, e.g.* **max< con[0#sin(x)#1] # con[0#cos(x)#1] >**

*⊕ (xor) can be simulated with the maximum minus the minimum function, e.g.*

### - Iterations (iterative functions)

**y** Previous function value, e.g. for **y(0)+0.01** is 0 the initial value for y, the next value is the last result of the input value x and so on.

**y2** Pre-previous function value, e.g. **y2(1)+0.001**

**step** Number of the iteration steps done, divided by the parameter value, e.g. **step(100)** counts up to five (at 500 px width).

**mean** Iterated arithmetic mean, e.g. **mean(sin(x))** gives the arithmetic mean of the y-values returned to the so far reached x-values.

**man** Mandelbrot function, e.g. **man(0#-1.9)** for y(0)*y(0)-1.9.

*Attention: derivative and integral with the iteration don't lead to very reasonable results. As well a logarithmic scale won't work here.*

#### - Fractals

**rsf** Random singular function (a kind of devil's staircase), e.g. **rsf(0#2)** for y(a)+0.008*rand(0#1)*rand(0#1)*(b-a), from a (first value) to b (second value) at 500px width. The first value is the start point on the y-axis, the second is the average end value.

**wf** Weierstrass function, e.g. **wf(x#0.5#17#10)** The second value is a parameter between 0 and 1, the third value is a positive, odd integer. The second multiplied with the third must be larger than 1+3/2*pi. The fourth value is the number of steps done. In theory this is infinite, but here the maximum is 100.

**blanc** Blancmange curve, e.g. **blanc(x#10)** The second value is the number of steps done, maximum is 1000.

**tak** Takagi-Landsberg curve, e.g. **tak(x#0.7#10)** The second value is a parameter, which should be between 0 and 1. The third is the number of steps done, maximum is 1000.

### Differential and integral equations

Derivatives within a function are written like this:

Source: rechneronline.deCategory: Bank

## Similar articles:

PFC derivatives and chemicals on which they are based alert FactSheet

5 Equity Derivatives And How They Work