CALCULATORS Distributions: For basic calculations, enter expression directly into the input box above or use keypad below. Storage: History: About this calculator Other javascript functions and constants can be typed into the input box above. Some examples:   pi,   log(x,base);   fact(n),   choose(n,k),   runi(a,b [,n]),   rnorm(mean,sd [,n]),  rduni(a,b [,n]),  rdice(n [,nss]),  ravggeo(p,n), mean(x),   sd(x),  prop(x,q);   quantile(p,x);   ssize(x),  ...,    cos(theta),   cosd(degrees),   sin(theta),   ...   Click to see more. Refresh this webpage to interrupt a slow or non-responsive calculation; this will also remove all user-defined objects.

Descriptions of more (untested) functions that can be typed directly into the calculator's input box...

Counting:                         fact(n) [compute n!],   logfact(n) [compute ln(n!)],  logfact(n,b) [compute log(n!,base=b)],  choose(n,k) [compute binomial coefficient nCk],  perm(n,k) [compute permutation coefficient nPk].

Generate Random #'s:    runi() [gen a deviate from U(0,1), the Uniform(0,1) distribution], runi(a,b [,n]) [gen n from U(a,b); if optional arg n is dropped, it is set to 1], rnorm(mean,sd [,n]) [gen n from Normal(mean,sd)], rexp(mean [,n]) [gen n from Expon(mean)], rgam(shape,scale [,n]) [gen n from Gamma(shape,scale)], rchisq(df [,n]) [gen n from ChiSq(df)], rt(df [,n]) [gen n from Student's t(df)];     rduni(a,b [,n]) [gen n from discrete U{a,..,b}], rbin(n,p [,nss]) [gen nss from binom(n,p)], rgeo(p [,n]) [gen n from Geom(p,#trials)], rpoi(mean [,n]) [gen n from Poi(mean)], rdice(n [,nss]) [roll n six-sided dice nss times, record total updots each time],   rdiscrete(v,p [,n]) [gen n from Discrete(v,p), where v are the possible values and p are the probabilities. Here, v and p are strings of comma-separated numbers. E.g., submit rdiscrete("0,5,10","0.2,0.3,0.5",500).

Generate Averages:        ravguni(a,b,n) [gen avg based on n from U(a,b)], ravgnorm(mean,sd,n) [gen avg based on n from Normal(mean,sd)], ravgexp(mean,n) [gen avg based on n from Expon(mean)], ravggam(shape,scale,n) [gen avg based on n from Gamma(shape,scale)];    ravgduni(a,b,n) [gen avg based on n from discrete U{a,..,b}], ravgbin(n,p,nss) [gen avg based on nss from binom(n,p)], ravggeo(p,n) [gen avg based on n from Geom(p,#trials)], ravgpoi(mean,n) [gen avg based on n from Poi(mean)].

Sample Statistics:           ssize(x) [sample size],   sum(x),   mean(x) [or avg(x)],   variance(x),   sd(x) [or stdev(x)],   mad(x) [mean absolute deviation of x],   prop(x,q) [proportion of values in x that are <= q],   prop(x,q [, direction]) [proportion of values in x that are <= q (or <= q, = q, >= q, < q, or > q, as optional 'direction' argument is '<=', '=', '>=','<', or '>')],   min(x),   max(x),   quantile(p,x) [or quant(p,x); compute pth quantile of data x],   median(x),   iqr(x) [compute interquartile range of x],   range(x) [max minus min].    Here, x is a string of comma-separated numbers: e.g., type 'mean("1,2,3")' [without the single quotes] or take the two steps, e.g., (i) type 'x=rnorm(0,1,25)' and then (ii) type 'mean(x)'.

Trigonometry:                 cos(theta[rad]), acos(x) [arccos in radians], cosd(deg), acosd(x)[arccos in degrees],..., plus sin() and tan() analogs.

Logarithms:                     log(x) [compute ln(x)], log(x,b) [compute log of x base b], ...

Constants:                      pi=Math.PI = π = 3.141592653589793 (approx).

Author: Joseph B. Lang, Department of Statistics and Actuarial Science, University of Iowa.   08/13/2004 01:24:24 PM -0500 (updated 08/22/2023).

Disclaimer: Use at your own risk. Calculators and functions have not been thoroughly tested. See below for comment on rounding error.

Refreshing this webpage will interrupt a slow or non-responsive calculation. Refreshing will also remove all user-defined objects; this can be useful when the user inadvertently creates an object with the same name as one of the functions in the calculator javascript code.

The basic calculator was built around JavaScript code (c. 2003) from The JavaScript Source  https://javascriptsource.com.  Numbers less than 1e-16 are generally treated as 0. There will be round-off errors; specifically, upon hitting Return or the "=" button, numbers will generally be accurate only to the 15th significant digit.

The distribution calculators were written using JavaScript.  The algorithms are based on those found in "Numerical Recipes in C,"  2nd edn.  Press, W.H., Teukolsky, S.A., Vetteriling, W.T. and Flannery, B.P. 1992 (1999 reprint).