# Calculator help

## Basic usage

Input commands to the input field at the bottom. Execute the command by pressing Enter or by clicking the Calculate button. The large text area shows the history of input and output text.

While in the input field, you can scroll the command history back and forth with the up and down arrow keys.

You can clear the output window and command history by clicking the Clear button.

## Operators

The calculator understands basic operations, which are:

`+` | addition
`-` | subtraction
`*` | multiplication
`/` | division
`%` | modulus
`^` | power
`!` | factorial
`!!` | double factorial

For example:

`1 + 2 * 3 ^ 4`

calculates 1 + 2 * 34, which is 163.

## Variables

You can assign values to variables and use variables in expressions, for example:

`x = 5`
`x + 6`

Assignment operations can be also combined with the basic operations:

`x += 5`
`x -= 6`
`x *= 7`
`x /= 8`
`x %= 3`
`x ^= 2`

## Output format

You can change the output format of floating-point values with the "Floating" and "Fixed" radio buttons. These are for example:

Floating: | `1.2345e3`
Fixed: | `1234.5`

Note that the calculator supports extremely large exponents for floating-point values. Displaying such numbers in the fixed-point format may be impractical.

## Functions

The calculator supports many functions.

### Basic:

`abs(x)` | Absolute value of `x`.
`cbrt(x)` | Cube root of `x`.
`ceil(x)` | Ceiling function (round towards positive infinity) of `x`. Parameter `x` must be real.
`copySign(x, y)` | Copies sign of `y` to the value of `x`. Both `x` and `y` must be real.
`doubleFactorial(x)` | Double factorial of `x`, that is `x!!`. Parameter `x` must be an integer.
`factorial(x)` | Factorial of `x`, that is `x!`. Parameter `x` must be an integer.
`floor(x)` | Floor function (round towards negative infinity) of `x`. Parameter `x` must be real.
`frac(x)` | Fractional part of `x`. Parameter `x` must be real.
`fmod(x, y)` | Modulus, equivalent to `x % y`. Both `x` and `y` must be real.
`hypot(x, y)` | Equivalent to `sqrt(x2 + y2)`. Both `x` and `y` must be real.
`inverseRoot(x, y)` | Equivalent to `x-1/y`. Parameter `y` must be an integer.
`inverseRoot(x, y, z)` | Inverse `y`:th root of `x`, `z`:th branch. Parameters `y` and `z` must be integers.
`max(x, y)` | Maximum of `x` and `y`. Both `x` and `y` must be real.
`min(x, y)` | Minimum of `x` and `y`. Both `x` and `y` must be real.
`n(x, y)` | The value of `x` to the precision of `y` digits. Parameter `y` must be an integer.
`nextAfter(x, y)` | The number adjacent to `x` in the direction of `y`. Both `x` and `y` must be real.
`nextDown(x)` | The adjacent value closer to negative infinity. Parameter `x` must be real.
`nextUp(x)` | The adjacent value closer to positive infinity. Parameter `x` must be real.
`random(x)` | Pseudorandom number with `x` digits and a uniform distribution from the range `[0, 1)`. Parameter `x` must be an integer.
`randomGaussian(x)` | Pseudorandom number with `x` digits and a normal distribution with mean 0 and standard deviation 1. Parameter `x` must be an integer.
`root(x, y)` | Equivalent to `x1/y`. Parameter `y` must be an integer.
`root(x, y, z)` | `y`:th root of `x`, `z`:th branch. Parameters `y` and `z` must be integers.
`roundToPrecision(x, y)` | Round `x` to `y` digits of precision. Parameter `x` must be real and `y` must be an integer. Any exactly half-way values are rounded up.
`roundToInteger(x)` | Round `x` to nearest integer. Parameter `x` must be real. Any exactly half-way values are rounded up.
`roundToPlaces(x, y)` | Round `x` to `y` decimal places. Parameter `x` must be real and `y` must be an integer. Any exactly half-way values are rounded up.
`roundToMultiple(x, y)` | Round `x` to the nearest integer multiple of `y`. Parameters `x` and `y` must be real. Any exactly half-way values are rounded up.
`scale(x, y)` | Equivalent to `x * 10y`. Parameter `y` must be an integer.
`sqrt(x)` | Square root of `x`.
`truncate(x)` | Nearest integer rounded towards zero of `x`. Parameter `x` must be real.
`toDegrees(x)` | Convert radians to degrees. Parameter `x` must be real.
`toRadians(x)` | Convert degrees to radians. Parameter `x` must be real.
`ulp(x)` | Unit in the last place.

