Java Math.pow和方法调用
我正在写一个从给定的数列中识别多项式函数的方法Java Math.pow和方法调用,java,Java,我正在写一个从给定的数列中识别多项式函数的方法 public void updateSequence(Term t) { for (int i = 0; i <= sequence.length; i++) { sequence[i] = sequence[i] - t(c) * Math.pow(i, t(e)); } } 然后在上面的方法中使用它。我需要找到基本上是系数*I^指
public void updateSequence(Term t) {
for (int i = 0; i <= sequence.length; i++) {
sequence[i] = sequence[i] - t(c) * Math.pow(i, t(e));
}
}
然后在上面的方法中使用它。我需要找到基本上是系数*I^指数的项,然后将其保存回序列中,以便再次通过迭代运行
这些是学期课程的内容
public class Term {
term = coefficient * x ^ exponent
private double coefficient;
private int exponent;
public Term(double c, int e) {
coefficient = c;
exponent = e;
}
// returns the coefficient
public double getCoefficient() {
return coefficient;
}
// returns the exponent
public int getExponent() {
return exponent;
}
// returns the term as a String for display
// see the sample file for the layout required
public String display() {
// TODO
String tocompile = "tocompile";
return tocompile;
}
}
应该是t.getCoefficientShare你的方法getcoefficients你能显示类术语的内容吗?如果我使用t.getCoefficient,它只是说找不到变量getcoefficiency,这是同样的错误。我明白了。大部分都是打字错误对不起。嗯。我不知道现在如何更新序列。这会不会是自动的,因为序列[i]=整个事情。。。那么它会自动保存在那个数组中吗?
public class Term {
term = coefficient * x ^ exponent
private double coefficient;
private int exponent;
public Term(double c, int e) {
coefficient = c;
exponent = e;
}
// returns the coefficient
public double getCoefficient() {
return coefficient;
}
// returns the exponent
public int getExponent() {
return exponent;
}
// returns the term as a String for display
// see the sample file for the layout required
public String display() {
// TODO
String tocompile = "tocompile";
return tocompile;
}
}