import java.lang.Math;
班级答案{
// driver code
public static void main(String args[])
{
double a = 30;
double b = 2;
System.out.println(Math.pow(a, b));
a = 3;
b = 4;
System.out.println(Math.pow(a, b));
a = 2;
b = 6;
System.out.println(Math.pow(a, b));
}
//您可以使用Math.pow(e,x);
您可以使用java.lang.Math.exp()方法来计算e ^ x。这是一个例子
`
public static void main(String[] args)
{
double a = 2.0;
System.out.println(Math.exp(a));
}
//output = 7.38905609893065
`
您可以使用此链接阅读有关此内容的更多信息。https://www.javatpoint.com/java-math-exp-method
您可以使用Math.exp()。
示例:
import java.lang.Math;
// inside main
Math.exp(1.0); // e^1
Math.exp(1.6); // e^1.6