protected double rotational_derivative(double r) { DerivFunction df = (x) => this.sagitta(x); DerivResult result = Derivatives.central_derivative(df, r, 1e-4); return(result.result); }
protected Vector2 base_derivative(Vector2 xy) { //double abserr; DerivFunction dxf = (x) => this.sagitta(new Vector2(x, xy.y())); DerivFunction dyf = (y) => this.sagitta(new Vector2(xy.x(), y)); DerivResult result = Derivatives.central_derivative(dxf, xy.x(), 1e-6); double dx = result.result; result = Derivatives.central_derivative(dyf, xy.y(), 1e-6); double dy = result.result; // TODO what do we do about error? return(new Vector2(dx, dy)); }