如何用java解决方程? [英] How to Solve Equations with java?
本文介绍了如何用java解决方程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有三个等式如下:
- x + y + z = 100;
- x + y - z = 50;
- x - y - z = 10;
如何用Java找到x,y和z的值?
How can I find the values of x, y, and z with Java?
String equation1="x+y+z=100;";
String equation2="x+y-z=50;";
String equation3="x-y-z=10;";
int[] SolveEquations(equation1,equation2,equation3) {
// to do
// how to do?
}
您有任何可能的解决方案或其他常见框架吗?
Do you have any possible solutions or other common frameworks?
推荐答案
您可以使用行列式计算xy和z的值。
逻辑可以在这里找到 http://www.intmath.com/Matrices -determinants / 1_Determinants.php
You can use determinant to calculate values of x y and z. Logic can be found out here http://www.intmath.com/Matrices-determinants/1_Determinants.php
然后你需要在java中使用3维数组实现它。
And then you need to implement it in java using 3 dimensional arrays.
这篇关于如何用java解决方程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文