Professional Documents
Culture Documents
00 Tutorial 7
Agenda
problems
}
class Func4 implements MathFunction2 {
public double fn(double x) {
return x*x*x +5*x- 9;
}
public double fd(double x) {
return 3*x*x + 5;
}
}
Root Finding Exercise (1)
finding (1)
}
class Func4 implements MathFunction2 {
public double fn(double x) {
return x*x*x +5*x- 9;
}
public double fd(double x) {
return 3*x*x + 5;
}
}
Wrap root finding methods in one
class
class RootFinder {
public static final int JMAX= 40; // Maximum #of iterations
public static final double ERR_VAL= -10E10;
methods
methods
class Integration {
public static double rect(MathFunction func, double
a, double b, int n) {}
public static double trap(MathFunction func, double
a, double b, int n) {}
public static double simp(MathFunction func, double
a, double b, int n) {}
}
Write your main class