This page has been automatically translated by machine translation. Please note that translations may not be entirely accurate.

keisanHigh-precision calculations for everyday life and work

How to Use

TOP/How to Use

keisan is a calculation service that aims to achieve precision assurance by applying variable-precision arithmetic technology.

Features of keisan

1. You can change the number of digits for calculation.

(The number of digits is set using the "Digits" setting)

SettingResult
Digits 6√5 =sqrt(5) =2.23607
Digits 14√5 =sqrt(5) =2.2360679774998
EnvironmentResult
keisan(0.9-0.3*3) =0
Excel(0.9-0.3*3) =1.11022E-16 (binary-decimal conversion error)

2. Automatically determines the correct digits of precision.

SettingResult
Digits 61-0.999876 =1.24000E-4
Digits 10gamma(3.5) =3.323350970

3. Supports complex numbers, statistical functions, special functions, and table calculations.

TypeExample
[Set Digits to 6]
Complex number(1+i)^(1+i) =0.273957+0.583701i
Error functionx =0.1 erf(x) =0.112463
Table calculationsqrt(x) x =2,1,5

Table calculation result

xsqrt(x)
21.41421
31.73205
42
52.23607
62.44949
sqrt(x) graph x=2..6

4. You can use the formula library.

Formula nameContent
Area of a triangle (a,b,c)s=(a+b+c)/2; a=3; b=4; c=5; sqrt(s*(s-a)*(s-b)*(s-c))

Formula Syntax Rules

1. Numbers

0,1,2,3,4,5,6,7,8,9, .(decimal point), E(exponent), i(imaginary), +, -

Input exampleDescription
12340.56789Same as 1.234056789E4
E2100
1.23E+412300 — The + in E+ is an exponent sign and can be omitted
1.23E-40.000123 — The - in E- is an exponent sign and cannot be omitted
i0+1i
E+2i0+100i
1.23+4.56iEnclosing complex numbers in parentheses is recommended
1.23E3+4.56E2i1230+456i
1.23E-3-4.56E+2i0.00123-456i

Note: Use uppercase E for the exponent part. (Lowercase e is the base of natural logarithm)

2. Variables

Must start with a letter or kanji, followed by letters, digits, or kanji. Special symbols and reserved words cannot be used.

CategoryExample
Variable name examplesa, sinx, a3, etc.
Invalid examplese, i, inf, sin, E and other reserved words
Invalid examples#abc, 3abc, ab_c, etc.

3. Functions

Composed of a function name and one or more arguments enclosed in parentheses. Multiple arguments are separated by commas (","). Arguments can be numbers, variables, functions, or expressions.

Example:sin(x) normalcd(x,μ,2) normalcd(x+y,ln(12),σ)

Constants without arguments do not use parentheses.

Example:pi inf e

4. Operators

Operators include + , - , * , / , ^ , ! , = and specify operations between elements such as numbers, variables, and functions.

ExampleDescription
element1 + element2Add element1 and element2
element1 - element2Subtract element2 from element1
element1 * element2Multiply element1 and element2 (* can be omitted)
element1 / element2Divide element1 by element2
element1 ^ element2Raise element1 to the power of element2
element1 !Factorial of element1 (single element operation)
element1 = element2Assign the result of element2 to element1. Therefore, element1 must be a variable.

5. Expressions

An expression is formed by combining elements (numbers, variables, functions) with operators. An expression can be used as an element and further combined with operators. The order of operations follows the "Order of Operations" section below. Example: element1 + element2 - element3 * element4 / element5 ^ element6 ! + ...

6. Other

The minus sign (-) is treated as a binary operator, except in exponent notation. However, at the beginning of an expression, or immediately after an opening parenthesis or comma, it is treated as a sign.

Example:-a+b → (0-a)+b -a^b → 0-(a^b) a^-b → Error a^(-b) → a^(0-b) a*b;-a*b → a*b;0-(a*b) a*-b → Error

Spaces can be used to make expressions more readable.

Order of Operations

  1. Operators with higher precedence are evaluated first.
  2. Operators of the same precedence are evaluated from left to right. *Exception: the exponentiation operator (^) is evaluated from right to left.
  3. Expressions inside parentheses are evaluated first.
  4. In nested parentheses, the innermost parentheses are evaluated first.

Operator types and precedence

PrecedenceOperatorMeaning
High ↑FunctionsBuilt-in functions
!!, !, ^Double factorial, factorial, exponentiation
*, /Multiplication, division
+, -Addition, subtraction
↓ Low=Assignment

