我如何在 exp4j 编译器中定义 Ln java

How I can define Ln in exp4j compiler java

我正在制作 android 计算器,所以我想在 exp4j 编译器中定义 Ln (2.303*Math.log10(number)):http://www.objecthunter.net/exp4j/

但我不想手动输入数字所有操作都存储在字符串结果中 所以我想在你看到Ln做这个操作的时候告诉编译器(2.303*Math.log10(number))

String txt = txt_Screen.getText().toString();


    try {
        // Calculate the result and display
       // if(txt.contains("ln")) {
         //   txt.replace("ln",)
        Expression expression = new ExpressionBuilder(txt).build();
        double result = expression.evaluate();
        if ((result == Math.floor(result)) && !Double.isInfinite(result)) {


            result_Screen.setText((int) result + "");
        }else
            result_Screen.setText(result+"");


       // double result = expression.evaluate();



    } catch (Exception ex) {
        txt_Screen.setText("Syntax Error");

    }
    String txt = txt_Screen.getText().toString();


try {
    // Calculate the result and display
   // if(txt.contains("ln")) {
     //   txt.replace("ln",)

 **Function ln = new Function("ln", 1) {
 @Override
 public double apply(double... args) {
    return 2.303*Math.log10(args[0]);
 }
 };**
    Expression expression = new 
ExpressionBuilder(txt).**function(ln)**.build();
    double result = expression.evaluate();
    if ((result == Math.floor(result)) && !Double.isInfinite(result)) {


        result_Screen.setText((int) result + "");
    }else
        result_Screen.setText(result+"");


   // double result = expression.evaluate();



} catch (Exception ex) {
    txt_Screen.setText("Syntax Error");

}