this seems to be an elementary problem, but one i don't think i've ever had to deal with. i'm making a class that deals with polynomial terms, adding, multiplying and evaluating a given polynomial based on its terms.
i'm writing a method to determine if a term, evaluated at 'X,' is greater than zero.
EX: term 6X^2 for X=2 > 0
my coefficient (Double) is stored and can be retrieved as can the exponent (Int) - i'm having trouble evaluating the expression because the carat won't evaluate an expression that is double^int - any tips?
public boolean isPositive(double x){
if (this.coeff * (x^(this.exp)) > 0){
return true;
}
return false;
}
i'm writing a method to determine if a term, evaluated at 'X,' is greater than zero.
EX: term 6X^2 for X=2 > 0
my coefficient (Double) is stored and can be retrieved as can the exponent (Int) - i'm having trouble evaluating the expression because the carat won't evaluate an expression that is double^int - any tips?
public boolean isPositive(double x){
if (this.coeff * (x^(this.exp)) > 0){
return true;
}
return false;
}