import java.util.function.DoubleUnaryOperator;
import java.util.function.Function;
import static java.lang.Math.abs;
import static java.lang.Math.PI;
class Inverse {
public static void main(String args[]) {
Function<DoubleUnaryOperator, DoubleUnaryOperator> inverse =
f -> x -> 1. / f.applyAsDouble(x);
DoubleUnaryOperator cot = inverse.apply(Math::tan); // συνεφαπτομένη
DoubleUnaryOperator sec = inverse.apply(Math::cos); // τέμνουσα
DoubleUnaryOperator csc = inverse.apply(Math::sin); // συντέμνουσα
final double EPSILON = 1e-15;
assert abs(sec.applyAsDouble(0) - 1) < EPSILON;
assert abs(csc.applyAsDouble(PI / 2) - 1) < EPSILON;
assert abs(cot.applyAsDouble(PI / 4) - 1) < EPSILON;
}
}