本文介绍了将一个字符串转换数学方程式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是个初学者。我想一个字符串转换成数学公式,以便我的图形计算器的输入
例如:

I'm a beginner. I want to convert a string into a mathematical equation in order to be the input of my graphic calculator for example:

COS(X + 1)+ LN(X)

所以我们将它转​​换为

so we will convert it to

double x = -10;
for (int i=0; i<100; i++) { 
double y=Math.cos(x+1)+Math.log(x)
x=x+0.5         
}

所以我想知道转换y的方法

so I want to know a method of converting y

感谢您

推荐答案

有没有在java中乱用的解决方案这一点。

There is no "out-of-the-box" solution in java for this.

但是:
强制性的答案:谷歌 - >字符串转换为数学EX pression Java的前几个答案是pretty好(如:<一href=\"http://stackoverflow.com/questions/2226863/whats-a-good-library-for-parsing-mathematical-ex$p$pssions-in-java\">What's一个好的图书馆在Java解析数学EX pressions?)
强制性的回答2:有在网上为将字符串转换成数学EX pressions,命名它们是题外话根据规则相当多的图书馆,所以我建议强制性回答最初的几个点击

However:Obligatory answer: google -> "convert string to mathematical expression java" first few answers are pretty good (like: What's a good library for parsing mathematical expressions in java? )Obligatory answer 2: There are quite a few libraries on the net for converting strings into math expressions, naming them would be off-topic according to the rules, so I suggest "Obligatory answer" first few hits.

也最有可能你选择,你会得到一个更好的格式关闭,写自己该格式分析器。

Also most likely you are better off by choosing a Format you will receive, and write your own parser for that format.

这篇关于将一个字符串转换数学方程式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 13:48