// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
public class Calc {
    private static final double EPS = 0.000001;
    public static double a(double t) {
        return (v(t+EPS/2) - v(t-EPS/2)) / EPS;
    }
    public static double v(double t) {
        return (s(t+EPS/2) - s(t-EPS/2)) / EPS;
    }
    public static double s(double t) {
        return 5*Math.sqrt(t);
    }
    public static double revv(double targetv) {
        double res = 1.0;
        double oldres;
        do {
            oldres = res;
            res = oldres - (v(oldres) - targetv)/a(oldres);
        } while(Math.abs(res - oldres) > EPS);
        return res;
    }
    public static void main(String[] args) {
        System.out.println(revv(2.0));
        System.out.println(s(1.5625));
        System.out.println(v(1.5625));
    }
}
