Apache の commons-math-2.2.jar を使用して線形方程式を解こうとしています。
3 つの小さな点については、正しい結果が得られます。
次のデータ(大きな数)を使用すると、正しい結果が得られず、むしろ結果が意味をなさないと言えます。
以下は、私が使用しているコードとデータです:
double [][]matrixPoint= new double[][]{{1,80,6400,512000,4.096*Math.pow(10, 7)},{1,100,10000,1000000,1.0*Math.pow(10, 8)},{1,120,14400,1728000,2.073*Math.pow(10, 8)},{1,160,25600,4096000,6.553*Math.pow(10, 8)},{1,200,40000,8000000,1.6*Math.pow(10, 9)}};
double [] matrixVector=new double[]{300,350,300,350,250};
RealMatrix coefficients =
new Array2DRowRealMatrix(matrixPoint,false);
DecompositionSolver solver = new LUDecompositionImpl(coefficients).getSolver();
// RealVector constants = new ArrayRealVector(new double[] { 1, -2, 1 }, false);
RealVector constants = new ArrayRealVector(matrixVector, false);
RealVector solution = solver.solve(constants);
System.out.println("The values are:"+Math.round(solution.getEntry(0))+":"+Math.round(solution.getEntry(1))+":"+Math.round(solution.getEntry(2))+":"+Math.round(solution.getEntry(3))+":"+Math.round(solution.getEntry(4)));
API に制限はありますか?線形方程式を解くための他のライブラリを知っている場合は、お知らせください。
前もって感謝します
ラケシュ