### Trigonometric:

`acos(x)` | Arc cosine of `x`.
`acosh(x)` | Hyperbolic arc cosine of `x`.
`asin(x)` | Arc sine of `x`.
`asinh(x)` | Hyperbolic arc sine of `x`.
`atan(x)` | Arc tangent of `x`.
`atan2(x, y)` | Angle of the point `(y, x)`. Both `x` and `y` must be real.
`atanh(x)` | Hyperbolic arc tangent of `x`.
`cos(x)` | Cosine of `x`.
`cosh(x)` | Hyperbolic cosine of `x`.
`exp(x)` | Exponent function of `x`, that is `ex`.
`log(x)` | Natural logarithm of `x`.
`log(x, y)` | Base-`y` logarithm of `x`.
`sin(x)` | Sine of `x`.
`sinh(x)` | Hyperbolic sine of `x`.
`tan(x)` | Tangent of `x`.
`tanh(x)` | Hyperbolic tangent of `x`.

### Complex manipulation:

`arg(x)` | Angle on the complex plane of `x`.
`conj(x)` | Complex conjugate of `x`.
`imag(x)` | Imaginary part of `x`.
`real(x)` | Real part of `x`.

### Advanced:

`agm(x, y)` | Arithmetic-geometric mean of `x` and `y`.
`airyAi(x)` | Airy function `Ai(x)`. Note that the implementation is slow.
`airyAiPrime(x)` | Derivative of the Airy function Ai, i.e. `Ai′(x)`. Note that the implementation is slow.
`airyBi(x)` | Airy function `Bi(x)`. Note that the implementation is slow.
`airyBiPrime(x)` | Derivative of the Airy function Bi, i.e. `Bi′(x)`. Note that the implementation is slow.
`angerJ(ν, x)` | Anger function `𝐉ν(x)`. Note that the implementation is slow.
`bernoulli(x)` | Bernoulli number Bx.
`bernoulliB(n, x)` | Bernoulli polynomial `Bn(x)`. Parameter `n` must be a nonnegative integer. Note that the implementation is slow.
`besselI(ν, x)` | Bessel function `Iν(x)`. Note that the implementation is slow.
`besselJ(ν, x)` | Bessel function `Jν(x)`. Note that the implementation is slow.
`besselK(ν, x)` | Bessel function `Kν(x)`. Note that the implementation is slow.
`besselY(ν, x)` | Bessel function `Yν(x)`. Note that the implementation is slow.
`beta(a, b)` | Beta function. Note that the implementation is slow.
`beta(x, a, b)` | Incomplete beta function `Bx(a, b)`. Note that the implementation is slow.
`beta(x1, x2, a, b)` | Generalized incomplete beta function `B(x1, x2)(a, b)`. Note that the implementation is slow.
`binomial(x, y)` | Binomial coefficient, i.e. (x y).
`catalan(x)` | Catalan's constant G calculated to `x` digits of precision. Parameter `x` must be an integer.
`chebyshevT(ν, x)` | Chebyshev polynomial of the first kind `Tν(x)`. Note that the implementation is slow.
`chebyshevU(ν, x)` | Chebyshev polynomial of the second kind `Uν(x)`. Note that the implementation is slow.
`cosIntegral(x)` | Cosine integral i.e. `Ci(x)`. Note that the implementation is slow.
`coshIntegral(x)` | Hyperbolic cosine integral i.e. `Chi(x)`. Note that the implementation is slow.
`digamma(x)` | Digamma function, i.e. `ψ(x)`. Note that the implementation is slow.
`e(x)` | e calculated to `x` digits of precision. Parameter `x` must be an integer.
`ellipticE(x)` | Elliptic integral `E(x)`.
`ellipticK(x)` | Elliptic integral `K(x)`.
`erf(x)` | Error function. Note that the implementation is slow.
`erfc(x)` | Complementary error function. Note that the implementation is slow.
`erfi(x)` | Imaginary error function. Note that the implementation is slow.
`euler(x)` | γ calculated to `x` digits of precision. Parameter `x` must be an integer.
`eulerE(n, x)` | Euler polynomial `En(x)`. Parameter `n` must be a nonnegative integer. Note that the implementation is slow.
`expIntegralE(ν, x)` | Exponential integral `Eν(x)`. Note that the implementation is slow.
`expIntegralEi(x)` | Exponential integral `Ei(x)`. Note that the implementation is slow.
`fibonacci(ν, x)` | Fibonacci polynomial `Fν(x)`. Note that the implementation is slow.
`fresnelC(x)` | Fresnel integral C, i.e. `C(x)`. Note that the implementation is slow.
`fresnelS(x)` | Fresnel integral S, i.e. `S(x)`. Note that the implementation is slow.
`gamma(x)` | Gamma function, i.e. `Γ(x)`. Note that the implementation is slow.
`gamma(a, x)` | Incomplete gamma function, i.e. `Γ(a, x)`. Note that the implementation is slow.
`gamma(a, x1, x2)` | Generalized incomplete gamma function, i.e. `Γ(a, x1, x2)`. Note that the implementation is slow.
`gcd(x, y)` | Greatest common divisor of `x` and `y`. Both `x` and `y` must be integers.
`gegenbauerC(ν, x)` | Renormalized Gegenbauer function `Cν(0)(x)`. Note that the implementation is slow.
`gegenbauerC(ν, λ, x)` | Gegenbauer polynomial `Cνλ(x)`. Note that the implementation is slow.
`glaisher(x)` | The Glaisher-Kinkelin constant A calculated to `x` digits of precision. Parameter `x` must be an integer.
`jacobiP(ν, a, b, x)` | Jacobi polynomial `Pν(a,b)(x)`. Note that the implementation is slow.
`harmonicNumber(x)` | Harmonic number `Hx`. Note that the implementation is slow.
`harmonicNumber(x, r)` | Generalized harmonic number `Hx(r)`. Note that the implementation is slow.
`hermiteH(ν, x)` | Hermite polynomial `Hν(x)`. Note that the implementation is slow.
`hypergeometric0F1(a, x)` | Hypergeometric function `0F1(;a; x)`. Note that the implementation is slow.
`hypergeometric0F1Regularized(a, x)` | Regularized hypergeometric function `0F̃1`. Note that the implementation is slow.
`hypergeometric1F1(a, b, x)` | Hypergeometric function `1F1(a; b; x)`. Note that the implementation is slow.
`hypergeometric1F1Regularized(a, b, x)` | Regularized hypergeometric function `1F̃1`. Note that the implementation is slow.
`hypergeometric2F1(a, b, c, x)` | Hypergeometric function `2F1(a, b; c; x)`. Note that the implementation is slow.
`hypergeometric2F1Regularized(a, b, c, x)` | Regularized hypergeometric function `2F̃1`. Note that the implementation is slow.
`hypergeometricU(a, b, x)` | Hypergeometric function `U`. Note that the implementation is slow.
`inverseErf(x)` | Inverse error function i.e. `erf−1(x)`. Parameter `x` must be between (-1, 1). Note that the implementation is slow.
`inverseErfc(x)` | Inverse complementary error function i.e. `erfc−1(x)`. Parameter `x` must be between (0, 2). Note that the implementation is slow.
`khinchin(x)` | Khinchin's constant K calculated to `x` digits of precision. Parameter `x` must be an integer.
`laguerreL(ν, x)` | Laguerre polynomial `Lν(x)`. Note that the implementation is slow.
`laguerreL(ν, λ, x)` | Generalized Laguerre polynomial `Lνλ(x)`. Note that the implementation is slow.
`legendreP(ν, x)` | Legendre polynomial `Pν(x)`. Note that the implementation is slow.
`legendreP(ν, μ, x)` | Associated Legendre function of the first kind `Pνμ(x)`. Note that the implementation is slow.
`legendreQ(ν, x)` | Legendre function of the second kind `Qν(x)`. Note that the implementation is slow.
`legendreQ(ν, μ, x)` | Associated Legendre function of the second kind `Qνμ(x)`. Note that the implementation is slow.
`lcm(x, y)` | Least common multiple of `x` and `y`. Both `x` and `y` must be integers.
`logGamma(x)` | Logarithm of the gamma function, `logΓ(x)`. Note that the implementation is slow.
`logIntegral(x)` | Logarithmic integral i.e. `li(x)`. Note that the implementation is slow.
`logisticSigmoid(x)` | Logistic sigmoid function.
`pi(x)` | π calculated to `x` digits of precision. Parameter `x` must be an integer.
`pochhammer(x, n)` | Pochhammer symbol i.e. `(x)n`. Note that the implementation is slow.
`polygamma(n, x)` | Polygamma function i.e. `ψ(n)(x)`. Parameter `n` must be a nonnegative integer. Note that the implementation is slow.
`polylog(ν, x)` | Polylogarithm `Liν(x)`. Note that the implementation is slow.
`sinc(x)` | Sinc function.
`sinIntegral(x)` | Sine integral i.e. `Si(x)`. Note that the implementation is slow.
`sinhIntegral(x)` | Hyperbolic sine integral i.e. `Shi(x)`. Note that the implementation is slow.
`sphericalHarmonicY(ν, μ, ϑ, ϕ)` | Spherical harmonic function `Yλμ(ϑ, ϕ)`. Note that the implementation is slow.
`struveH(ν, x)` | Struve function `𝐇ν(x)`. Note that the implementation is slow.
`struveL(ν, x)` | Struve function `𝐋ν(x)`. Note that the implementation is slow.
`w(x)` | Lambert W function, i.e. solution to the equation `W eW = x`.
`w(x, k)` | Lambert W function, branch `k`. Parameter `k` must be an integer.
`weberE(ν, x)` | Weber function `𝐄ν(x)`. Note that the implementation is slow.
`zeta(x)` | Riemann zeta function, i.e. `ζ(x)`. Note that the implementation is slow.
`zeta(x, y)` | Hurwitz zeta function, i.e. `ζ(x, y)`. Note that the implementation is slow.