Common mistakes in expression notation

Operation order when parentheses are omitted

ExpressionInterpretationDescription
2+3*4→2+(3*4)Multiplication has higher precedence than addition
3*4^5→3*(4^5)Exponentiation has higher precedence than multiplication
sin(2)^3→(sin(2))^3Functions have higher precedence than exponentiation
1/2i→1/(2i)Imaginary unit takes precedence
3!!!→(3!!)!Double factorial has higher precedence than factorial

Expressions with omitted multiplication sign

ExpressionResultDescription
3a○Calculated as 3*a
a3×a3 is a variable name
a(b+c)×Not a*(b+c); a is treated as a user-defined function
(a+b)(b+c)○Calculated as (a+b)*(b+c)

Numbers, Operators and Constants

Numbers

TypeExampleReserved Word
Numeric12345678900-9
Decimal point0.123.
Sign-123, +456+,-
Exponent1.23E-45E
Imaginary2+3ii

Operators

TypeExampleReserved Word
Additionx+y+
Subtractionx-y-
Multiplicationx*y*
Divisionx/y/
Exponentiationx^y^
Factorialn!!
Double factorialn!!!!
Assignmenta=123=

Multi-expression

TypeExampleReserved Word
Expression separatora=2+3; b=4/7;

Constants

TypeValueReserved Word
Base of natural logarithme =2.71828...e
Infinity∞inf
Piπ =3.14159..pi
Euler's constantγ =0.5772...euler
Truetrue =1true
Falsefalse =0false

Elementary Functions

Logarithmic and exponential functions

FunctionSymbolReserved Word
Square root√sqrt(x)
Common logarithmloglog(x)
Natural logarithmlnln(x)
Exponential functione^xe^x
Power functionx^yx^y

Trigonometric functions

FunctionSymbolReserved Word
Sinesinsin(x)
Cosinecoscos(x)
Tangenttantan(x)
Arcsinesin⁻¹asin(x)
Arccosinecos⁻¹acos(x)
Arctangenttan⁻¹atan(x)

Hyperbolic functions

FunctionSymbolReserved Word
Hyperbolic sinesinhsinh(x)
Hyperbolic cosinecoshcosh(x)
Hyperbolic tangenttanhtanh(x)
Inverse hyperbolic sinesinh⁻¹asinh(x)
Inverse hyperbolic cosinecosh⁻¹acosh(x)
Inverse hyperbolic tangenttanh⁻¹atanh(x)

Combinations and permutations

FunctionSymbolReserved Word
CombinationnCrcombination(n,r)
PermutationnPrpermutation(n,r)
Factorialx!x!
Double factorialx!!x!!

Numeric functions (real numbers)

FunctionExampleReserved Word
Greatest integer ≤ xint(4.2) =4, int(-4.2) =-5int(x)
Smallest integer ≥ xceiling(4.2) =5, ceiling(-4.2) =-4ceiling(x)
Integer partIP(4.2) =4, IP(-4.2) =-4IP(x)
Fractional partFP(4.2) =0.2, FP(-4.2) =-0.2FP(x)
Remainder of x divided by ymod(9,5) =4, mod(-9,5) =1mod(x,y)
y*FP(x/y)remainder(9,5) =4, remainder(-9,5) =-4remainder(x,y)
Roundround(2.35,1) =2.4, round(-2.35,1) =-2.4round(x,n)
Round downrounddown(2.34,1) =2.3, rounddown(-2.34,1) =-2.4rounddown(x,n)
Round uproundup(2.34,1) =2.4, roundup(-2.34,1) =-2.3roundup(x,n)
IP(x*10^n)/10^ntruncate(2.34,1) =2.3, truncate(-2.34,1) =-2.3truncate(x,n)
Random real numberrandom decimal number in [0,1]random_f()
Random real numberrandom decimal number in [a,b]random_f(a,b)
Random integerrandom integer number in [a,b]random_i(a,b)

Numeric functions (complex numbers)

FunctionDescriptionReserved Word
Signsign(z) =1,0,-1sign(z)
Complex conjugatex+iy → x-iyconjugate(z)
Real partx+iy → xRe(z)
Imaginary partx+iy → ylm(z)
Absolute value|z| =|re^(iθ)| =rabs(z)
Argumentre^(iθ) → θargument(z)
Cartesian conversionre^(iθ) → x+iycartesian(z)
Cartesian conversion(r,θ) → x+iycartesian(r,θ)
Polar conversionx+iy → re^(iθ)polar(z)
Polar conversion(x,y) → re^(iθ)polar(x,y)

