Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 10 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(8)
也许您可以使用 CAS,例如 MATLAB,Octave Octave 是开源的
,我相信它有 Java 绑定 (joPas)。
编辑:
带有符号工具箱的 MATLAB 可以解决很多问题。 Octave也有一些符号工具箱,但我不知道它有多好。
我推荐 Octave 因为它是开源的。大多数 CAS 都非常昂贵。
Maybe you can use a CAS like MATLAB, Octave, etc.
Octave is open Source and I believe it has a Java binding (joPas).
Edit:
MATLAB with a symbolic toolbox can solve a lot. Octave also have some symbolic toolbox, but I don't know how good it is.
I propose Octave because it is open source. Most CASes are very expensive.
如果您研究将表达式从中缀转换为后缀和后缀的数据结构算法,那就更好了。到&来回。然后在数据结构中有一个计算表达式的算法。该评估是通过使用堆栈来完成的。
你可以学习一下数据结构书籍。其中一些书籍是 数据结构基础知识” “http://www.amazon.com/Ellis-Horowitz/e/B001HCW8VO/ref=ntt_athr_dp_pel_1”rel="nofollow noreferrer">埃利斯·霍洛维茨,Schaum 的 Java 数据结构概要等
It is better if you study the data structure algorithms for converting expressions from infix to postfix & to & fro. Then in the data structure there is an algorithm for evaluating expressions. This evaluation is done by using a stack.
You can study the data structure books. Some of the books are "Fundamentals of data structures" by Ellis Horowitz, Schaum's Outline of Data Structures with Java, etc.
一种可能性是使用通过 ABCL 编译的 Maxima 来求解方程(并执行您需要的任何其他代数)。 ABCL 是 Common Lisp 在 Java 中的实现。您的前端程序将获取输入并将其传递给 Maxima 来解决它,然后显示结果。本质上,您可以将 Maxima 用作大型数学库。
One possibility is to use Maxima compiled with ABCL to solve the equations (and do any other algebra you need). ABCL is an implementation of Common Lisp in Java. Your front end program would take the input and pass it to Maxima to solve it, then display the result. Essentially you could use Maxima as a big math library.
您可以将 x 的系数映射到 x 的幂。例如;
假设你有一个这样的公式:
3x^2 - 5x + C = 0
但这种简单的方法仅适用于小次方程。例如,我给出的方程的次数为 2(最大 x 次方);因此它有 2 个 x 的解值,并且可以用 Vieta 方程计算。
PS: 我在大学学习数学工程,我对 Gnu Octave 非常满意。
http://mathworld.wolfram.com/PolynomialRoots.html
http://en.wikipedia.org/wiki/Root-finding_algorithm
You can map coefficients of x to power of x's. For example;
assume you have a formula like this:
3x^2 - 5x + C = 0
But this simple approach is just for small degree equations. For example equation i gave is in degree of 2 (biggest x power); so it has 2 solution values for x, and can be computed with Vieta equations.
PS: I'm studying Math Engineering in college and i'm pretty satisfied with Gnu Octave.
http://mathworld.wolfram.com/PolynomialRoots.html
http://en.wikipedia.org/wiki/Root-finding_algorithm
我在我的 Java 代数系统 (JAS) 库 中使用="http://code.google.com/p/symja/" rel="nofollow noreferrer">Symja 项目用于求解单变量多项式。
符号模式的输入示例:
I'm using the Java Algebra System (JAS) library in my Symja project to solve univariate polynomials.
Example input for the symbolic mode:
正如 @nuriaion 建议你可以使用计算机代数系统,尽管我认为 Mathematica 或 Maple 或 Sage 或 Macsyma 会是更好的建议。还有其他人。我不确定很多人会将 Matlab 或 Octave 视为 CAS,它们更像是数值计算环境。尽管 Matlab Symbolic Toolbox 可能会提供足够的 CAS 功能来满足您的需求。
将 Mathematica 集成到 Java 编程系统中相对容易。请注意,可能并不便宜。
As @nuriaion suggests you could use a Computer Algebra System, though I think that Mathematica or Maple or Sage or Macsyma would have been better suggestions. There are others too. I'm not sure that many would regard either Matlab or Octave as CAS, they are more like numerical computing environments. Though the Matlab Symbolic Toolbox might provide enough CAS-ability for your needs.
It is relatively easy to integrate Mathematica into a Java-programmed system. Possibly not cheap mind you.
我不认为这是一项作业(太难了!),而且我也不认为这是一个研究问题(有什么新内容?),所以根据问题的背景,最简单的解决方案可能就是利用沃尔夫拉姆·阿尔法。
链接
I don't think this is a homework (way too hard!), and I don't think it's a research problem either (what's new?), so depending on the context of the problem, the easiest solution may just be to leverage Wolfram Alpha.
Links
这是一个难题,除非您将自己限制在简单的方程类型上。
以下是一些供您追踪的链接:
通过第二个链接,我发现了 3 个开源 Java 系统。
This is a hard problem, unless you restrict yourself to simple equation types.
Here are some links for you to chase:
Trawling through the second link, I spotted 3 open-source Java systems.