### Functional equivalents to the basic operators:

`add(x, y)` | Equivalent to `x + y`.
`subtract(x, y)` | Equivalent to `x - y`.
`multiply(x, y)` | Equivalent to `x * y`.
`divide(x, y)` | Equivalent to `x / y`.
`negate(x)` | Equivalent to `-x`.
`mod(x, y)` | Equivalent to `x % y`.
`pow(x, y)` | Equivalent to `x ^ y`.

For example:

`digits=40`
`exp(sqrt(n(163, digits)) * pi(digits))`

## Number types

The calculator supports complex and rational numbers in addition to integers and floating-point values. For example, `sqrt(-1.0)` returns `i`. Here `i` is the imaginary unit and it can be used in input expressions as well. If you don't specify an exponent or a decimal point for a number, it will be treated as an integer. Integers have infinite precision (see below). For example, inputting

`2/3`

will get you just

`2/3`,

the rational number. If you want a floating-point calculation instead, use e.g.

`2.00 / 3.00`

## Precision

The calculator can perform calculations to arbitrary precision (actually the precision is currently limited to about 3.5×1015 digits but the calculator will run out of memory or time well before that).

### Arbitrary input precision

By default, the precision of a floating-point number is the number of significant digits that you specify for it. For example:

`2.` has a precision of 1 digit,
`2.0` has a precision of 2 digits,
`2.00000` has a precision of 6 digits

