Java如何计算指数函数?
在数学中,指数函数是函数ex,其中e是使得函数ex等于自己的导数的数字(大约2.718281828)。该函数f(x)=ex在点x=0处等于1。
package org.nhooo.example.math;
public class ExponentExample {
public static void main(String[] args) {
double x = 0.0d;
// 计算e升到x(e ^ x)的幂
double fx = Math.exp(x);
// 计算e提高到x减1的幂(e ^ x-1)
double fxm1 = Math.expm1(x);
System.out.println("fx = " + fx);
System.out.println("fxm1 = " + fxm1);
}
}
热门推荐
10 祝孙辈生日祝福语简短
11 恋人跨年祝福语大全简短
12 考大学敬酒简短祝福语
13 开工投产大吉祝福语 简短
14 偶然结婚祝福语朋友简短
15 感谢学长学姐祝福语简短
16 戏精的祝福语简短
17 我要结婚祝福语简短
18 婚前女儿生日祝福语简短