コード例 #1
0
        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);
        }
コード例 #2
0
        public static DoubleAD Log(DoubleAD a)
        {
            DoubleAD c = new DoubleAD();

            c.Setval(System.Math.Log(a.Getval()));
            c.Setdot(a.Getdot() / a.Getval());
            return(c);
        }
コード例 #3
0
        public static DoubleAD PlusConst(DoubleAD a, double b)
        {
            DoubleAD c = new DoubleAD();

            c.Setval(a.Getval() + b);
            c.Setdot(a.Getdot());
            return(c);
        }
コード例 #4
0
        public static DoubleAD Exp(DoubleAD a)
        {
            DoubleAD c = new DoubleAD();

            c.Setval(System.Math.Exp(a.Getval()));
            c.Setdot(a.Getdot() * System.Math.Exp(a.Getval()));
            return(c);
        }
コード例 #5
0
        public static DoubleAD DivideConst(DoubleAD a, double b)
        {
            DoubleAD c = new DoubleAD();

            c.Setval(a.Getval() / b);
            c.Setdot(a.Getdot() / b);
            return(c);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        public static DoubleAD MultConst(DoubleAD a, double b)
        {
            DoubleAD c = new DoubleAD();

            c.Setval(a.Getval() * b);
            c.Setdot(a.Getdot() * b);
            return(c);
        }
コード例 #8
0
        // static methods
        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);
        }