Math and Science Calculator Methodology | MrCalculator | MrCalculators

Methodology: Math and Science Calculators

Every math and science calculator is built from a published formula, validated with worked examples, and checked against authoritative references. This page lists those formulas, conventions, pitfalls, and vocabulary.

Canonical formulas

Pythagorean theorem

For a right triangle with legs a, b and hypotenuse c, a^2 + b^2 = c^2. Also the base for Euclidean distance d = sqrt((x2 - x1)^2 + (y2 - y1)^2).

Sample standard deviation (Bessel's correction)

s = sqrt( sum((x_i - xbar)^2) / (n - 1) ). The (n - 1) denominator gives an unbiased estimator of population variance. The population form uses N and only applies when the full population is observed.

Factorials, permutations, combinations

n! = 1 * 2 * ... * n with 0! = 1. P(n, r) = n! / (n - r)! counts ordered selections; C(n, r) = n! / (r! (n - r)!) counts unordered ones.

Logarithm change of base

For positive b != 1, log_b(x) = ln(x) / ln(b). Lets us expose arbitrary-base logs via the runtime's natural log.

Trigonometric identities

sin^2(t) + cos^2(t) = 1 and the angle-sum identities sin(a +/- b) = sin a cos b +/- cos a sin b, cos(a +/- b) = cos a cos b -/+ sin a sin b.

How we review and update

Each calculator implements one named formula, validated against worked examples from the cited reference. The same examples run as automated tests so refactors cannot silently change a result. When a source updates (a new SI Brochure or DLMF revision), we re-run affected tests and bump the lastReviewed date.

Common pitfalls

  • Sample vs population standard deviation. Using N instead of N - 1 for a sample underestimates variability. Stats tools default to the sample form.
  • Degrees vs radians. JavaScript trig functions take radians. Every trig calculator exposes a DEG/RAD switch and converts via theta_rad = theta_deg * pi / 180.
  • US vs UK gallons. 1 US gallon = 3.785411784 L; 1 Imperial gallon = 4.54609 L - a ~20% gap. Unit pickers show 'gal (US)' or 'gal (UK)', never a generic 'gallon'.
  • Mass vs weight (lb vs lbf). Mass (kg, lb) and weight (N, lbf) are related by W = m * g but are not interchangeable. Calculators never silently mix lb with lbf.
  • Temperature offsets. T_K = T_C + 273.15; T_F = T_C * 9/5 + 32. Converters apply the offset for absolute temperatures and use only the ratio for differences.
  • Floating-point residuals. Subtracting nearly equal floats can leak residuals near 1e-16. We round to sensible significant figures and treat sub-epsilon values as zero.

Glossary

Significant figures
Digits carrying meaningful resolution.
Scientific notation
a * 10^b with 1 <= |a| < 10 and integer b.
Mean
Sum of n values divided by n.
Median
Middle value of a sorted list; robust to outliers.
Variance
Average squared deviation from the mean; sample form uses (n - 1).
Standard deviation
Square root of the variance, in the same units as the data.
Factorial
n! = 1 * 2 * ... * n, with 0! = 1.
Permutation
Ordered selection: P(n, r) = n! / (n - r)!.
Combination
Unordered selection: C(n, r) = n! / (r! (n - r)!).
Radian
SI unit of plane angle; 2 pi rad = 360 degrees.
SI base unit
One of seven units (m, kg, s, A, K, mol, cd) from which all SI units derive.
Defining constant
One of seven fixed constants (c, h, k, ...) defining the SI since 2019.
Dimensional analysis
Tracking units through a calculation to catch errors.
Order of magnitude
The power of ten closest to a value; used for sanity checks.
Epsilon
Small threshold below which two floats are treated as equal.