The result of the calculation is only performed to the precision allowed by the precision of the input operands, so for example

`sqrt(2.00)`

calculates the square root of two to three digits of precision.

Integers have infinite precision. This limits their use in certain operations. For example

`sqrt(2)`

will give an error that an inexact square root can't be calculated to infinite precision. However, `sqrt(4)` would work.

If you want to use extreme precision (which this calculator is certainly designed for), you can use the function `n(x, y)` to specify the precision of a number. For example,

`sqrt(n(2, 1000))`

would calculate the square root of two with a precision of 1000 digits.

If you set the precision very high, the calculation may take a very long time. During the calculation the calculator may appear unresponsive. For example, calculating

`exp(n(1, 1000000))`

might take an hour or so, depending on your computer's performance.

### Fixed input precision

You can change the input precision of numbers from the above default logic to a fixed number of digits by selecting the "Fixed" radio button in the "Input precision" radio button group and setting the desired number of digits in the input field.

This way, if you e.g. set the input precision to 100 digits, even if you input a number like `0.5` it won't have only one digit of precision but always the fixed precision (e.g. 100 digits).

Note that the fixed precision is set only for the numbers that are input, not for the numbers that are output. In practice, often the two precisions are the same, but not always. For example, if you set a fixed input precision of 20 digits and calculate `log(1.00001)`, the result won't have 20 digits of precision but only 15 digits of precision. This happens because of how the `log()` function behaves around `1`.

If fixed input precision is set, you can omit the argument to the functions that return a constant. For example then `pi()` would just return π to the specified input precision.