public DoublePlus div(double constant) { DoublePlus dp = new DoublePlus(); dp.value = value / constant; dp.variance = Errors.var_aA(1 / constant, Math.sqrt(variance)); return dp; }
/** * Calculate the value and standard deviation of this variable divided by an input argument and * calculate the resulting standard deviation, given the standard deviation of the input * multiplier. * * @param x The number to divide this value by. * @param x_SD The standard deviation of the argument value. * @return The DoublePlus representing result +/- error */ public DoublePlus div(double x, double x_SD) { DoublePlus dp = new DoublePlus(); dp.value = value / x; dp.variance = Errors.var_AB(value, Math.sqrt(variance), x, x_SD, dp.value); return dp; }
public DoublePlus div(DoublePlus dp) { return div(dp.value(), dp.SD()); }
public static DoublePlus sqrt(DoublePlus dp) { DoublePlus dplus = new DoublePlus(); dplus.value = Math.sqrt(dp.value); dplus.variance = Errors.var_sqrt_A(dp.value, dp.SD()); return dplus; }
public DoublePlus times(DoublePlus dp) { return times(dp.value(), dp.SD()); }
public static DoublePlus exp(DoublePlus dp) { DoublePlus dplus = new DoublePlus(); dplus.value = Math.exp(dp.value); dplus.variance = Errors.exp_A(dp.value, dp.SD()); return dplus; }
public static DoublePlus ln(DoublePlus dp) { DoublePlus dplus = new DoublePlus(); dplus.value = Math.log(dp.value); dplus.variance = Errors.ln_A(dp.value, dp.SD()); return dplus; }
public DoublePlus minus(DoublePlus dp) { return minus(dp.value(), dp.SD()); }
/** * Calculate the value and standard deviation of this an input argument subtracted from this value * and calculate the resulting standard deviation, given the standard deviation of the input * value. * * @param x The number to subtract from this value. * @param x_SD The standard deviation of the argument value. * @return The DoublePlus representing result +/- error */ public DoublePlus minus(double x, double x_SD) { DoublePlus dp = new DoublePlus(); dp.value = value - x; dp.variance = Errors.var_A_plusMinus_B(Math.sqrt(variance), x_SD); return dp; }
public DoublePlus plus(DoublePlus dp) { return plus(dp.value(), dp.SD()); }