Using an opensource app, Sensi -Shake to open app, my terminal emulator is opened each time I shake my smartphone, there I run the bc command since I like bc more than the smartphone calculator.
In order to use bc as a scientific calculator, just run it as:
bc -l
It only works in radians, so you should learn how to convert radians to degrees. You may use a simple rule of three.
Consider that 180 degrees equals to 4*a(1)
Variables
You can declare a variable straightforwardly:
a=5
Do not confuse with the following expression:
a==5 which is a logical evaluation that may return true or false.
Scientific notation
I improvised the scientific notation with the following code in bc:
a=0
if (x>10000) {
while (x>=10) {
x=x/10
a=a+1 }
x; a
}
if (x<0.0001) {
while (x<1) {
x=x*10
a=a+1 }
x; -a
}
The basic
π | 4*a(1) |
e | e(1) |
nth(y) root: | e(l(x)/y) |
Square root: | sqrt(x) |
Transcendental functions
Natural logarithm | l(x) |
Common logarithm | l(x)/l(10) |
Trigonometric functions:
sin | s(x) |
cos | c(x) |
tan | s(x)/c(x) |
sec | 1/c(x) |
ctg | c(x)/s(x) |
csc | 1/s(x) |
arctg | a(x) |
arcctg | 2*a(1)-a(x) |
arccsc | a(1/x) |
Arccosine:
if (x== 0) {
90 } else {
a(sqrt(1/(x^2)-1))
}
Arcsine:
if (x==1) {
90 } else {
a(sqrt(1/(1-(x^2))-1))
}
Arc secant:
There is not an integrated function for arcsine, so use the following formula:
2*a(1)-arcsin(1/x)
Factorial function:
In a bash shell run the following and substitute 500 with the desired number:
seq -s "*" 1 500 | bc