Esempio n. 1
0
 public MathematicaScalar this[int row, int column] =>
 MathematicaScalar.Create(
     CasInterface,
     IsFullMatrix()
             ? Expression.Args[row].Args[column]
             : CasInterface[Mfs.Part[Expression, (row + 1).ToExpr(), (column + 1).ToExpr()]]
     );
Esempio n. 2
0
        public static MathematicaMatrix CreateConstant(MathematicaScalar scalar, int rows, int columns)
        {
            var mathExpr = scalar.CasInterface[Mfs.ConstantArray[scalar.MathExpr, Mfs.List[rows.ToExpr(), columns.ToExpr()]]];

            return(new MathematicaMatrix(scalar.CasInterface, mathExpr));
        }
Esempio n. 3
0
        public static MathematicaScalar operator *(MathematicaVector vector1, MathematicaVector vector2)
        {
            var e = vector1.CasInterface[Mfs.Dot[vector1.Expression, vector2.Expression]];

            return(MathematicaScalar.Create(vector1.CasInterface, e));
        }
Esempio n. 4
0
        public static MathematicaVector Create(MathematicaScalar scalar, int size)
        {
            var mathExpr = scalar.CasInterface[Mfs.ConstantArray[scalar.Expression, size.ToExpr()]];

            return(new MathematicaVector(scalar.CasInterface, mathExpr));
        }
Esempio n. 5
0
        /// <summary>
        /// Euclidean norm squared of a vector
        /// </summary>
        /// <returns></returns>
        public MathematicaScalar Norm2()
        {
            var e = CasInterface[Mfs.Dot[Expression, Expression]];

            return(MathematicaScalar.Create(CasInterface, e));
        }
Esempio n. 6
0
 public MathematicaScalar this[int index] => MathematicaScalar.Create(
     CasInterface,
     IsFullVector()
         ? Expression.Args[index]
         : CasInterface[Mfs.Part[Expression, (index + 1).ToExpr()]]
     );
Esempio n. 7
0
        public MathematicaScalar DiffBy(MathematicaScalar expr2)
        {
            var e = CasInterface[Mfs.D[MathExpr, expr2.MathExpr]];

            return(new MathematicaScalar(CasInterface, e));
        }
Esempio n. 8
0
 //TODO: Add more overloads to accept integers
 public bool IsEqualScalar(MathematicaScalar expr)
 {
     return(CasInterface.EvalTrueQ(Mfs.Equal[MathExpr, expr.MathExpr]));
 }
Esempio n. 9
0
 public bool IsPossibleScalar(MathematicaScalar expr)
 {
     return(CasInterface.EvalIsTrue(Mfs.PossibleZeroQ[Mfs.Subtract[MathExpr, expr.MathExpr]]));
 }
Esempio n. 10
0
        public MathematicaScalar DiffBy(MathematicaScalar expr2)
        {
            var e = CasInterface[Mfs.D[Expression, expr2.Expression]];

            return(new MathematicaScalar(CasInterface, e));
        }
Esempio n. 11
0
 //TODO: Add more overloads to accept integers
 public bool IsEqualScalar(MathematicaScalar expr)
 {
     return(CasInterface.EvalTrueQ(Mfs.Equal[Expression, expr.Expression]));
 }
Esempio n. 12
0
        /// <summary>
        /// Euclidean norm squared of a vector
        /// </summary>
        /// <returns></returns>
        public MathematicaScalar Norm2()
        {
            var e = CasInterface[Mfs.Dot[MathExpr, MathExpr]];

            return(MathematicaScalar.Create(CasInterface, e));
        }