gpt4 book ai didi

java - 运行大于 64k 的 java 类以求解非线性方程组

转载 作者:搜寻专家 更新时间:2023-10-30 21:17:37 28 4
gpt4 key购买 nike

<分区>

我正在尝试解决 Java 中的非线性函数系统。特别是我有 3 个方程和 3 个未知变量。虽然我设法解决了简单的方程式,但我的最终目标是解决一些相当大的问题。例如,每个方程由数百行(有时甚至数千行)组成:

 public static double f2 (double x, double y, double z) {
double result = (0.49*Math.exp(-y - x)*Math.pow(x,2)*
(1 - Math.pow(z,94)*(0.00666 +
0.98*Math.exp(-y - x) + 0.98*Math.exp(-y - x)*
y*x + 0.245*Math.exp(-y - x)*Math.pow(y,2)*
Math.pow(x,2) + 0.02722*
Math.exp(-y - x)*Math.pow(y,3)*Math.pow(x,3) +
0.00170*Math.exp(-y - x)*
Math.pow(y,4)*Math.pow(x,4) + 0.00006*
Math.exp(-y - x)*Math.pow(y,5)*Math.pow(x,5) +
1.89043*Math.pow(10,-6)*Math.exp(-y - x)*
Math.pow(y,6)*Math.pow(x,6) + 3.85802*Math.pow(10,-8)*
Math.exp(-y - x)*Math.pow(y,7)*Math.pow(x,7) +
6.02816*Math.pow(10,-10)*Math.exp(-y - x)*
Math.pow(y,8)*Math.pow(x,8) + 7.44217*Math.pow(10,-12)*
Math.exp(-y - x)*Math.pow(y,9)*Math.pow(x,9) +
7.44217*Math.pow(10,-14)*Math.exp(-y - x)*
Math.pow(y,10)*Math.pow(x,10))))/(0.01333 +
0.98*Math.exp(-y - x)*y +
0.49*Math.exp(-y - x)*Math.pow(y,2) +
0.16333*Math.exp(-y - x)*Math.pow(y,3) +
0.04083*Math.exp(-y - x)*Math.pow(y,4) +
0.00816*Math.exp(-y - x)*Math.pow(y,5) + .....

问题是我的两个类(class)明显大于 65k,特别是 650k/类(class),所以我超出了限制。

有没有办法运行/编译我的代码,克服这个限制?

我的 3 个方程是从另一种语言 (wolfram) 生成的,但我需要在 java 中实现我的目标(数学/matlab 等不是 n 选项)。

这个答案建议使用 .properties,但我看不出这对我的情况有何帮助 ("Code too large" compilation error in Java)

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com