/**
* @param args
*/
public static void main(String[] args) {
//Expression exp = new Expression("0.8*(x-2)/(5-2)+0.2");
//Expression exp1 = new Expression("Math.pow(0.8,-(x-200)/100)+0.2");
TestMain0308 t = new TestMain0308();
String s = "0.8*(1/e pow ((x-200)/100))+0.2";
System.out.println(s.contains("e"));//判断字符串中是否包含指定的字符
double tvalue = 0.8*Math.pow(Math.E,-(220-200)/100)+0.2;
//Expression exp1 = new Expression("0.8*(2.71828 pow (-(x-200)/100))+0.2");
Expression exp1 = new Expression("0.8*(1/e pow ((x-200)/100))+0.2");
Map variables = new HashMap();
variables.put("x", newBigDecimal("200"));
variables.put("e", newBigDecimal(Math.E));
BigDecimal result = exp1.eval(variables); //计算表达式的值
String str = String.valueOf(result); //转换成字符串
System.out.println(result);
System.out.println(tvalue);
System.out.println("result="+str);
}
下载次数: 309
分享到:
2011-03-09 22:41
浏览 17923
评论