Maximum and minimum

FunctionExampleReserved Word
Maximum (up to 20 arguments)max(1,2,3,4) = 4max(a,b,c,d,...)
Minimum (up to 20 arguments)min(1,2,3,4) = 1min(a,b,c,d,...)

Statistical Functions

Continuous distribution functions (Q: upper cumulative probability, f: probability density, x: percentile, λ: non-centrality parameter)

FunctionReserved Word
Standard normal distributionQ: normalcd(x) f: normalpd(x) x: normalicd(Q)
Normal distributionQ: normalcd(x,μ,σ) f: normalpd(x,μ,σ) x: normalicd(Q,μ,σ)
Log-normal distributionQ: lognormalcd(x,μ,σ) f: lognormalpd(x,μ,σ) x: lognormalicd(Q,μ,σ)
Chi-squared distributionQ: chi2cd(x,ν) f: chi2pd(x,ν) x: chi2icd(Q,ν)
Student's t-distributionQ: tcd(x,ν) f: tpd(x,ν) x: ticd(Q,ν)
F-distributionQ: fcd(x,ν1,ν2) f: fpd(x,ν1,ν2) x: ficd(Q,ν1,ν2)
Noncentral chi-squared distributionQ: ncchi2cd(x,ν,λ) f: ncchi2pd(x,ν,λ) x: ncchi2icd(Q,ν,λ) λ: ncchi2il(P,x,ν)
Noncentral t-distributionQ: nctcd(x,ν,λ) f: nctpd(x,ν,λ) x: ncticd(Q,ν,λ) λ: nctil(Q,x,ν)
Noncentral F-distributionQ: ncfcd(x,ν1,ν2,λ) f: ncfpd(x,ν1,ν2,λ) x: ncficd(Q,ν1,ν2,λ) λ: ncfil(Q,x,ν1,ν2)
Uniform distributionQ: uniformcd(x,a,b) f: uniformpd(x,a,b) x: uniformicd(Q,a,b)
Exponential distributionQ: exponentialcd(x,b) f: exponentialpd(x,b) x: exponentialicd(Q,b)
Weibull distributionQ: weibullcd(x,a,b) f: weibullpd(x,a,b) x: weibullicd(Q,a,b)
Gamma distributionQ: gammacd(x,a,b) f: gammapd(x,a,b) x: gammaicd(Q,a,b)
Beta distributionQ: betacd(x,a,b) f: betapd(x,a,b) x: betaicd(Q,a,b)
Laplace distributionQ: laplacecd(x,a,b) f: laplacepd(x,a,b) x: laplaceicd(Q,a,b)
Cauchy distributionQ: cauchycd(x,a,b) f: cauchypd(x,a,b) x: cauchyicd(Q,a,b)
Logistic distributionQ: logisticcd(x,α,β) f: logisticpd(x,α,β) x: logisticicd(Q,α,β)
Pareto distributionQ: paretocd(x,xm,α) f: paretopd(x,xm,α) x: paretoicd(Q,xm,α)
Generalized Pareto distributionQ: gparetocd(x,μ,σ,ξ) f: gparetopd(x,μ,σ,ξ) x: gparetoicd(Q,μ,σ,ξ)
Levy distributionQ: levycd(x,μ,c) f: levypd(x,μ,c) x: levyicd(Q,μ,c)

Note: For lower cumulative probability P, append "lower" to the reserved word. Example: P=normalcdlower(x), x=normalicdlower(P)

Discrete distribution functions (Q: upper cumulative probability, f: probability density, x: percentile, λ: non-centrality parameter)

FunctionReserved Word
Poisson distributionQ: poissoncd(x,λ) f: poissonpd(x,λ) x: poissonicd(Q,λ) λ: poissonil(Q,x)
Binomial distributionQ: binomialcd(x,n,p) f: binomialpd(x,n,p) x: binomialicd(Q,n,p)
Negative binomial distributionQ: negbinomialcd(x,k,p) f: negbinomialpd(x,k,p) x: negbinomialicd(Q,k,p)
Geometric distributionQ: geometriccd(x,p) f: geometricpd(x,p) x: geometricicd(Q,p)
Hypergeometric distributionQ: hypgeometriccd(x,n,M,N) f: hypgeometricpd(x,n,M,N)

Note: For lower cumulative probability P, append "lower" to the reserved word. Example: P=poissoncdlower(x,λ), x=poissonicdlower(P,λ), λ=poissonillower(P,x)

Bessel Functions

