Пример #1
0
        public static DualNumberGrad Sinh(DualNumberGrad a)
        {
            var sin = Math.Sinh(a.Value);
            var cos = Math.Cosh(a.Value);

            return(new DualNumberGrad(sin, cos * a.Grad));
        }
Пример #2
0
        public static DualNumberGrad Cos(DualNumberGrad a)
        {
            var sin = Math.Sin(a.Value);
            var cos = Math.Cos(a.Value);

            return(new DualNumberGrad(cos, -sin * a.Grad));
        }
Пример #3
0
        public static DualNumberGrad Pow(DualNumberGrad a, double b)
        {
            var pow = Math.Pow(a.Value, b);

            return(new DualNumberGrad(pow, b * pow / a.Value * a.Grad));
        }
Пример #4
0
 public static DualNumberGrad Pow(DualNumberGrad a, DualNumberGrad b) => Exp(b * Log(a));
Пример #5
0
 public static DualNumberGrad Log(DualNumberGrad a)
 {
     return(new DualNumberGrad(Math.Log(a.Value), a.Grad / a.Value));
 }
Пример #6
0
        public static DualNumberGrad Exp(DualNumberGrad a)
        {
            var exp = Math.Exp(a.Value);

            return(new DualNumberGrad(exp, exp * a.Grad));
        }
Пример #7
0
        public static DualNumberGrad Sqrt(DualNumberGrad a)
        {
            var r = Math.Sqrt(a.Value);

            return(new DualNumberGrad(r, 0.5 * a.Grad / r));
        }
Пример #8
0
 public static DualNumberGrad Inverse(DualNumberGrad a)
 {
     return(new DualNumberGrad(1 / a.Value, -a.Grad / (a.Value * a.Value)));
 }
Пример #9
0
 public static DualVectorGrad Vec(DualNumberGrad x, DualNumberGrad y, DualNumberGrad z) => new DualVectorGrad(x, y, z);
Пример #10
0
 public DualVectorGrad(Vector v)
 {
     X = v.X;
     Y = v.Y;
     Z = v.Z;
 }
Пример #11
0
 public DualVectorGrad(DualNumberGrad x, DualNumberGrad y, DualNumberGrad z)
 {
     X = x;
     Y = y;
     Z = z;
 }
Пример #12
0
 public static DualNumberGrad Abs(DualNumberGrad a) => a.Value >= 0 ? a : -a;
Пример #13
0
        public static DualNumberGrad Tanh(DualNumberGrad a)
        {
            var tan = Math.Tanh(a.Value);

            return(new DualNumberGrad(tan, (1 - tan * tan) * a.Grad));
        }
Пример #14
0
 public static DualNumberGrad Atan(DualNumberGrad a)
 {
     return(new DualNumberGrad(Math.Atan(a.Value), a.Grad / (1 + a.Value * a.Value)));
 }
Пример #15
0
 public static DualNumberGrad Acos(DualNumberGrad a)
 {
     return(new DualNumberGrad(Math.Acos(a.Value), -a.Grad / Math.Sqrt(1 - a.Value * a.Value)));
 }