反对数在计算机术语里一般被叫做指数,记成exp,你看看你的gnome计算器里有没有那个按键。
至于bc里面怎么用,在命令行输入man bc可以得到bc的手册,向下翻几下页看到如下内容- MATH LIBRARY
- If bc is invoked with the -l option, a math library is preloaded and the default scale is set to 20. The math functions
- will calculate their results to the scale set at the time of their call. The math library defines the following functions:
- s (x) The sine of x, x is in radians.
- c (x) The cosine of x, x is in radians.
- a (x) The arctangent of x, arctangent returns radians.
- l (x) The natural logarithm of x.
- e (x) The exponential function of raising e to the value x.
- j (n,x)
- The bessel function of integer order n of x.
复制代码
可见如果要计算自然对数,用 l(x) ,要计算指数(反对数)用 e(x)。注意要用-l参数才能让bc加载数学库。
举个例子: 就是计算以e为底的,指数为13次方的幂。
这里我用了命令行的管道功能,你也可以先在命令行 bc -l 进入文本交互模式,然后 e(13),得到结果后输入quit退出bc。 |