Bessel functions (f(x), f'(x), f⁻¹(0) s=1,2,.., f'⁻¹(0) s=1,2..)

FunctionSymbolReserved Word
Bessel function of the first kindJν(x)besselj(ν,x) besseljdf(ν,x) besseljzeros(ν,s) besseljdfzeros(ν,s)
Bessel function of the second kindYν(x)bessely(ν,x) besselydf(ν,x) besselyzeros(ν,s) besselydfseros(ν,s)
Modified Bessel function of the first kindIν(x)besseli(ν,x) besselidf(ν,x)
Modified Bessel function of the second kindKν(x)besselk(ν,x) besselkdf(ν,x)
Hankel function of the first kindH⁽¹⁾ν(x)hankelH1(ν,x) hankelH1df(ν,x)
Hankel function of the second kindH⁽²⁾ν(x)hankelH2(ν,x) hankelH2df(ν,x)

Spherical Bessel functions

FunctionSymbolReserved Word
Spherical Bessel function of the first kindjν(x)sphericalbesselj(ν,x) spherical besseljdf(ν,x) spherical besseljzeros(ν,s) spherical besseljdfzeros(ν,s)
Spherical Bessel function of the second kindyν(x)sphericalbessely(ν,x) sphericalbesselyjdf(ν,x) sphericalbesselyzeros(ν,s) sphericalbesselydfzeros(ν,s)
Modified spherical Bessel function of the first kindiν(x)sphericalbesseli(ν,x) sphericalbesselidf(ν,x)
Modified spherical Bessel function of the second kindkν(x)sphericalbesselk(ν,x) sphericalbesselkdf(ν,x)
Spherical Hankel function of the first kindh⁽¹⁾ν(x)sphericalhankelH1(ν,x) sphericalhankelH1df(ν,x)
Spherical Hankel function of the second kindh⁽²⁾ν(x)sphericalhankelH2(ν,x) sphericalhankelH2df(ν,x)

Airy functions (f(x), f'(x), f⁻¹(0) s=1,2,.., f'⁻¹(0) s=1,2..)

FunctionSymbolReserved Word
Airy functionAi(x)airyai(x) airyaidf(x) airyaizeros(s) airyaidfzeros(s)
Airy functionBi(x)airybi(x) airybidf(x) airybizeros(s) airybidfzeros(s)

