英文:
Using electron in a formula in java
问题
答案1
得分: 1
你可以使用java.lang.Math.exp()方法来计算e^x。以下是一个例子:
public static void main(String[] args) 
{
    double a = 2.0;
    System.out.println(Math.exp(a));
}
//输出结果 = 7.38905609893065
你可以通过以下链接了解更多信息:https://www.javatpoint.com/java-math-exp-method
英文:
you can use java.lang.Math.exp() method to calculate e^x.
here is an example
`
public static void main(String[] args) 
{
    double a = 2.0;
    System.out.println(Math.exp(a));
}
//output = 7.38905609893065
`
you can read more about this using this link.
https://www.javatpoint.com/java-math-exp-method
答案2
得分: 0
你可以使用Math.exp()。
示例:
import java.lang.Math;
// 在主函数内部
Math.exp(1.0);        // e^1
Math.exp(1.6);        // e^1.6
英文:
You could use Math.exp().
Example:
import java.lang.Math;
// inside main
Math.exp(1.0);        // e^1
Math.exp(1.6);        // e^1.6
答案3
得分: -1
import java.lang.Math;
class Answer {
    // 驱动代码
    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);
}
英文:
import java.lang.Math; 
  
class Answer { 
  
    // 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)); 
    } 
//you can use Math.pow(e,x);
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论