public DoubleAD() { setval(0); setdot(1); }
public static DoubleAD exp(DoubleAD a){ DoubleAD c = new DoubleAD(); c.setval( Math.exp(a.getval())); c.setdot(a.getdot() * Math.exp(a.getval())); return c; }
public void minusEquals(DoubleAD a){ setval(val - a.getval() ); setdot(dot - a.getdot() ); }
public void plusEquals(DoubleAD a){ setval(val + a.getval() ); setdot(dot + a.getdot() ); }
public static DoubleAD log(DoubleAD a){ DoubleAD c = new DoubleAD(); c.setval( Math.log(a.getval())); c.setdot( a.getdot()/a.getval()); return c; }
public static DoubleAD divideConst(DoubleAD a, double b){ DoubleAD c = new DoubleAD(); c.setval(a.getval()/b); c.setdot( a.getdot()/b ); return c; }
public static DoubleAD multConst(DoubleAD a,double b){ DoubleAD c = new DoubleAD(); c.setval( a.getval() * b ); c.setdot(a.getdot()*b); return c; }
public static DoubleAD plusConst( DoubleAD a,double b){ DoubleAD c = new DoubleAD(); c.setval( a.getval() + b ); c.setdot( a.getdot()); return c; }
public static DoubleAD minusConst( DoubleAD a,double b){ DoubleAD c = new DoubleAD(); c.setval( a.getval() - b ); c.setdot( a.getdot()); return c; }
public static DoubleAD plus(DoubleAD a, DoubleAD b){ DoubleAD c = new DoubleAD(); c.setval( a.getval() + b.getval() ); c.setdot( a.getdot() + b.getdot()); return c; }
public static DoubleAD minus(DoubleAD a, DoubleAD b){ DoubleAD c = new DoubleAD(); c.setval( a.getval() - b.getval() ); c.setdot( a.getdot() - b.getdot()); return c; }
public static DoubleAD mult(DoubleAD a,DoubleAD b){ DoubleAD c = new DoubleAD(); c.setval( a.getval() * b.getval() ); c.setdot(a.getdot()*b.getval() + b.getdot()*a.getval()); return c; }
public static DoubleAD divide(DoubleAD a, DoubleAD b){ DoubleAD c = new DoubleAD(); c.setval(a.getval()/b.getval()); c.setdot( (a.getdot()/b.getval()) - a.getval()*b.getdot() / (b.getval()*b.getval()) ); return c; }
public static DoubleAD log(DoubleAD a){ DoubleAD c = new DoubleAD(); c.setval( Math.log(a.getval())); c.setdot( a.getdot()/a.getval()); return c; }
public static DoubleAD multConst(DoubleAD a,double b){ DoubleAD c = new DoubleAD(); c.setval( a.getval() * b ); c.setdot(a.getdot()*b); return c; }
public static DoubleAD minusConst( DoubleAD a,double b){ DoubleAD c = new DoubleAD(); c.setval( a.getval() - b ); c.setdot( a.getdot()); return c; }
public static DoubleAD divideConst(DoubleAD a, double b){ DoubleAD c = new DoubleAD(); c.setval(a.getval()/b); c.setdot( a.getdot()/b ); return c; }
public static DoubleAD minus(DoubleAD a, DoubleAD b){ DoubleAD c = new DoubleAD(); c.setval( a.getval() - b.getval() ); c.setdot( a.getdot() - b.getdot()); return c; }
public static DoubleAD divide(DoubleAD a, DoubleAD b){ DoubleAD c = new DoubleAD(); c.setval(a.getval()/b.getval()); c.setdot( (a.getdot()/b.getval()) - a.getval()*b.getdot() / (b.getval()*b.getval()) ); return c; }