Kelvin functions (f(x), f'(x))

FunctionSymbolReserved Word
Kelvin function of the first kindberν(x)ber(ν,x) berdf(ν,x)
Kelvin function of the first kindbeiν(x)bei(ν,x) beidf(ν,x)
Kelvin function of the second kindkerν(x)ker(ν,x) kerdf(ν,x)
Kelvin function of the second kindkeiν(x)kei(ν,x) keidf(ν,x)
Kelvin function of the third kindherν(x)her(ν,x) herdf(ν,x)
Kelvin function of the third kindheiν(x)hei(ν,x) heidf(ν,x)

Special Functions

Gamma functions

FunctionSymbolReserved Word
Gamma functionΓ(a)gamma(a)
Lower incomplete gamma functionγ(a,x)igamma1(a,x)
Upper incomplete gamma functionΓ(a,x)igamma2(a,x), gamma(a,x)
Regularized lower gamma functionγ(a,x)/Γ(a)gammap(a,x)
Regularized upper gamma functionΓ(a,x)/Γ(a)gammaq(a,x)
Log gamma functionlnΓ(a)lngamma(a)
Digamma functionΨ(a)polygamma(a)
Polygamma functionΨ⁽ⁿ⁾(a)polygamma(n,a)
Double factorialx!!x!!
Pochhammer function(x)npochhammer(x,n)

Beta functions

FunctionSymbolReserved Word
Beta functionB(a,b)beta(a,b)
Incomplete beta functionIx(a,b)y: ibeta(x,a,b) x: ibetaix(y,a,b)
Incomplete beta functionI₁₋ₓ(a,b)y: ibetac(x,a,b) x: ibetacix(y,a,b)

Error functions

FunctionSymbolReserved Word
Error functionerf(x)y: erf(x) x: erfix(y)
Complementary error functionerfc(x)y: erfc(x) x: erfcix(y)
Imaginary error functionerfi(x)y: erfi(x)

Elementary function integrals and Fresnel integrals

FunctionSymbolReserved Word
Exponential integralEi(x)Ei(x)
Exponential integralEn(x)Ei(n,x)
Logarithmic integralli(x)li(x)
Sine integralSi(x)Si(x)
Cosine integralCi(x)Ci(x)
Hyperbolic sine integralShi(x)Shi(x)
Hyperbolic cosine integralChi(x)Chi(x)
Fresnel sine integralS(x)fresnelS(x)
Fresnel cosine integralC(x)fresnelC(x)

Elliptic integrals and elliptic functions

FunctionSymbolReserved Word
Complete elliptic integral of the first kindK(k)ellipticK(k)
Complete elliptic integral of the second kindE(k)ellipticE(k)
Complete elliptic integral of the third kindΠ(n,k)ellipticPi(n,k)
Incomplete elliptic integral of the first kindF(x,k)ellipticF(x,k)
Incomplete elliptic integral of the second kindE(x,k)ellipticE(x,k)
Incomplete elliptic integral of the third kindΠ(x,n,k)ellipticPi(x,n,k)
Jacobi sn functionsn(u)jacobiSN(u,k)
Jacobi cn functioncn(u)jacobiCN(u,k)
Jacobi dn functiondn(u)jacobiDN(u,k)
Amplitude functionam(u)jacobiAM(u,k)

Orthogonal polynomials

FunctionSymbolReserved Word
Hermite polynomialHn(x)hermiteH(n,x)
Chebyshev polynomial of the first kindTn(x)chebyshevT(n,x)
Chebyshev polynomial of the second kindUn(x)chebyshevU(n,x)
Legendre polynomialPn(x)legendreP(n,x)
Associated Legendre polynomialPn(m,x)legendreP(n,m,x)
Laguerre polynomialLn(x)laguerreL(n,x)
Associated Laguerre polynomialLn(α,x)laguerreL(n,α,x)
Gegenbauer polynomialCn(λ,x)gegenbauerC(n,λ,x)
Jacobi polynomialPn(α,β,x)jacobiP(n,α,β,x)

Other special functions

FunctionSymbolReserved Word
Confluent hypergeometric function1F1(a;b;x)F11(a,b,x)
Confluent hypergeometric functionU(a;b;x)FU11(a,b,x)
Gauss hypergeometric function2F1(a,b;c;x)F21(a,b,c,x)
Bernoulli numberBnbernoulli(n)
Riemann zeta functionζ(x)zeta(x)

Programming

A simple C-like programming system specialized for numerical computation.

Flow control statements

Reserved WordDescription
if(condition){expr;...} elseif(condition){expr;...} else{expr;...}Executes the block if the if condition is true. If false, evaluates the elseif condition similarly. Exits the if statement after executing the matching block.
while(condition){expr;...}Executes the block if the condition is true. Repeats until the condition becomes false.
do{expr;...} while(condition);Executes the block unconditionally. If the condition is true, executes again; if false, exits.
for(variable=initial; condition; variable=variable+step) {expr;...}Initializes the variable, and executes the block if the condition is true. Increments the variable and repeats while the condition is true; exits when false.
breakUnconditionally exits the loop
continueUnconditionally returns to the beginning of the loop

Output statements

Reserved WordDescription
print(expr1,expr2,...)Outputs expressions
println(expr1,expr2,...)Outputs expressions followed by a newline
/*comment*/Does not affect calculations or control flow

Logical operators and values

CategoryReserved WordDescription
Logical operatornotPrecedence: not > and > or
Logical operatorand
Logical operatoror
Logical operator==Left expression equals right expression
Logical operator<>Left expression does not equal right expression
Logical operator=<, <=Left expression is less than or equal to right expression
Logical operator=>, >=Left expression is greater than or equal to right expression
Logical operator<Left expression is less than right expression
Logical operator>Left expression is greater than right expression
Logical valuetruetrue=1 (≠0)
Logical valuefalsefalse=0

Arrays

Reserved WordDescriptionExample
numeric arrayname[size]; numeric arrayname[size][size]; numeric arrayname[size][size][size]; ....Declares an array.numeric test1[4]; numeric test2[4][4]; numeric test3[4][4][4];
numeric arrayname[] = {val1,val2,...}; numeric arrayname[][] = {{....},{....}}; ....Declares and initializes an array.numeric test1[] = {1,2,3}; numeric test2[][] = {{1,2,3},{4,5,6}}; numeric test3[][][] = {{{1,2},{3,4}},{{5,6},{7,8}}};
kei_length(a)Gets the number of elements in an array.numeric test[4]; n = kei_length(test);
function funcname(numeric k[]){...}Specifies an array as a function argument.numeric test[]={0,1,2,3}; func1(test); function func1(numeric k[]) { print(k[0]); ..... }