I have some problems with using function when I call the other class.
Main class:
public static void main(String [] args) {
baseIteration(new Function() {
public double calculate(double x) {
return Math.sin(x) - Math.log10(x);
}
@Override
public Object apply(Object t) {
// TODO Auto-generated method stub
return null;
}
}.calculate(double x),0,10.0);
}
And baseIteration function:
public static void baseIteration(Function f, double a, double b) {
double prev = f.calculate(a);
double step = (b-a)/10;
for(double p = a+step; p<=b+10e-8; p+=step) {
double curr = f.calculate(p);
}
}
It is not all, but main problem: f.calculation is undefined!