bc is a powerful, yet somewhat minimalistic "basic calculator' for *ix environments. It is a pure command line tool which offers floating point arithmetics of arbitrary precision as well as large number arithmetics. For further information on bc, visit [https://www.gnu.org/software/bc/manual/html_mono/bc.html](GNU bc's documentations)
These files can be "imported" in bc by passing them to bc on the
command line. Make sure, the -l
flag is set:
bc -l extensions.bc scientific_constants.bc
In extensions.bc
I mathematical constants
- pi : defined as 4*atan(1)
- e : defined as e(1)
II trigonometry
- sin(x) : returns sine of x
- cos(x) : returns cosine of x
- atan(x) : returns arc tangent of x
- tan(x) : returns tangent of x
- asin(x) : returns arc sine of x
- acos(x) : returns arc cosine of x
- cot(x) : returns cotangent of x
- acot(x) : returns arc cotangent of x
- sec(x) : returns secans of x
- cosec(x),csc(x) : returns cosecans of x
- asec(x) : returns arc secans of x
- acosec(x),ascs(x) : returns arc cosecans of x
- sinh(x) : returns hyperbolical sine of x
- cosh(x) : returns hyperbolical cosine of x
- tanh(x) : returns hyperbolical tangent of x
- coth(x) : returns hyperbolical cotangent of x
- asinh(x) : returns arc hyperbolical sine of x
- acosh(x) : returns arc hyperbolical cosine of x
- atanh(x) : returns arc hyperbolical tangent of x
- acoth(x) : returns arc hyperbolical cotangent of x
- sech(x) : returns secans hyperbolicus of x
- cosech(x),csch(x) : returns cosecans hyperbolicus of x
- asech(x) : returns arc secans hyperbolicus of x
- acosech(x),acsch(x) : returns arc cosecans hyperbolicus of x
III exponential functions
- ln(x) : returns natural logarithm of x
- log(x) : returns logarithm (base 10) of x
- lb(x),ld(x) : returns logarithm (base 2) of x
- pow(x,y) : returns x to the power of y
IV number theory
- abs(n) : returns absolute value of n
- mod(a,b) : returns a modulo b
- factorize(n),fac(n) : prints primefactors of n; returns number of primefactors; returns 0 if n is a prime number; returns -1 if n is +-1 or 0. CAUTION: 13-digit number may need 30 s
- factorial(n),f(n) : returns n factorial
- gcd(a,b) : returns the greatest common divisor of a and b
- lcm(a,b) : returns the least common multiple of a and b
- bessel(n,x) : returns the Bessel function order n of x
In scientific_constants.bc
I particle masses
- mp: proton rest mass in kg
- mn: neutron rest mass in kg
- me: electron rest mass in kg
- mpev: proton rest mass in eV
- mnev: neutron rest mass in eV
- meev: electron rest mass in eV
II general physical constants
- c: speed of light in the vacuum in m/s
- h: Planck constant in Js
- hbar: Planck constant divided by 2*pi in Js
- kb: boltzmann constant in J/K
- ec: elementary charge in C
- na: avogadro number in 1/mol
- epsilon0: dielectric constant in C^2/Jm
- mu0: permeability of vacuum in T^2*m^3/J
- alpha: fine structure constant
- mub: Bohr magneton J/T
- mun: nuclear magneton J/T
- ge: free electron g factor
- gammae: free electron gyromagnetic ratio in T/s
- mue: electron magnetic moment
- gammap: proton gyromagnetic ratio in water in T/s
- mup: proton magnetic moment in J/T
- amu: atomic mass unit in kg
- a0: Bohr radius in m
- re: electron radius in m
- vmol: molar volume in l/mol
- gh: proton g factor (lande factor)
- grav: gravitational constant m^3/kg*s^2
- g: acceleration due to gravity on surface of earth in m/s^2
- lambdac: compton wavelength of the electron m
in prime_numbers.bc
prime numbers from 0 - 821641, i.e. first 65536 primes