01 package uk.ac.ed.ph.advcompsim.part3.closure;
24 public interface Closure {
25
26 /**
27 * function is a real-valued function of a real variable.
28 *
29 * @param x The argument for the function
30 * @return The value of function(x) of the function
31 * function applied to the argument x.
32 */
33 float function(float x);
34 }
This bit I understand, which means in my class I need to define "function()" - thus...
import java.io.*;
import java.math.*;
import uk.ac.ed.ph.advcompsim.part3.closure.*;
public class exc318 implements Closure {
public static void main (String args[]) {
Closed datasample2; // The data array
}
public float function(float x) {
float f = (float) (Math.pow((double) x, (double)-1/4)); // Math.pow - for the programming language that lost the ^ :(
return f;
}
}