public static int Test_D3()
        {
            SymbolMatrix  D3 = SymbolMatrixUtilities.D3();
            StringBuilder sb = new StringBuilder();//Start building latex

            sb.AppendFormat(@"{0}", D3.ToLatex());

            HtmlOutputMethods.WriteLatexEqToHtmlAndLaunch(sb.ToString(), "Test_D3.html"); //display Latex via mathjax

            return(0);
        }
        public static int Test_Flip()
        {
            SymbolMatrix C3Flip = SymbolMatrixUtilities.C3().Flip().ReName(new List <string> {
                "d", "e", "f"
            });
            StringBuilder sb = new StringBuilder();//Start building latex

            sb.Append(@"\begin{aligned}");
            sb.AppendFormat(@"&{0} \\ \\", SymbolMatrixUtilities.C3().ToLatex());
            sb.AppendFormat(@"&{0}", C3Flip.ToLatex());
            sb.Append(@"\end{aligned}");

            HtmlOutputMethods.WriteLatexEqToHtmlAndLaunch(sb.ToString(), "Test_Flip.html"); //display Latex via mathjax

            return(0);
        }
Пример #3
0
        public static SymbolMatrix D3()
        {
            SymbolMatrix retVal = new SymbolMatrix(6, 6);

            SymbolMatrix smC3   = C3();
            SymbolMatrix C3Flip = SymbolMatrixUtilities.C3().Flip().ReName(new List <string> {
                "d", "e", "f"
            });

            int rowCount;
            int colCount;

            for (rowCount = 0; rowCount < smC3.Rows; rowCount++)
            {
                for (colCount = 0; colCount < smC3.Columns; colCount++)
                {
                    retVal[rowCount, colCount] = smC3[rowCount, colCount];
                }
            }

            for (rowCount = 3; rowCount < smC3.Rows + 3; rowCount++)
            {
                for (colCount = 0; colCount < smC3.Columns; colCount++)
                {
                    retVal[rowCount, colCount] = C3Flip[rowCount - 3, colCount];
                }
            }

            for (rowCount = 3; rowCount < smC3.Rows + 3; rowCount++)
            {
                for (colCount = 3; colCount < smC3.Columns + 3; colCount++)
                {
                    retVal[rowCount, colCount] = smC3[rowCount - 3, colCount - 3];
                }
            }

            for (rowCount = 0; rowCount < smC3.Rows; rowCount++)
            {
                for (colCount = 3; colCount < smC3.Columns + 3; colCount++)
                {
                    retVal[rowCount, colCount] = C3Flip[rowCount, colCount - 3];
                }
            }

            return(retVal);
        }
        public static int Test_Symbol_Groups()
        {
            SymbolMatrix smK  = SymbolMatrixUtilities.KleinGroup(); //Get kleingroup cayle table
            SymbolMatrix smQL = SymbolMatrixUtilities.LeftChiralQuaternion();
            SymbolMatrix smQR = SymbolMatrixUtilities.RightChiralQuaternion();

            StringBuilder sb = new StringBuilder();//Start building latex

            sb.Append(@"\begin{aligned}");
            sb.AppendFormat(@"&{0} \\ \\", smK.ToLatex("F"));
            sb.AppendFormat(@"&{0} \\ \\", smQL.ToLatex("F"));
            sb.AppendFormat(@"&{0}", smQR.ToLatex("F"));
            sb.Append(@"\end{aligned}");

            HtmlOutputMethods.WriteLatexEqToHtmlAndLaunch(sb.ToString(), "Test_KleinGroup.html"); //display Latex via mathjax
            return(0);
        }
        public static int Test_KroneckerProduct()
        {
            SymbolMatrix A1 = new SymbolMatrix(2, 2, //create a 2 X 2 symbol matrix with symbols a,b,c,d
                                               new List <Symbol>
            {
                new Symbol("a"), new Symbol("b"),
                new Symbol("c"), new Symbol("d")
            });

            SymbolMatrix A2 = new SymbolMatrix(2, 2, //create a 2 X 2 symbol matrix with symbols e,f,g,h
                                               new List <Symbol>
            {
                new Symbol("e"), new Symbol("f"),
                new Symbol("g"), new Symbol("h")
            });
            StringBuilder sb = new StringBuilder();//Start building latex

            sb.AppendFormat(@"{0}", SymbolMatrixUtilities.KroneckerProduct(A1, A2).ToLatex("F"));

            HtmlOutputMethods.WriteLatexEqToHtmlAndLaunch(sb.ToString(), "Test_KroneckerProduct.html"); //display Latex via mathjax
            return(0);
        }
        public static int Test_Symbol_Determinant()
        {
            //SymbolMatrix C3 = SymbolMatrixUtilities.C3RowColumn();
            //Symbol det = C3.Determinant();
            //Symbol det = SymbolMatrixUtilities.C4RowColumn().Determinant();
            //SymbolMatrix smK = SymbolMatrixUtilities.KleinGroup(); //Get kleingroup cayle table
            //Symbol det = smK.Determinant();


            SymbolMatrix        smK    = SymbolMatrixUtilities.C3RowColumn();
            List <CoFactorInfo> cfList = SymbolMatrix.GetAllMatrixCoFactors(smK);
            StringBuilder       sb     = new StringBuilder();//Start building latex

            sb.Append(@"\begin{aligned}");
            sb.AppendFormat(@"&{0} \\ \\", smK.ToLatex());

            /*
             * int inc = 0;
             * CoFactorInfo cfi = null;
             *
             * while(inc < cfList.Count)
             * {
             *  if(cfi == null)
             *  {
             *      cfi = cfList[inc];
             *  }
             *  else if(cfi != null && cfi.ListOfLists.Count == 0) //init value
             *  {
             *      List<CoFactorInfo> cfListChild = SymbolMatrix.GetCoFactors(cfi.Minor);
             *      cfi.ListOfLists.Add(cfListChild);
             *
             *      if(cfListChild[0].Minor.Rows == 2) //end of line
             *      {
             *          cfList[inc] = cfi;
             *          cfi = null;
             *          inc++;
             *      }
             *  }
             *  else if(cfi != null && cfi.ListOfLists.Count > 0) //have values
             *  {
             *      List<CoFactorInfo> cfListChild = SymbolMatrix.GetCoFactors(cfi.Minor);
             *      cfi.ListOfLists.Add(cfListChild);
             *
             *      if(cfListChild[0].Minor.Rows == 2) //end of line
             *      {
             *          cfList[inc] = cfi;
             *          cfi = null;
             *          inc++;
             *      }
             *
             *  }
             * }
             *
             */


            foreach (CoFactorInfo ci in cfList)
            {
                sb.AppendFormat(@"&{0} \\ \\", ci.CoFactor.Tokens[0].Value + ci.Minor.ToLatex());

                /*
                 * if (ci.Minor.Rows > 2)
                 * {
                 *  List<CoFactorInfo> cfList2 = SymbolMatrix.GetCoFactors(ci.Minor);
                 *
                 *  foreach (CoFactorInfo ci2 in cfList2)
                 *  {
                 *      sb.AppendFormat(@"&{0} \\ \\", ci.CoFactor.Tokens[0].Value + ci2.CoFactor.Tokens[0].Value + ci2.Minor.ToLatex());
                 *  }
                 * }
                 */

                foreach (List <CoFactorInfo> lstChild in ci.ListOfLists)
                {
                    foreach (CoFactorInfo ci2 in lstChild)
                    {
                        //if (ci2.Minor.Rows == 4)
                        {
                            sb.AppendFormat(@"&{0} \\ \\", ci.CoFactor.Tokens[0].Value + ci2.CoFactor.Tokens[0].Value + ci2.Minor.ToLatex());

                            /*
                             * string det = string.Format("({0} - {1})",
                             * ci2.Minor[0, 0].Tokens[0]. Value + ci2.Minor[1, 1].Tokens[0]. Value,
                             * ci2.Minor[1, 0].Tokens[0]. Value + ci2.Minor[0, 1].Tokens[0]. Value);
                             *
                             * sb.AppendFormat(@"&{0} \\ \\", ci.CoFactor.Tokens[0].Value + ci2.CoFactor.Tokens[0].Value + det);
                             */
                        }
                    }
                }
            }
            sb.Append(@"\end{aligned}");

            HtmlOutputMethods.WriteLatexEqToHtmlAndLaunch(sb.ToString(), "Test_Symbol_Determinant.html"); //display Latex via mathjax


            return(0);
        }