1
2
3
4
5
6
7
8
9
10
11
12
13
14
15interface MathFunctions {
16
17 static
18 RealFunction exp =
19 new RealFunction() {
20 public
21 double at(double x) {
22 return
23 Math.exp(x);
24 }
25
26 public
27 String toString() {
28 return
29 "exp(x)";
30 }
31 };
32
33 static
34 RealFunction log =
35 new RealFunction() {
36 public
37 double at(double x) {
38 return
39 Math.log(x);
40 }
41
42 public
43 String toString() {
44 return
45 "log(x)";
46 }
47 };
48
49 static
50 RealFunction sin =
51 new RealFunction() {
52 public
53 double at(double x) {
54 return
55 Math.sin(x);
56 }
57
58 public
59 String toString() {
60 return
61 "sin(x)";
62 }
63 };
64
65 static
66 RealFunction sqr =
67 new RealFunction() {
68 public
69 double at(double x) {
70 return
71 x * x;
72 }
73
74 public
75 String toString() {
76 return "x * x";
77 }
78 };
79}