示例#1
0
        public bool EigenSystem(EigenVectorsSpecs specs, out MathematicaVector values, out MathematicaMatrix vectors)
        {
            var sysExpr = CasInterface[Mfs.Eigensystem[MathExpr]];

            values = MathematicaVector.Create(CasInterface, sysExpr.Args[0]);

            Expr vectorsExpr;

            switch (specs)
            {
            case EigenVectorsSpecs.InMatrixRows:
                vectorsExpr = sysExpr.Args[1];
                break;

            case EigenVectorsSpecs.InMatrixColumns:
                vectorsExpr = CasInterface[Mfs.Transpose[sysExpr.Args[1]]];
                break;

            case EigenVectorsSpecs.OrthogonalInMatrixRows:
                vectorsExpr = CasInterface[Mfs.Orthogonalize[sysExpr.Args[1]]];
                break;

            default:
                vectorsExpr = CasInterface[Mfs.Transpose[Mfs.Orthogonalize[sysExpr.Args[1]]]];
                break;
            }

            vectors = Create(CasInterface, vectorsExpr);

            //TODO: Test if the eigen sytem is OK
            return(true);
        }
示例#2
0
        //public MathematicaMatrix SetRow(int index, VectorBase vector);

        //public MathematicaMatrix SetColumn(int index, VectorBase vector);

        //public MathematicaMatrix SetDiagonal(VectorBase vector);

        //public MathematicaMatrix AppendRow(VectorBase vector);

        //public MathematicaMatrix AppendColumn(VectorBase vector);

        public MathematicaVector EigenValues_InVector()
        {
            return(MathematicaVector.Create(CasInterface, CasInterface[Mfs.Eigenvalues[MathExpr]]));
        }
示例#3
0
        public ISymbolicVector GetDiagonal()
        {
            var e = CasInterface[Mfs.Diagonal[MathExpr]];

            return(MathematicaVector.Create(CasInterface, e));
        }
示例#4
0
        public ISymbolicVector GetColumn(int index)
        {
            var e = CasInterface[Mfs.Part[MathExpr, OptionSymbols.All, (index + 1).ToExpr()]];

            return(MathematicaVector.Create(CasInterface, e));
        }
示例#5
0
        public ISymbolicVector Times(ISymbolicVector v)
        {
            var e = CasInterface[Mfs.Dot[MathExpr, v.ToMathematicaVector().MathExpr]];

            return(MathematicaVector.Create(CasInterface, e));
        }
示例#6
0
        public ISymbolicVector GetRow(int index)
        {
            var e = CasInterface[Mfs.Part[Expression, (index + 1).ToExpr(), OptionSymbols.All]];

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